Skip to content

Commit

Permalink
Revert "iterator locker refactored"
Browse files Browse the repository at this point in the history
  • Loading branch information
rivalsec committed Jun 3, 2024
1 parent 6832952 commit cc03eed
Showing 1 changed file with 25 additions and 15 deletions.
40 changes: 25 additions & 15 deletions pathbuster/pathbuster.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,19 @@


def work_prod(urls, paths, extensions = [''], update_stats=False):
with get_work_locker:
for path in paths:
for ext in extensions:
p = path.lstrip('/')
if ext:
p += f".{ext.lstrip('.')}"
for path in paths:
for ext in extensions:
p = path.lstrip('/')
if ext:
p += f".{ext.lstrip('.')}"
if update_stats:
stats['path'] = p
for url in urls:
if update_stats:
stats['path'] = p
for url in urls:
if update_stats:
stats['reqs_done'] += 1
if url in err_table and err_table[url] >= conf.max_errors:
continue
yield (url.rstrip('/') , p)
stats['reqs_done'] += 1
if url in err_table and err_table[url] >= conf.max_errors:
continue
yield (url.rstrip('/') , p)


def truncated_stream_res(s: requests.Response, max_size:int):
Expand Down Expand Up @@ -96,7 +95,13 @@ def save_res(s:Response):


def preflight_worker():
for url, path in preflight_iter:
while True:
with get_work_locker:
try:
url, path = next(preflight_iter)
except StopIteration:
return

try:
res = process_url(f'{url}/{path}', url)
except Exception as e:
Expand Down Expand Up @@ -174,7 +179,12 @@ def worker_process(url, parent, redirect_count = 0):


def worker():
for url, path in task_iter:
while True:
with get_work_locker:
try:
url, path = next(task_iter)
except StopIteration:
return
urlpath = f"{url}/{path}"
worker_process(urlpath, url)

Expand Down

0 comments on commit cc03eed

Please sign in to comment.