msdat
msdat copied to clipboard
oleautomation write file still uses python2 syntax
You will get an error as below when running the command:
./msdat.py oleautomation -s x.x.x.x -p 1433 -U sa -P sa --put-file '/home/kali/Desktop/test.txt' 'C:/temp/'
[1] (x.x.x.x:1433): Try to copy the local file /home/kali/test.txt to C:/temp/
Traceback (most recent call last):
File "/home/kali/pentest/tools/msdat/./msdat.py", line 394, in <module>
main()
File "/home/kali/pentest/tools/msdat/./msdat.py", line 389, in main
arguments.func(args)
File "/home/kali/pentest/tools/msdat/OleAutomation.py", line 285, in runOleAutomationModule
data = oleAutomation.putFile(args['put-file'][0],args['put-file'][1])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kali/pentest/tools/msdat/OleAutomation.py", line 184, in putFile
dataEncoded = "0x"+data.encode('hex')
^^^^^^^^^^^
AttributeError: 'bytes' object has no attribute 'encode'. Did you mean: 'decode'?
The change here should resolve it.