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

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

Closed
chroche opened this issue Dec 13, 2021 · 5 comments

Comments

@chroche
Copy link

chroche commented Dec 13, 2021

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
Copy link

ccavus commented Dec 13, 2021

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

@AnonymousWP
Copy link

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
Copy link
Author

chroche commented Dec 13, 2021

Duplicate of #10

@advamu
Copy link

advamu commented Dec 13, 2021

pip3 install -U PyCryptodome

ok 4 me

@mazen160
Copy link
Contributor

Please check: #10 (comment)

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

No branches or pull requests

5 participants