add rate limit
This commit is contained in:
@@ -32,6 +32,7 @@ parser.add_argument('-i', help='Import target URLs from file.', dest='import_fil
|
|||||||
parser.add_argument('-T', help='HTTP request timeout in seconds. (default: 15)', dest='timeout', type=float, default=15)
|
parser.add_argument('-T', help='HTTP request timeout in seconds. (default: 15)', dest='timeout', type=float, default=15)
|
||||||
parser.add_argument('-c', help='Chunk size. The number of parameters to be sent at once', type=int, dest='chunks', default=250)
|
parser.add_argument('-c', help='Chunk size. The number of parameters to be sent at once', type=int, dest='chunks', default=250)
|
||||||
parser.add_argument('-q', help='Quiet mode. No output.', dest='quiet', action='store_true')
|
parser.add_argument('-q', help='Quiet mode. No output.', dest='quiet', action='store_true')
|
||||||
|
parser.add_argument('--rate-limit', help='Max number of requests to be sent out per second (default: 9999)', dest='rate_limit', type=int, default=9999)
|
||||||
parser.add_argument('--headers', help='Add headers. Separate multiple headers with a new line.', dest='headers', nargs='?', const=True)
|
parser.add_argument('--headers', help='Add headers. Separate multiple headers with a new line.', dest='headers', nargs='?', const=True)
|
||||||
parser.add_argument('--passive', help='Collect parameter names from passive sources like wayback, commoncrawl and otx.', dest='passive', nargs='?', const='-')
|
parser.add_argument('--passive', help='Collect parameter names from passive sources like wayback, commoncrawl and otx.', dest='passive', nargs='?', const='-')
|
||||||
parser.add_argument('--stable', help='Prefer stability over speed.', dest='stable', action='store_true')
|
parser.add_argument('--stable', help='Prefer stability over speed.', dest='stable', action='store_true')
|
||||||
|
|||||||
@@ -6,10 +6,13 @@ import warnings
|
|||||||
|
|
||||||
import arjun.core.config as mem
|
import arjun.core.config as mem
|
||||||
|
|
||||||
|
from ratelimit import limits, sleep_and_retry
|
||||||
from arjun.core.utils import dict_to_xml
|
from arjun.core.utils import dict_to_xml
|
||||||
|
|
||||||
warnings.filterwarnings('ignore') # Disable SSL related warnings
|
warnings.filterwarnings('ignore') # Disable SSL related warnings
|
||||||
|
|
||||||
|
@sleep_and_retry
|
||||||
|
@limits(calls=mem.var['rate_limit'], period=1)
|
||||||
def requester(request, payload={}):
|
def requester(request, payload={}):
|
||||||
"""
|
"""
|
||||||
central function for making http requests
|
central function for making http requests
|
||||||
|
|||||||
3
setup.py
3
setup.py
@@ -24,7 +24,8 @@ setup(
|
|||||||
package_data={'arjun': ['db/*']},
|
package_data={'arjun': ['db/*']},
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'requests',
|
'requests',
|
||||||
'dicttoxml'
|
'dicttoxml',
|
||||||
|
'ratelimit'
|
||||||
],
|
],
|
||||||
classifiers=[
|
classifiers=[
|
||||||
'Development Status :: 5 - Production/Stable',
|
'Development Status :: 5 - Production/Stable',
|
||||||
|
|||||||
Reference in New Issue
Block a user