mssqlclient.py ERROR MSG can you help please ?

Hello,

Can you help me please ?

I try to execute mssqlclient.py for i connect at this SQL Server : 10.10.10.27 for the startpoint.

I have installed Python3 and impacket but when i do this command i have
a error msg :

cmd

root@kali:/usr/share/doc/python3-impacket/examples# python3 mssqlclient.py ARCHETYPE/sql_sc:M3g4c0rp123@10.10.10.27 -windows-auth
Impacket v0.9.22.dev1 - Copyright 2020 SecureAuth Corporation

[-] (‘unpack requires a buffer of 1 bytes’, “When unpacking field ‘Type | <B | b’‘[:1]’”)

Thanks :smile:

First, make sure that you have a recent impacket version:

Then try this:

Find your tds.py: $ locate tds.py

/usr/lib/python3.7/site-packages/impacket/tds.py
/usr/lib64/python3.6/site-packages/impacket/tds.py

Edit tds.py on lines 514-515 :

prelogin['Encryption'] = TDS_ENCRYPT_NOT_SUP
# prelogin['Encryption'] = TDS_ENCRYPT_OFF

Same things. The localisation is in usr/lib/python3/dist-packages/impacket/tds.py

My version of impacket is 0.9.22.

My version of python is 3.8.6-1

Same issue for me as well as in the original post:

Error:
[-] (‘unpack requires a buffer of 1 bytes’, “When unpacking field ‘Type | <B | b’‘[:1]’”)

Impacket & Python versions:
Impacket v0.9.22.dev1+20201112.141202.d1ced941
Python 3.8.6

Git pull just came back with it already being the newest version (not surprising as it was only downloaded an hour ago).

Also tried the modifications to tds.py but getting the same error.

Think we all have the same problem … someone has fixed it?

is there any other solution, i’ve tried it but it’s still an error

The “mssqlclient.py ERROR” message typically indicates an issue with the Microsoft SQL Server client library. Here are some steps you can take to try to fix the issue:

Check the connection string: The error could be caused by an incorrect connection string. Double-check the connection string and make sure that it is correct and properly formatted.

Check network connectivity: The error could be caused by a network connectivity issue. Make sure that the server is reachable and that there are no firewall or network issues blocking the connection.

Check authentication: The error could be caused by an authentication issue. Make sure that the username and password are correct and that the user has the necessary permissions to access the database.

Check driver installation: The error could be caused by a missing or outdated driver. Make sure that the Microsoft SQL Server client library is installed and up-to-date.

Check the version of Python: The error could be caused by an incompatible version of Python. Make sure that the version of Python being used is compatible with the version of the Microsoft SQL Server client library being used.

Consult documentation or forums: If you’re still having trouble fixing the error, consult the documentation or forums for the Microsoft SQL Server client library or the Python library you’re using. You may find that others have encountered the same issue and have already found a solution.

Regards,
Rachel Gomez