Skip to content

Commit 22433c6

Browse files
committed
feat(scanner): add timeout input for direct scanning methods
1 parent 7f543cb commit 22433c6

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

bugscanx/modules/scanners/host_scanner.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def get_input_direct(no302=False):
4040
return None, None, None
4141

4242
port_list = get_input("Enter port(s)", "number", default="80").split(',')
43+
timeout = get_input("Enter timeout (seconds)", "number", default="3")
4344
output, threads = get_common_inputs()
4445
method_list = get_input(
4546
"Select HTTP method(s)",
@@ -63,6 +64,7 @@ def get_input_direct(no302=False):
6364
cidr_ranges=cidr_ranges,
6465
port_list=port_list,
6566
no302=no302,
67+
timeout=int(timeout),
6668
output_file=output
6769
)
6870
else:
@@ -72,6 +74,7 @@ def get_input_direct(no302=False):
7274
input_file=filename,
7375
port_list=port_list,
7476
no302=no302,
77+
timeout=int(timeout),
7578
output_file=output
7679
)
7780

bugscanx/modules/scanners/scanners/direct.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,18 @@ def __init__(
1818
method_list=None,
1919
port_list=None,
2020
no302=False,
21+
timeout=None,
2122
**kwargs
2223
):
2324
super().__init__(**kwargs)
2425
self.method_list = method_list or []
2526
self.port_list = port_list or []
2627
self.no302 = no302
28+
self.timeout = timeout or self.DEFAULT_TIMEOUT
2729

2830
def request(self, method, url, **kwargs):
2931
method = method.upper()
30-
kwargs['timeout'] = self.DEFAULT_TIMEOUT
32+
kwargs['timeout'] = self.timeout
3133
max_attempts = self.DEFAULT_RETRY
3234

3335
for attempt in range(max_attempts):
@@ -98,6 +100,7 @@ def __init__(
98100
no302=False,
99101
threads=50,
100102
output_file=None,
103+
timeout=None,
101104
**kwargs
102105
):
103106
super().__init__(
@@ -107,6 +110,7 @@ def __init__(
107110
threads=threads,
108111
is_cidr_input=False,
109112
output_file=output_file,
113+
timeout=timeout,
110114
**kwargs
111115
)
112116
self.input_file = input_file
@@ -164,6 +168,7 @@ def __init__(
164168
no302=False,
165169
threads=50,
166170
output_file=None,
171+
timeout=None,
167172
**kwargs
168173
):
169174
super().__init__(
@@ -174,6 +179,7 @@ def __init__(
174179
is_cidr_input=True,
175180
cidr_ranges=cidr_ranges,
176181
output_file=output_file,
182+
timeout=timeout,
177183
**kwargs
178184
)
179185
self.cidr_ranges = cidr_ranges or []

0 commit comments

Comments
 (0)