byt3bl33d3r/SprayingToolkit

Atomizer Fails - Sleep length must be non-negative

seajaysec opened this issue · 5 comments

I've been experiencing a problem where atomizer.py crashes occasionally while sleeping until the next spray.

Traceback (most recent call last):pray
  File "atomizer.py", line 186, in <module>
    countdown_timer(*args['--interval'].split(':'))
  File "/opt/SprayingToolkit/core/utils/time.py", line 31, in countdown_timer
    time.sleep((target - now()).total_seconds())
ValueError: sleep length must be non-negative

The crashes happen at random intervals and don't seem to correlate to any specific time in the countdown. Sometimes it will count down successfully all the way and perform another spray, sometimes it will do so successfully many times, but sometimes it crashes.

This is on the latest version of SprayingToolkit, installed with pipenv. Ran after loading the virtual environment.

@chrsjhnsn can you give me the full command line you used and the debug output?

Thanks

Just had a chance to run through this again. Tried with this command:

python atomizer.py owa ███████.com ./pass.txt ./users.txt --interval 1:11:11 --threads 100

It cycled through like 5x before returning the same non-negative error. Re-running now with de-bug on and I'll share what it looks like next time it crops up.

When it hit the non-negative error, it was just about to run through for the 6th time.

Ok, not a lot of additional info from debug mode actually. This happened again as the timer hit 0 and it was gearing up to do another round of sprays.

ThreadPoolExecutor-0_86 urllib3.connectionpool: https://autodiscover-s.outlook.com:443 "GET /autodiscover/autodiscover.xml HTTP/1.1" 401 343
ThreadPoolExecutor-0_86 auth_owa_O365(███@█████████.com): [-] Authentication failed: ███@█████████.com:Winter2019! (Invalid credentials)
ThreadPoolExecutor-0_33 urllib3.connectionpool: https://autodiscover-s.outlook.com:443 "GET /autodiscover/autodiscover.xml HTTP/1.1" 401 343
ThreadPoolExecutor-0_33 auth_owa_O365(███@█████████.com): [-] Authentication failed: ███@█████████.com:Winter2019! (Invalid credentials)
MainThread            atomize: exiting
Traceback (most recent call last):pray
  File "atomizer.py", line 186, in <module>
    countdown_timer(*args['--interval'].split(':'))
  File "/opt/SprayingToolkit/core/utils/time.py", line 31, in countdown_timer
    time.sleep((target - now()).total_seconds())
ValueError: sleep length must be non-negative
alxbl commented

I can reproduce this reliably by hitting Ctrl-Z and running fg while the interval timer is running. I think the easiest way to fix this would be to refactor the code to compute the target time and sleep for one second while now() <= target_time. Being a second or two late on the spray should have minimal impact.

I can probably have a PR ready for review by tomorrow.