Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cc7e561

Browse files
authored
Merge pull request #3036 from blacklanternsecurity/logging-cleanup
Reduce debug logging noise
2 parents 6f82e01 + c413772 commit cc7e561

5 files changed

Lines changed: 2 additions & 29 deletions

File tree

‎bbot/core/helpers/diff.py‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ async def _baseline(self):
100100
baseline_1_json = xmltodict.parse(baseline_1.text)
101101
baseline_2_json = xmltodict.parse(baseline_2.text)
102102
except ExpatError:
103-
log.debug(f"Can't HTML parse for {self.baseline_url}. Switching to text parsing as a backup")
104103
baseline_1_json = baseline_1.text.split("\n")
105104
baseline_2_json = baseline_2.text.split("\n")
106105

@@ -141,7 +140,6 @@ def compare_headers(self, headers_1, headers_2):
141140
for header, value in list(headers.items()):
142141
if header.lower() in self.baseline_ignore_headers:
143142
with suppress(KeyError):
144-
log.debug(f'found ignored header "{header}" in headers_{i + 1} and removed')
145143
del headers[header]
146144

147145
ddiff = DeepDiff(headers_1, headers_2, ignore_order=True, view="tree", threshold_to_diff_deeper=0)
@@ -251,24 +249,18 @@ def _compare_sync(self, subject_response, subject):
251249
try:
252250
subject_json = xmltodict.parse(subject_response.text)
253251
except ExpatError:
254-
log.debug(f"Can't HTML parse for {subject.split('?')[0]}. Switching to text parsing as a backup")
255252
subject_json = subject_response.text.split("\n")
256253

257254
diff_reasons = []
258255

259256
if self.baseline.status_code != subject_response.status_code:
260-
log.debug(
261-
f"status code was different [{str(self.baseline.status_code)}] -> [{str(subject_response.status_code)}], no match"
262-
)
263257
diff_reasons.append("code")
264258

265259
different_headers = self.compare_headers(self.baseline.headers, subject_response.headers)
266260
if different_headers:
267-
log.debug("headers were different, no match")
268261
diff_reasons.append("header")
269262

270263
if self.compare_body(self.baseline_json, subject_json) is False:
271-
log.debug("difference in HTML body, no match")
272264
diff_reasons.append("body")
273265

274266
return diff_reasons

‎bbot/modules/base.py‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,6 @@ async def _events_waiting(self, batch_size=None):
661661
break
662662
try:
663663
event = self.incoming_event_queue.get_nowait()
664-
self.debug(f"Got {event} from {getattr(event, 'module', 'unknown_module')}")
665664
async with self._task_counter.count(f"event_postcheck({event})"):
666665
acceptable, reason = await self._event_postcheck(event)
667666
if acceptable:
@@ -767,7 +766,6 @@ async def _worker(self):
767766
break
768767
except asyncio.queues.QueueEmpty:
769768
continue
770-
self.debug(f"Got {event} from {getattr(event, 'module', 'unknown_module')}")
771769
try:
772770
async with self._task_counter.count(f"event_postcheck({event})"):
773771
acceptable, reason = await self._event_postcheck(event)
@@ -782,7 +780,7 @@ async def _worker(self):
782780
else:
783781
context = f"{self.name}.handle_event({event})"
784782
self.scan.stats.event_consumed(event, self)
785-
self.debug(f"Handling {event}")
783+
self.debug(f"Handling {event} from {getattr(event, 'module', 'unknown_module')}")
786784
try:
787785
await self.run_task(self.handle_event(event), context)
788786
except asyncio.CancelledError:
@@ -939,7 +937,6 @@ async def _event_postcheck_inner(self, event):
939937
if not filter_result:
940938
return False, msg
941939

942-
self.debug(f"{event} passed post-check")
943940
return True, ""
944941

