Skip to content

Conversation

NeffIsBack
Copy link
Contributor

Currently, each time a row is printed in the printRows function in tds.py a new line as added using the \n character. However, due to the way the DummyPrint class handles the \n character, two new lines are added leading to an additional (unnecessary) new line:

impacket/impacket/tds.py

Lines 57 to 64 in 082dca3

class DummyPrint:
def logMessage(self,message):
if message == '\n':
print(message)
elif message == '\r':
print()
else:
print(message, end=' ')

Example screenshot from the current state:
image

This is fixed by using the character \r, which is interpreted as a single new line by the DummyPrint class, resulting in proper table formatting:
image

@gabrielg5 gabrielg5 self-assigned this Sep 16, 2025
@gabrielg5
Copy link
Collaborator

Thank you @NeffIsBack! merging now!

Note: checking this one found that some data types are not printed ok (those UserID and SID)
image
Will create another issue to take care of that one

Thanks!

@gabrielg5 gabrielg5 merged commit 0a5a9d7 into fortra:master Sep 17, 2025
7 checks passed
@NeffIsBack
Copy link
Contributor Author

Yeah saw this as well, but i didn't want to break decoding etc. My guess would be that a simple if type(val) == bytes: val.decode().strip() would be sufficient, but that would have to be tested properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants