From fe513a27eb0a2813eddf4d9844b60b141a5ecb6c Mon Sep 17 00:00:00 2001 From: Olivier Cervello Date: Sun, 29 Sep 2024 10:06:23 -0400 Subject: [PATCH 1/2] add proxy --- secator/tasks/bup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/secator/tasks/bup.py b/secator/tasks/bup.py index 427b5e09..07d391e7 100644 --- a/secator/tasks/bup.py +++ b/secator/tasks/bup.py @@ -42,7 +42,7 @@ class bup(Http): FILTER_WORDS: OPT_NOT_SUPPORTED, FOLLOW_REDIRECT: OPT_NOT_SUPPORTED, MATCH_CODES: OPT_NOT_SUPPORTED, - PROXY: OPT_NOT_SUPPORTED, + PROXY: 'proxy', } output_types = [Url] output_map = { From b906c49ab1bbdcbe42e9319a9350e36d9c059eec Mon Sep 17 00:00:00 2001 From: Olivier Cervello Date: Sun, 29 Sep 2024 10:32:35 -0400 Subject: [PATCH 2/2] feat(`bup`): add proxy option --- secator/tasks/bup.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/secator/tasks/bup.py b/secator/tasks/bup.py index 07d391e7..73bace7c 100644 --- a/secator/tasks/bup.py +++ b/secator/tasks/bup.py @@ -1,7 +1,8 @@ +import json import re from secator.decorators import task -from secator.output_types import Url +from secator.output_types import Url, Progress from secator.tasks._categories import Http from secator.definitions import ( HEADER, DELAY, FOLLOW_REDIRECT, METHOD, PROXY, RATE_LIMIT, RETRIES, THREADS, TIMEOUT, USER_AGENT, @@ -44,7 +45,7 @@ class bup(Http): MATCH_CODES: OPT_NOT_SUPPORTED, PROXY: 'proxy', } - output_types = [Url] + output_types = [Url, Progress] output_map = { Url: { 'url': 'request_url', @@ -66,6 +67,14 @@ class bup(Http): def on_init(self): self.cmd += f' -o {self.reports_folder}/.outputs/response' + @staticmethod + def on_line(self, line): + if 'Doing' in line: + progress_indicator = line.split(':')[-1] + current, total = tuple([int(c.strip()) for c in progress_indicator.split('/')]) + return json.dumps({"duration": "unknown", "percent": int((current / total) * 100)}) + return line + @staticmethod def method_extractor(item): payload = item['request_curl_payload']