Skip to content

Commit

Permalink
fix #1.
Browse files Browse the repository at this point in the history
  • Loading branch information
noptrix committed Dec 23, 2024
1 parent bab3be6 commit d0b4362
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions httpgrep.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@


__author__ = 'noptrix'
__version__ = '2.4'
__version__ = '2.5'
__copyright__ = 'santa clause'
__license__ = 'MIT'

Expand Down Expand Up @@ -181,15 +181,15 @@ def http_req(url):
return r


def scan(url):
def scan(url, string):
if opts['verbose']:
log(f'scanning {url}' + ' ' * 20, 'verbose', esc='\r')
sys.stdout.flush()

r = http_req(url)

if 'body' in opts['where']:
idx = re.search(opts['searchstr'], r.text, opts['case_in']).regs[0][0]
idx = re.search(string, r.text, opts['case_in']).regs[0][0]
if idx:
res = repr(r.text[idx:idx+opts['bytes']])
log(f'{url} | body | {res}', 'good')
Expand All @@ -198,8 +198,8 @@ def scan(url):

if 'headers' in opts['where']:
for k, v in r.headers.items():
if re.search(opts['searchstr'], k, opts['case_in']) or \
re.search(opts['searchstr'], v, opts['case_in']):
if re.search(string, k, opts['case_in']) or \
re.search(string, v, opts['case_in']):
log(f"{url} | header | {k}: {v}", 'good')
if opts['logfile']:
log(f"{url} | header | {k}: {v}", 'file')
Expand Down Expand Up @@ -363,7 +363,7 @@ def main(cmdline):
if 'http' not in host:
url = build_url(host)
for string in get_strings(opts['searchstr']):
exe.submit(scan, url)
exe.submit(scan, url, string)

if opts['verbose']:
log('\n\n')
Expand Down

0 comments on commit d0b4362

Please sign in to comment.