I am writing backdoor in Zaid´s course and I have got stuck at downloading images.
Everything works just fine except write_file method in listener. Everytime I download immage from win machine, data get written into file still base64 encoded.
For sake of experiment when I download the .txt it is the same, when I open it, text is encoded. Tried several options from stackoverflow and elswhere but nothing work
This is how my code looks
When executed everything run as expected
But when i file downloaded image it say ASCII text
And when I cat it there is base64 encoded data writen in it.
Code from backdor on win machine just for sure
Don’t do encode/decode using base64 as you are sending bytes itself over the socket. Base64 is meesing up the magic numbers of the jpg file. Just directly read and write it and it will work
It doesn’t work. It is even in the course, that images can’t be downloaded this way. It works just for .txt
It is throwing this error
Which python version are you using? I am using 3.8.3 and it works on mine. I am just opening a JPG file using
rb and writing the contents of that to a variable x using
f.read() and then while receiving it, I am opening a new file using
wb and just doing
f.write(x). While doing
file test.jpg in the terminal, it is showing JPEG file.
Well, I rolled back to the previous version I had and went through it again… now it works perfectly, even though I cant find difference.
Glad it worked. There are a lot functions/libraries that start acting weird with different versions