Migration to python3#17
Open
anaselfaijah wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
2to3andautopep8as 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
TypeErrorissues 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
digcommands to include the+noidninflag.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:
sudo python3 dnsteal.py 127.0.0.1 -z -vThanks for the tool. hope this helps others learn.