MCPcopy Index your code
hub / github.com/pex-tool/pex / reverse

Method reverse

testing/mitmproxy.py:106–137  ·  view source on GitHub ↗
(
        self,
        targets,  # type: Iterable[str]
        proxy_auth=None,  # type: Optional[str]
        dump_headers=False,  # type: bool
    )

Source from the content-addressed store, hash-verified

104
105 @contextmanager
106 def reverse(
107 self,
108 targets, # type: Iterable[str]
109 proxy_auth=None, # type: Optional[str]
110 dump_headers=False, # type: bool
111 ):
112 # type: (...) -> Iterator[Tuple[int, str]]
113 os.mkfifo(self.messages)
114 args = [
115 self.mitmdump_venv.interpreter.binary,
116 self.mitmdump_venv.bin_path("mitmdump"),
117 "--set",
118 "confdir={confdir}".format(confdir=self.confdir),
119 "--set",
120 "flow_detail={level}".format(level="2" if dump_headers else "1"),
121 "-p",
122 "0",
123 "-s",
124 self.addon,
125 ]
126 if proxy_auth:
127 args.extend(["--proxyauth", proxy_auth])
128 for target in targets:
129 args.extend(["--mode", "reverse:{target}".format(target=target)])
130 proxy_process = subprocess.Popen(args)
131 try:
132 with open(self.messages, "r") as fp:
133 data = json.load(fp)
134 yield data["port"], os.path.join(self.confdir, "mitmproxy-ca.pem")
135 finally:
136 proxy_process.kill()
137 os.unlink(self.messages)
138
139 @contextmanager
140 def run(

Callers 3

runMethod · 0.95
test_subprocess_providerFunction · 0.80
test_import_providerFunction · 0.80

Calls 4

extendMethod · 0.80
loadMethod · 0.45
joinMethod · 0.45
killMethod · 0.45

Tested by 2

test_subprocess_providerFunction · 0.64
test_import_providerFunction · 0.64