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

implement waittime between requests #71

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions snallygaster
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import socket
import urllib.parse
import warnings
import json
import time

import bs4
import dns.resolver
Expand Down Expand Up @@ -94,6 +95,8 @@ def fetcher(fullurl, binary=False, getredir=False, geterrpage=False):
data = ""
redir = ""
try:
if args.waittime:
time.sleep(args.waittime / 1000.0)
r = pool.request('GET', fullurl, retries=False, redirect=False)
if getredir:
headers = {k.lower(): v for k, v in r.headers.items()}
Expand All @@ -115,6 +118,8 @@ def fetcher(fullurl, binary=False, getredir=False, geterrpage=False):

def fetchpartial(fullurl, size, returnsize=False, binary=False):
try:
if args.waittime:
time.sleep(args.waittime / 1000.0)
r = pool.request('GET', fullurl, retries=False, redirect=False,
preload_content=False)
if r.status == 200:
Expand Down Expand Up @@ -959,6 +964,8 @@ parser.add_argument("-p", "--path", default='', action="store", type=str,
help="Base path on server (scans root dir by default)")
parser.add_argument("-j", "--json", action="store_true",
help="Produce JSON output")
parser.add_argument("-w", "--waittime", type=int,
help="Waittime between each request in milliseconds")
parser.add_argument("-d", "--debug", action="store_true",
help="Show detailed debugging info")
args = parser.parse_args()
Expand Down