MCPcopy
hub / github.com/USArmyResearchLab/Dshell / premodule

Method premodule

dshell/plugins/http/riphttp.py:44–62  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

42 )
43
44 def premodule(self):
45 if self.direction not in ('cs', 'sc', None):
46 self.logger.warning("Invalid value for direction: {!r}. Argument must be either 'sc' for server-to-client or 'cs' for client-to-server.".format(self.direction))
47 sys.exit(1)
48
49 if self.content_filter:
50 self.content_filter = re.compile(self.content_filter)
51 if self.name_filter:
52 self.name_filter = re.compile(self.name_filter)
53
54 self.openfiles = {}
55
56 if not os.path.exists(self.outdir):
57 try:
58 os.makedirs(self.outdir)
59 except (IOError, OSError) as e:
60 self.error("Could not create output directory: {!r}: {!s}"
61 .format(self.outdir, e))
62 sys.exit(1)
63
64 def http_handler(self, conn, request, response):
65 if (not self.direction or self.direction == 'cs') and request and request.method == "POST" and request.body:

Callers

nothing calls this directly

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected