Determine the destination type and path, initialize the output transformation rules.
(self, _)
| 213 | ) |
| 214 | |
| 215 | def configure(self, _): |
| 216 | """ |
| 217 | Determine the destination type and path, initialize the output |
| 218 | transformation rules. |
| 219 | """ |
| 220 | self.encode = ctx.options.dump_encodecontent |
| 221 | |
| 222 | if ctx.options.dump_destination.startswith("http"): |
| 223 | self.outfile = None |
| 224 | self.url = ctx.options.dump_destination |
| 225 | logging.info("Sending all data frames to %s" % self.url) |
| 226 | if ctx.options.dump_username and ctx.options.dump_password: |
| 227 | self.auth = (ctx.options.dump_username, ctx.options.dump_password) |
| 228 | logging.info("HTTP Basic auth enabled.") |
| 229 | else: |
| 230 | self.outfile = open(ctx.options.dump_destination, "a") |
| 231 | self.url = None |
| 232 | self.lock = Lock() |
| 233 | logging.info("Writing all data frames to %s" % ctx.options.dump_destination) |
| 234 | |
| 235 | self._init_transformations() |
| 236 | |
| 237 | for i in range(FILE_WORKERS if self.outfile else HTTP_WORKERS): |
| 238 | t = Thread(target=self.worker) |
| 239 | t.daemon = True |
| 240 | t.start() |
| 241 | |
| 242 | def response(self, flow): |
| 243 | """ |
nothing calls this directly
no test coverage detected