Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug at line number 232 when bindata is finally written into file (Windows Environment) #12

Closed
readercrap opened this issue Aug 3, 2017 · 1 comment

Comments

@readercrap
Copy link

Hi,
First thanks for sharing this PoC.
When we run this code in windows OS to generate the the lnk file it introduces the character '\x0D' before the langth of the name (length will be 10 '\x0A' after including null char at end of name )i.e. "Microsoft" in this case. As name Microsoft is hard coded there it will always do this thing, but if you change the name to any other name whose length is 10 (including null byte) than this problem will persist there.
Reason: As we are writing the final data to the file in simple "write mode" rather than "write in binary mode" so it will write '\x0D\x0A" instead of '\x0A' beacause '\x0A' represents LF which will be replaced by CRLF (i.e. '\x0D\x0A') in windows.
Solution: need to change write mode to binary mode at line number 232. i.e.
with open(lnkpath, 'w') as lnkf:
change to
with open(lnkpath, 'wb') as lnkf:

and problem will be solved.
In Linux there is no problem.

Thanks

@nixawk
Copy link
Owner

nixawk commented Aug 3, 2017

Thanks @readercrap . Fix it. - 96eaad8

@nixawk nixawk closed this as completed Aug 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants