diff options
author | sethp-jive <seth.pellegrino@jivesoftware.com> | 2015-09-30 15:55:43 -0700 |
---|---|---|
committer | sethp-jive <seth.pellegrino@jivesoftware.com> | 2015-09-30 15:55:43 -0700 |
commit | fd8c921a2f04fa4dc8d4fdb123de4204f802f637 (patch) | |
tree | 9636232e7b9271eea9acf11a14510d9b031a93a3 /libmproxy/script.py | |
parent | c6811bd0e854a91bc0c3f9cda676818bd5c76a5c (diff) | |
download | mitmproxy-fd8c921a2f04fa4dc8d4fdb123de4204f802f637.tar.gz mitmproxy-fd8c921a2f04fa4dc8d4fdb123de4204f802f637.tar.bz2 mitmproxy-fd8c921a2f04fa4dc8d4fdb123de4204f802f637.zip |
Allow reading scripts from an anonymous pipe
Bash (and many other shells) provide a nifty feature in "anonymous pipe" or "anonymous fifo" whereby the output of a subshell may be treated as a simple file by the parent shell: http://unix.stackexchange.com/a/156088
Unfortunately, libmproxy complains because that "file" is not a regular file, as os.path.isfile checks, e.g. giving the error "Not a file: /dev/fd/11". This patch is intended to provide for the following use-case:
```
mitmdump -s <(echo "def response(context, flow):\n flow.response.headers['newheader'] = [`hostname`]")
```
where `hostname` may be replaced with a more complicated lookup.
Diffstat (limited to 'libmproxy/script.py')
-rw-r--r-- | libmproxy/script.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libmproxy/script.py b/libmproxy/script.py index 6dd79199..8bfacb38 100644 --- a/libmproxy/script.py +++ b/libmproxy/script.py @@ -83,7 +83,7 @@ class Script: "If your script path contains spaces, " "make sure to wrap it in additional quotes, e.g. -s \"'./foo bar/baz.py' --args\".") % args[0]) - elif not os.path.isfile(args[0]): + elif os.path.isdir(args[0]): raise ScriptError("Not a file: %s" % args[0]) return args |