How can I redirect locally generated traffic through iptables to a transparent mitmproxy service?IPTables and...

If the UK Gov. has authority to cancel article 50 notification, why do they have to agree an extension with the EU

Why doesn't Starship have four landing legs?

What to do about my 1-month-old boy peeing through diapers?

web scraping images

Variables in Interface in Salesforce

Is there a better way to use C# dictionaries than TryGetValue?

Are spot colors limited and why CMYK mix is not treated same as spot color mix?

Should I ask for a raise one month before the end of an internship?

How do Barton (Hawkeye/Ronin) and Romanov (Black Widow) end up on the Benatar on Morag in 2014?

Journal published a paper, ignoring my objections as a referee

What does GDPR mean to myself regarding my own data?

Is there an in-universe explanation given to the senior Imperial Navy Officers as to why Darth Vader serves Emperor Palpatine?

Coupling two 15 Amp circuit breaker for 20 Amp

STM32 cannot reach individual registers and pins as PIC

Can I lend a small amount of my own money to a bank at the federal funds rate?

RAID0 instead of RAID1 or 5, is this crazy?

Can I get a PhD for developing educational software?

Shall I fix cracks on bathtub and how to fix them?

Are sweatpants frowned upon on flights?

Why did Starhopper's exhaust plume become brighter just before landing?

Get contents before a colon

Are there any to-scale diagrams of the TRAPPIST-1 system?

How does attacking during a conversation affect initiative?

How did medieval manors handle population growth? Were there room for more fields to be ploughed?



How can I redirect locally generated traffic through iptables to a transparent mitmproxy service?


IPTables and transparent proxiesiptables redirect traffic from VPN interface to next interfaceiptables - Redirect web traffic to LAN ServerRedirect https request on local networkiptables - 2 Internetprovider - routingHow to forward traffic for specific IP over an tun0 interfaceLocal port forwarding using iptables is not workingPort forwarding over OpenVpn






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I am attempting to redirect traffic from an emulator (Android SDK) running in a Xubuntu environment that uses the host machine's network interface for output. Tcpdump shows traffic originating from the emulator going out a bonded network interface on the host.



As a result, the traffic does not pass through iptables PREROUTING NAT table. I do, however, see the traffic passing through the iptables OUTPUT NAT table. If I specify a rule for that traffic, say:



iptables -t nat -I OUTPUT -i lo -p tcp --dport -j REDIRECT --to-port 8080


I see the traffic on tcpdump generate a bunch of GET requests and eventually crash the mitmproxy application the traffic should be getting redirected to on the local box. It almost looks like an endless loop of GET requests for whatever site I am requesting (Google, yahoo, etc.) for the simple purpose of generating 80/443 traffic.



I am looking for assistance in the proper use of iptables to redirect locally generated HTTP/HTTPS traffic via emulator browser
(sharing the host IP) to be redirected to a local host proxy application (mitmproxy (mitmproxy.org)) running on the same host. The traffic would then need to be sent out an Internet-facing interface (eth0) and replies would eventually returned to the requesting broswer.










share|improve this question









New contributor