945942
def _scope_distance_check(self, event):
@@ -1026,8 +1023,6 @@ async def queue_event(self, event):
10261023
if reason and reason != "its type is not in watched_events":
10271024
self.debug(f"Not queueing {event} because {reason}")
10281025
return
1029-
else:
1030-
self.debug(f"Queueing {event} because {reason}")
10311026
try:
10321027
self.incoming_event_queue.put_nowait(event)
10331028
event._module_consumers += 1
@@ -1863,7 +1858,6 @@ async def _worker(self):
18631858
async with self._task_counter.count(f"event_precheck({event})"):
18641859
precheck_pass, reason = self._event_precheck(event)
18651860
if not precheck_pass:
1866-
self.debug(f"Not intercepting {event} because precheck failed ({reason})")
18671861
acceptable = False
18681862
else:
18691863
async with self._task_counter.count(f"event_postcheck({event})"):
@@ -1893,7 +1887,6 @@ async def _worker(self):
18931887
self.debug(f"Not forwarding {event} because {forward_event_reason}")
18941888
continue
18951889

1896-
self.debug(f"Forwarding {event}")
18971890
await self.forward_event(event, kwargs)
18981891

18991892
except asyncio.CancelledError:

‎bbot/modules/lightfuzz/submodules/serial.py‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,8 @@ async def fuzz(self):
142142
continue
143143

144144
if matches_baseline:
145-
self.debug(f"Payload {payload_type} matches baseline, skipping")
146145
continue
147146

148-
self.debug(f"Probe result for {payload_type}: {response}")
149-
150147
status_code = getattr(response, "status_code", 0)
151148
if status_code == 0:
152149
continue
@@ -159,8 +156,6 @@ async def fuzz(self):
159156
self.debug(f"Status code {status_code} not in (200, 500), skipping")
160157
continue
161158

162-
# if the status code changed to 200, and the response doesn't match our general error exclusions, we have a finding
163-
self.debug(f"Potential finding detected for {payload_type}, needs confirmation")
164159
if (
165160
status_code == 200
166161
and "code" in diff_reasons
@@ -199,7 +194,6 @@ def get_title(text):
199194
# if the first case doesn't match, we check for a telltale error string like "java.io.optionaldataexception" in the response.
200195
# but only if the response is a 500, or a 200 with a body diff
201196
elif status_code == 500 or (status_code == 200 and diff_reasons == ["body"]):
202-
self.debug(f"500 status code or body match for {payload_type}")
203197
for serialization_error in serialization_errors:
204198
# check for the error string, but also ensure the error string isn't just always present in the response
205199
if (

‎bbot/modules/paramminer_headers.py‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ async def handle_event(self, event):
227227
if self.global_blacklist_prefixes and lower_name.startswith(self.global_blacklist_prefixes):
228228
return
229229
if parameter_name not in self.wl: # Ensure it's not already in the wordlist
230-
self.debug(f"Adding {parameter_name} to wordlist")
231230
self.extracted_words_master.add(parameter_name)
232231

233232
elif event.type == "HTTP_RESPONSE":
@@ -290,7 +289,7 @@ def build_count_test_request(self, url, count):
290289
async def binary_search(self, compare_helper, url, group, reasons=None, reflection=False):
291290
if reasons is None:
292291
reasons = []
293-
self.debug(f"Entering recursive binary_search with {len(group):,} sized group")
292+
self.debug(f"Entering binary_search with {len(group):,} sized group for URL [{url}]")
294293
if len(group) == 1 and len(reasons) > 0:
295294
yield group[0], reasons, reflection
296295
elif len(group) > 1 or (len(group) == 1 and len(reasons) == 0):
@@ -299,10 +298,6 @@ async def binary_search(self, compare_helper, url, group, reasons=None, reflecti
299298
if match is False:
300299
async for r in self.binary_search(compare_helper, url, group_slice, reasons, reflection):
301300
yield r
302-
else:
303-
self.debug(
304-
f"binary_search() failed to start with group of size {str(len(group))} and {str(len(reasons))} length reasons"
305-
)
306301

307302
async def check_batch(self, compare_helper, url, header_list):
308303
rand = self.rand_string()

‎bbot/modules/telerik.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ async def handle_event(self, event):
258258
if base_url not in self.RAUConfirmed:
259259
self.RAUConfirmed.append(base_url)
260260
root_tool_path = self.scan.helpers.tools_dir / "telerik"
261-
self.debug(root_tool_path)
262261

263262
for version in self.telerikVersions:
264263
command = [

0 commit comments

Comments
 (0)