Skip to content

Conversation

@anaselfaijah
Copy link

Hello,

I'm using your tool for a cybersecurity class. since it was written in Python 2, which is old now, i ported it to Python 3 to make it easier to use.

I used 2to3 and autopep8 as a base. Then i manually fixed the logic errors, mostly regarding how Python 3 handles bytes and strings.

What changed:

  • Removed ord() calls from packet parsing logic because indexing bytes in Python 3 returns integers directly.

  • Enforced byte-encoding for all packet transmissions to fix TypeError issues when concatenating strings to bytes.

  • Fixed a crash in the MD5 hashing function by ensuring files are opened in binary mode ('rb') instead of text mode.

  • Updated the generated dig commands to include the +noidnin flag.

  • Removed unused import (binascii) and cleaned up indentation using PEP8 standards.

    => Note: the diff looks large because of the whitespace changes, but the logic is the same.

Testing:

  • The script starts correctly: sudo python3 dnsteal.py 127.0.0.1 -z -v
  • I successfully ran a full file transfer test.
  • The MD5 checksum matched the original file.

Thanks for the tool. hope this helps others learn.

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.

1 participant