question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inbuilt Map Remote Functionality

See original GitHub issue

Charles Proxy has a Map Remote feature which maps one URL to another.

This can be achieved in mitm by using a script similar to:

def request(flow):
    if "google.com" in flow.url:
        flow.request.url = flow.request.url.replace("google.com", "google.jp")

I think we should have this feature inbuilt (just like content replacements) rather than expecting users to write custom scripts.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:10
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
mhilscommented, Mar 20, 2017

@ujjwal96: I think there are still lots of improvements to be made regarding the UX. Consider the following user story:

I want to show the contents of ~/foo.css when I access example.com/style.css.

I think this is something that’s not viable with replacements right now. I think it would be very useful to have a dedicated “map remote” functionality that can be used to map URLs to other URLs or local files. It would be interesting to see how other tools are solving this (@dufferzafar mentions Charles Proxy), I haven’t looked into that yet. To make the distinction a bit more clear, we may want to have the replacements addon operate on the request path only, not the full URL, and handle the URL in the map remote editor.

1reaction
kajojifycommented, Jul 10, 2018

@eu81273 Hello! Yes, you are right, unfortunately, our documentation doesn’t describe some moments very clearly. I hope we will change it in the nearest future. But nevertheless there is something in the documentation you may be interested in: Filter expressions -> https://docs.mitmproxy.org/stable/concepts-filters/ Replacements -> https://docs.mitmproxy.org/stable/overview-features/#replacements

Shortly speaking, here @~u@http://target.com/js/aaa.js@http://localhost:3000/js/aaa.js, ~u - mitmproxy filter expression that defines which flows a replacement applies to; http://target.com/js/aaa.js - a valid Python regular expression that defines what gets replaced; http://localhost:3000/js/aaa.js - a string literal that is substituted in.

The thing is ~u isn’t correct. To get the flows you want relying on url, you need to use ~u regex or just regex (which is equivalent to ~u regex). For example, you can write: @"~u google\.com"@google@yahoo @google\.com@google@yahoo This replacement takes all flows, which have google.com into their urls and replace google with yahoo. You can also write @google@yahoo. It means, that the pattern set to the default .*.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remote Mapping - Humanitarian OpenStreetMap Team
Remote mapping is the process of modifying or adding in new data to areas from a distance. Usually it involves the use of...
Read more >
Mapping the buttons on the remote control - The NUC Blog
I've got an HP MCE-compatible remote controller and I'm using the inbuilt infrared receiver of my Haswell NUC. In order to make the...
Read more >
Built-in functions - Terragrunt - Gruntwork
Terragrunt allows you to use built-in functions anywhere in `terragrunt.hcl`, ... This is useful when you need to use relative paths with remote...
Read more >
Create map | Help - Zoho Deluge
Create map Table of Contents Overview Syntax Examples Overview The create map deluge task is used to declare a map variable.
Read more >
ArcGIS Pro Help
Imagery and remote sensing ... You can map your data in 2D and 3D with ArcGIS Pro. ... Move around the map quickly...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found