fullhunt / log4j-scan

A fully automated, accurate, and extensive scanner for finding log4j RCE CVE-2021-44228
MIT License
3.39k stars 742 forks source link

AttributeError: module 'time' has no attribute 'clock' when running with Python 3.9.9 #14

Closed chroche closed 2 years ago

chroche commented 2 years ago

I'm getting this stack trace when launching with

> python3 --version
Python 3.9.9
> uname -v 
Darwin Kernel Version 19.6.0: Tue Jun 22 19:49:55 PDT 2021; root:xnu-6153.141.35~1/RELEASE_X86_64
> python3 log4j-scan.py -u https://myservice.com --run-all-tests
[•] CVE-2021-44228 - Apache Log4j RCE Scanner
[•] Scanner provided by FullHunt.io - The Next-Gen Attack Surface Management Platform.
[•] Secure your External Attack Surface with FullHunt.io.
[•] Initiating DNS callback server (interact.sh).
Traceback (most recent call last):
  File "/Users/rochec/Documents/Temp/log4j-scan/log4j-scan.py", line 336, in <module>
    main()
  File "/Users/rochec/Documents/Temp/log4j-scan/log4j-scan.py", line 306, in main
    dns_callback = Interactsh()
  File "/Users/rochec/Documents/Temp/log4j-scan/log4j-scan.py", line 156, in __init__
    rsa = RSA.generate(2048)
  File "/usr/local/lib/python3.9/site-packages/Crypto/PublicKey/RSA.py", line 508, in generate
    obj = _RSA.generate_py(bits, rf, progress_func, e)    # TODO: Don't use legacy _RSA module
  File "/usr/local/lib/python3.9/site-packages/Crypto/PublicKey/_RSA.py", line 50, in generate_py
    p = pubkey.getStrongPrime(bits>>1, obj.e, 1e-12, randfunc)
  File "/usr/local/lib/python3.9/site-packages/Crypto/Util/number.py", line 264, in getStrongPrime
    return _fastmath.getStrongPrime(int(N), int(e), false_positive_prob,
  File "/usr/local/lib/python3.9/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 202, in read
    return self._singleton.read(bytes)
  File "/usr/local/lib/python3.9/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 202, in read
    return self._singleton.read(bytes)
  File "/usr/local/lib/python3.9/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 202, in read
    return self._singleton.read(bytes)
  File "/usr/local/lib/python3.9/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 178, in read
    return _UserFriendlyRNG.read(self, bytes)
  File "/usr/local/lib/python3.9/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 129, in read
    self._ec.collect()
  File "/usr/local/lib/python3.9/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 77, in collect
    t = time.clock()
AttributeError: module 'time' has no attribute 'clock'

Seems to be due to this:

The function time.clock() has been removed, after having been deprecated since Python 3.3: use time.perf_counter() or time.process_time() instead, depending on your requirements, to have well-defined behavior.
ccavus commented 2 years ago

you can try this. pip3 uninstall PyCrypto pip3 install -U PyCryptodome

AnonymousWP commented 2 years ago

Was already reported by others, see: https://github.com/fullhunt/log4j-scan/issues. Why creating a whole new issue for the same problem, lol.

chroche commented 2 years ago

Duplicate of #10

advamu commented 2 years ago

pip3 install -U PyCryptodome

ok 4 me

mazen160 commented 2 years ago

Please check: https://github.com/fullhunt/log4j-scan/issues/10#issuecomment-993304115