Fix incorrect status ETA and percent complete for multi-port scans with --list-of-ips and --rate#835
Merged
Fix incorrect status ETA and percent complete for multi-port scans with --list-of-ips and --rate#835
--list-of-ips and --rate#835Conversation
zakird
approved these changes
Mar 21, 2024
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.
Description
It seems that when #831 was opened, this was run before #825 that capped the percentage complete (this is why I have 3 tests, 1 for the code the issue opener used, one for
mainand one for post-fix).Changes
Only real change is in
monitor.cto factor in number of ports when calculating time remaining. Not considering this led to the percentage growing over 100%, ex: scanning 3 ports meant percentage complete would rise to 300%. I tried to make an integration test to test thestatus_fileto make sure that the eta was non-increasing, the percentage complete was non-decreasing, etc. However, this can't be run with--dryrunand so the test was taking forever to run withpytest. Decided it wasn't necessary but refactored a bit in theintegration-testswhile I was there.Testing
Using
be2b(prior to capping percentage complete). Note the crazy percentage complete, which matches what the issue opener saw.~/zmap-dev on main! ⌚ 18:13:53
$ sudo ./src/zmap -p 22-28 -w random_ips.txt -o /dev/null -r 10000 -c 1
...
0:00 0%; send: 0 0 p/s (0 p/s avg); recv: 0 0 p/s (0 p/s avg); drops: 0 p/s (0 p/s avg); hitrate: 0.00%
0:01 53%; send: 10391 10.4 Kp/s (9.77 Kp/s avg); recv: 23 23 p/s (21 p/s avg); drops: 0 p/s (0 p/s avg); hitrate: 0.22%
0:02 100%; send: 20392 10.00 Kp/s (9.88 Kp/s avg); recv: 46 23 p/s (22 p/s avg); drops: 0 p/s (0 p/s avg); hitrate: 0.23%
0:03 100%; send: 30271 9.88 Kp/s (9.88 Kp/s avg); recv: 46 0 p/s (15 p/s avg); drops: 0 p/s (0 p/s avg); hitrate: 0.15%
0:04 100%; send: 40271 10.00 Kp/s (9.91 Kp/s avg); recv: 63 17 p/s (15 p/s avg); drops: 0 p/s (0 p/s avg); hitrate: 0.16%
0:05 100% (0s left); send: 50273 10.0 Kp/s (9.93 Kp/s avg); recv: 89 26 p/s (17 p/s avg); drops: 0 p/s (0 p/s avg); hitrate: 0.18%
0:06 100% (0s left); send: 60272 10.00 Kp/s (9.94 Kp/s avg); recv: 120 31 p/s (19 p/s avg); drops: 0 p/s (0 p/s avg); hitrate: 0.20%
0:07 100% (0s left); send: 69873 9.60 Kp/s (9.89 Kp/s avg); recv: 137 17 p/s (19 p/s avg); drops: 0 p/s (0 p/s avg); hitrate: 0.20%
0:08 99% (1s left); send: 70000 done (9.84 Kp/s avg); recv: 163 26 p/s (20 p/s avg); drops: 0 p/s (0 p/s avg); hitrate: 0.23%
0:09 100% (0s left); send: 70000 done (9.84 Kp/s avg); recv: 163 0 p/s (17 p/s avg); drops: 0 p/s (0 p/s avg); hitrate: 0.23%
~/zmap-dev on phillip/832! ⌚ 18:15:13
$ sudo ./src/zmap -p 22-28 -w random_ips.txt -o /dev/null -r 10000 -c 1
...
0:00 0%; send: 0 0 p/s (0 p/s avg); recv: 0 0 p/s (0 p/s avg); drops: 0 p/s (0 p/s avg); hitrate: 0.00%
0:01 13%; send: 10368 10.4 Kp/s (9.85 Kp/s avg); recv: 21 21 p/s (19 p/s avg); drops: 0 p/s (0 p/s avg); hitrate: 0.20%
0:02 25%; send: 20370 10.0 Kp/s (9.92 Kp/s avg); recv: 32 11 p/s (15 p/s avg); drops: 0 p/s (0 p/s avg); hitrate: 0.16%
0:03 38%; send: 30372 10.0 Kp/s (9.95 Kp/s avg); recv: 52 20 p/s (17 p/s avg); drops: 0 p/s (0 p/s avg); hitrate: 0.17%
0:04 50%; send: 40375 10.0 Kp/s (9.96 Kp/s avg); recv: 79 27 p/s (19 p/s avg); drops: 0 p/s (0 p/s avg); hitrate: 0.20%
0:05 63% (3s left); send: 50380 10.0 Kp/s (9.97 Kp/s avg); recv: 100 21 p/s (19 p/s avg); drops: 0 p/s (0 p/s avg); hitrate: 0.20%
0:06 76% (2s left); send: 60381 10.00 Kp/s (9.97 Kp/s avg); recv: 126 26 p/s (20 p/s avg); drops: 0 p/s (0 p/s avg); hitrate: 0.21%
0:07 88% (2s left); send: 69943 9.56 Kp/s (9.91 Kp/s avg); recv: 147 21 p/s (20 p/s avg); drops: 0 p/s (0 p/s avg); hitrate: 0.21%
0:08 100% (1s left); send: 70000 done (9.89 Kp/s avg); recv: 160 13 p/s (19 p/s avg); drops: 0 p/s (0 p/s avg); hitrate: 0.23%
0:09 100% (0s left); send: 70000 done (9.89 Kp/s avg); recv: 160 0 p/s (17 p/s avg); drops: 0 p/s (0 p/s avg); hitrate: 0.23%