Adapt contrib/mitmproxywrapper.py to Python 3 strings (#5866)

* Adapt mitmproxywrapper.py to Python 3 strings

This fixes errors like this one: 

`TypeError: memoryview: a bytes-like object is required, not 'str'`

* [autofix.ci] apply automated fixes

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Sean Flanigan 2023-01-13 19:04:13 +10:00 committed by GitHub
parent d06afcc1f9
commit 2bf96678ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,7 +20,9 @@ class Wrapper:
self.extra_arguments = extra_arguments
def run_networksetup_command(self, *arguments):
return subprocess.check_output(["sudo", "networksetup"] + list(arguments))
return subprocess.check_output(
["sudo", "networksetup"] + list(arguments)
).decode()
def proxy_state_for_service(self, service):
state = self.run_networksetup_command("-getwebproxy", service).splitlines()
@ -47,8 +49,8 @@ class Wrapper:
def run_command_with_input(self, command, input):
popen = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
(stdout, stderr) = popen.communicate(input)
return stdout
(stdout, stderr) = popen.communicate(input.encode())
return stdout.decode()
def primary_interace_name(self):
scutil_script = "get State:/Network/Global/IPv4\nd.show\n"