2and2IS5 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




























    0















    I am attempting to redirect traffic from an emulator (Android SDK) running in a Xubuntu environment that uses the host machine's network interface for output. Tcpdump shows traffic originating from the emulator going out a bonded network interface on the host.



    As a result, the traffic does not pass through iptables PREROUTING NAT table. I do, however, see the traffic passing through the iptables OUTPUT NAT table. If I specify a rule for that traffic, say:



    iptables -t nat -I OUTPUT -i lo -p tcp --dport -j REDIRECT --to-port 8080


    I see the traffic on tcpdump generate a bunch of GET requests and eventually crash the mitmproxy application the traffic should be getting redirected to on the local box. It almost looks like an endless loop of GET requests for whatever site I am requesting (Google, yahoo, etc.) for the simple purpose of generating 80/443 traffic.



    I am looking for assistance in the proper use of iptables to redirect locally generated HTTP/HTTPS traffic via emulator browser
    (sharing the host IP) to be redirected to a local host proxy application (mitmproxy (mitmproxy.org)) running on the same host. The traffic would then need to be sent out an Internet-facing interface (eth0) and replies would eventually returned to the requesting broswer.










    share|improve this question









    New contributor



    2and2IS5 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.
























      0












      0








      0








      I am attempting to redirect traffic from an emulator (Android SDK) running in a Xubuntu environment that uses the host machine's network interface for output. Tcpdump shows traffic originating from the emulator going out a bonded network interface on the host.



      As a result, the traffic does not pass through iptables PREROUTING NAT table. I do, however, see the traffic passing through the iptables OUTPUT NAT table. If I specify a rule for that traffic, say:



      iptables -t nat -I OUTPUT -i lo -p tcp --dport -j REDIRECT --to-port 8080


      I see the traffic on tcpdump generate a bunch of GET requests and eventually crash the mitmproxy application the traffic should be getting redirected to on the local box. It almost looks like an endless loop of GET requests for whatever site I am requesting (Google, yahoo, etc.) for the simple purpose of generating 80/443 traffic.



      I am looking for assistance in the proper use of iptables to redirect locally generated HTTP/HTTPS traffic via emulator browser
      (sharing the host IP) to be redirected to a local host proxy application (mitmproxy (mitmproxy.org)) running on the same host. The traffic would then need to be sent out an Internet-facing interface (eth0) and replies would eventually returned to the requesting broswer.










      share|improve this question









      New contributor



      2and2IS5 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I am attempting to redirect traffic from an emulator (Android SDK) running in a Xubuntu environment that uses the host machine's network interface for output. Tcpdump shows traffic originating from the emulator going out a bonded network interface on the host.



      As a result, the traffic does not pass through iptables PREROUTING NAT table. I do, however, see the traffic passing through the iptables OUTPUT NAT table. If I specify a rule for that traffic, say:



      iptables -t nat -I OUTPUT -i lo -p tcp --dport -j REDIRECT --to-port 8080


      I see the traffic on tcpdump generate a bunch of GET requests and eventually crash the mitmproxy application the traffic should be getting redirected to on the local box. It almost looks like an endless loop of GET requests for whatever site I am requesting (Google, yahoo, etc.) for the simple purpose of generating 80/443 traffic.



      I am looking for assistance in the proper use of iptables to redirect locally generated HTTP/HTTPS traffic via emulator browser
      (sharing the host IP) to be redirected to a local host proxy application (mitmproxy (mitmproxy.org)) running on the same host. The traffic would then need to be sent out an Internet-facing interface (eth0) and replies would eventually returned to the requesting broswer.







      iptables proxy xubuntu






      share|improve this question









      New contributor



      2and2IS5 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share|improve this question









      New contributor



      2and2IS5 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share|improve this question




      share|improve this question








      edited 24 mins ago









      muru

      44.3k5 gold badges111 silver badges182 bronze badges




      44.3k5 gold badges111 silver badges182 bronze badges






      New contributor



      2and2IS5 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      asked 45 mins ago









      2and2IS52and2IS5

      11 bronze badge




      11 bronze badge




      New contributor



      2and2IS5 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




      New contributor




      2and2IS5 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.



























          0






          active

          oldest

          votes














          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          2and2IS5 is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f537986%2fhow-can-i-redirect-locally-generated-traffic-through-iptables-to-a-transparent-m%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          2and2IS5 is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          2and2IS5 is a new contributor. Be nice, and check out our Code of Conduct.













          2and2IS5 is a new contributor. Be nice, and check out our Code of Conduct.












          2and2IS5 is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f537986%2fhow-can-i-redirect-locally-generated-traffic-through-iptables-to-a-transparent-m%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

          Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

          Ciclooctatetraenă Vezi și | Bibliografie | Meniu de navigare637866text4148569-500570979m