MCPcopy Create free account
hub / github.com/blacklanternsecurity/bbot / handle_batch

Method handle_batch

bbot/modules/httpx.py:105–224  ·  view source on GitHub ↗
(self, *events)

Source from the content-addressed store, hash-verified

103 return url_hash
104
105 async def handle_batch(self, *events):
106 stdin = {}
107
108 for event in events:
109 url, url_hash = self.make_url_metadata(event)
110 stdin[url] = event
111
112 if not stdin:
113 return
114
115 command = [
116 "httpx",
117 "-silent",
118 "-json",
119 "-include-response",
120 "-threads",
121 self.threads,
122 "-timeout",
123 self.scan.httpx_timeout,
124 "-retries",
125 self.scan.httpx_retries,
126 "-header",
127 f"User-Agent: {self.scan.useragent}",
128 "-response-size-to-read",
129 f"{self.max_response_size}",
130 ]
131
132 if self.store_responses:
133 response_dir = self.scan.home / "httpx"
134 self.helpers.mkdir(response_dir)
135 command += ["-srd", str(response_dir)]
136
137 dns_resolvers = ",".join(self.helpers.system_resolvers)
138 if dns_resolvers:
139 command += ["-r", dns_resolvers]
140
141 if self.probe_all_ips:
142 command += ["-probe-all-ips"]
143
144 # Add custom HTTP headers
145 for hk, hv in self.scan.custom_http_headers.items():
146 command += ["-header", f"{hk}: {hv}"]
147
148 # Add custom HTTP cookies as a single header
149 if self.scan.custom_http_cookies:
150 cookie = SimpleCookie()
151 for ck, cv in self.scan.custom_http_cookies.items():
152 cookie[ck] = cv
153
154 # Build the cookie header
155 cookie_header = f"Cookie: {cookie.output(header='', sep='; ').strip()}"
156 command += ["-header", cookie_header]
157
158 proxy = self.scan.http_proxy
159 if proxy:
160 command += ["-http-proxy", proxy]
161 async for line in self.run_process_live(command, text=False, input=list(stdin), stderr=subprocess.DEVNULL):
162 try:

Callers

nothing calls this directly

Calls 9

make_url_metadataMethod · 0.95
run_process_liveMethod · 0.80
run_in_executorMethod · 0.80
emit_eventMethod · 0.80
warningMethod · 0.45
getMethod · 0.45
debugMethod · 0.45
make_eventMethod · 0.45
matchMethod · 0.45

Tested by

no test coverage detected