-
Notifications
You must be signed in to change notification settings - Fork 63
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
Changing the logic in the requests configuration #600
Changing the logic in the requests configuration #600
Conversation
artemis/config.py
Outdated
@@ -129,12 +129,12 @@ class Limits: | |||
"E.g. when set to 100, Artemis will send no more than 100 port scanning packets per seconds per port scanner instance.", | |||
] = get_config("SCANNING_PACKETS_PER_SECOND", default=100, cast=int) | |||
|
|||
SECONDS_PER_REQUEST: Annotated[ | |||
REQUEST_PER_SECOND: Annotated[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
REQUESTS_PER_SECOND
artemis/config.py
Outdated
int, | ||
""" | ||
E.g. when set to 2, Artemis will make sure no HTTP/MySQL connect/... request takes less than 2 seconds, sleeping if needed. | ||
E.g. when set to 2, Artemis will make sure no more HTTP/MySQL connect/... requests take place per second, sleeping if needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no more than 2 ...
artemis/utils.py
Outdated
if func_time < average_time_per_request: | ||
time.sleep(average_time_per_request - func_time) | ||
elif request_per_second < 1: | ||
seconds_for_req = math.floor(1 / request_per_second) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
czemu floor? jak ma byc 0.75 requesta per second to sleep 1/0.75 i zalatwione
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming int, now is float - so it can be that way.
str(int(Config.Limits.SECONDS_PER_REQUEST * 1000.0 / len(tasks_filtered))), | ||
str(int((1 / Config.Limits.REQUEST_PER_SECOND) * 1000.0 / len(tasks_filtered))) | ||
if Config.Limits.REQUEST_PER_SECOND != 0 | ||
else str(int(0)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why int(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bump
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the value here, not the structure. It was earlier here, and I assumed it had its purpose. But if you change the structure, it won't work (nuclei takes int), and tests will (obviously) not pass in one of our config conditions. So - do you propose something specific here, or you just asked?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant that 'else str(int(0))' can be reduced to 'else str(0)'
if time_elapsed < Config.Limits.SECONDS_PER_REQUEST: | ||
time.sleep(Config.Limits.SECONDS_PER_REQUEST - time_elapsed) | ||
elif request_per_second >= 1: | ||
average_time_per_request = 1 / request_per_second |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now you have two duplicate if branches
No description provided.