Skip to content

Mitmproxy script to map requests to files on the local file system

Notifications You must be signed in to change notification settings

boschni/mitmproxy-map-local-directory-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Mitmproxy map local directory script

This mitmproxy 2.0.2+ script will map requests to files on the local file system.

Example

When running mitmproxy with the following arguments:

mitmproxy -s "/path/to/map_local_directory.py --map http://site1.com/url/to/statics /projects/site1/statics http://site2.com/public/js /projects/site2/js"

Requests like http://site1.com/url/to/statics/js/somefile.js will be mapped to /projects/site1/statics/js/somefile.js and requests like http://site2.com/public/js/main.js will be mapped to /projects/site2/js/main.js. Any request that does not match the url or with a file on the local file system will pass through unchanged.

Only process requests to site1.com

mitmproxy --ignore '^(?!site1\.com)' -s "/path/to/map_local_directory.py --map http://site1.com/url/to/statics /projects/site1/statics"

Enabling/disabling the OS-X proxy from the terminal

Command to enable the OS-X proxy on the Wi-Fi interface and set it to localhost:8080:

sudo networksetup -setwebproxy Wi-Fi localhost 8080 off

Command to disable the OS-X proxy on the Wi-Fi interface:

sudo networksetup -setwebproxystate Wi-Fi off

About

Mitmproxy script to map requests to files on the local file system

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages