infosec-au / altdns

Generates permutations, alterations and mutations of subdomains and then resolves them
Apache License 2.0
2.26k stars 446 forks source link

Compatibility with Python 3 #31

Closed pallyndr closed 2 years ago

pallyndr commented 3 years ago

When running in Python 3, there is an error message: File "/usr/local/lib/python3.8/site-packages/altdns/main.py", line 10, in from Queue import Queue as Queue ModuleNotFoundError: No module named 'Queue'

That is because in Python 3 some changes happened.

Correct statement in usr/local/lib/python3.8/site-packages/altdns/main.py: from queue import Queue as queue

also change, right after main(): q = queue()

marcelo321 commented 3 years ago

Thank you @pallyndr!

bewniac commented 3 years ago

I also got syntax warnings for using "is not" and "is" when comparing values.

/usr/local/lib/python3.8/site-packages/altdns/__main__.py:45: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if actual_sub[-1:] is not ".":
/usr/local/lib/python3.8/site-packages/altdns/__main__.py:102: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if len(current_sub[0]) > 0 and actual_sub[:1] is not "-":
/usr/local/lib/python3.8/site-packages/altdns/__main__.py:112: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if actual_sub[-1:] is not "-":
/usr/local/lib/python3.8/site-packages/altdns/__main__.py:175: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(result) is 1:

This workaround fix the warnings and the Queue issue as well for me.

sed -i 's/from Queue import/from queue import/g' /usr/local/lib/python3.8/dist-packages/altdns/__main__.py
sed -i 's/if len(result) is 1/if len(result) == 1/g' /usr/local/lib/python3.8/dist-packages/altdns/__main__.py
sed -i 's/is not/!=/g' /usr/local/lib/python3.8/dist-packages/altdns/__main__.py
D1al-T0ne commented 3 years ago

The code in the github repository seems to reflect the fix that @bewniac used for substituting the "from Queue" to "from queue". Theres no need to change the "as Queue" to "as queue" like @pallyndr suggested. I just used the pip install, and the code still has this issue.

vaibhavshn commented 3 years ago

The code in the github repository seems to reflect the fix that @bewniac used for substituting the "from Queue" to "from queue". Theres no need to change the "as Queue" to "as queue" like @pallyndr suggested. I just used the pip install, and the code still has this issue.

Yes, it seems they haven't updated the package, last update was on May 23, 2019.

@infosec-au, could you please update the package on PyPi.

Thanks.

edoardottt commented 3 years ago

The solution provided by @bewniac works perfectly.
Be aware to adjust the right path, in my case ~/.local/lib/python3.9/site-packages/...

PeterDaveHello commented 2 years ago

PR #38 could also be helpful. Looks like the project owner is still active on GitHub, @infosec-au would you like to take a quick look at #31 and #38? Forgive me if this is disturbing you.

infosec-au commented 2 years ago

Hi @PeterDaveHello - I have merged #38