omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    proxy or sshtunnel (Dynamic Port Forwarding)

    Pythonista
    7
    18
    4032
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • tomomo
      tomomo @mikael last edited by

      @mikael
      Yes, I would like to access the sshtunnel or proxy on the jump server to connect to the intranet.

      1 Reply Last reply Reply Quote 0
      • tomomo
        tomomo last edited by

        I also want to access the web site via the jump server in addition to the intranet access.

        mikael 1 Reply Last reply Reply Quote 0
        • mikael
          mikael @tomomo last edited by

          @tomomo, check out this convenient-looking sshtunnel module.

          It is Python-only, installed cleanly and did not throw any errors before not connecting because I do not have a convenient SSH endpoint around.

          tomomo 1 Reply Last reply Reply Quote 0
          • tomomo
            tomomo @mikael last edited by

            @mikael
            Tried sshtunnel.
            I was connected to the jump server, but I could not access the site via the jump server.

            1 Reply Last reply Reply Quote 0
            • tomomo
              tomomo last edited by

              from sshtunnel import SSHTunnelForwarder
              import ui
              
              server = SSHTunnelForwarder(
              	'123.123.123.123',
              	ssh_username='user',
              	ssh_password='pass',
              	remote_bind_address=('127.0.0.1',3128)
              )
              server.start()
              
              main = ui.ScrollView(frame=(0, 0, 375, 812))
              main.content_size = (375, 812)
              wv = ui.WebView(frame=(0, 0, *main.content_size))
              wv.load_url('http://10.10.10.254')
              main.add_subview(wv)
              main.present('panel')
              
              mikael 1 Reply Last reply Reply Quote 0
              • mikael
                mikael @tomomo last edited by

                @tomomo, I suggest you check your understanding of which sshtunnel address is which. Is your jump server address really 123.123.123.123? load_url should use 127.0.0.1, i.e. the local endpoint of the tunnel - you can use the local_bind_address to specify the port.

                Also, would recommend the with ... as tunnel: format to manage the opening and closing of the tunnel.

                (ScrollView is not needed, WebView can scroll on its own.)

                1 Reply Last reply Reply Quote 0
                • tomomo
                  tomomo last edited by

                  @mikael
                  123.123.123.123 is dummy ip address.
                  ssh username and password is dummy.

                  from sshtunnel import SSHTunnelForwarder
                  import ui
                  
                  with SSHTunnelForwarder(
                  	'serveripaddress',
                  	ssh_username='user',
                  	ssh_password='pass',
                  	remote_bind_address=('127.0.0.1',80),
                  	local_bind_address=('127.0.0.1',80)
                  ) as server:
                  	wv = ui.WebView()
                  	wv.load_url('http://127.0.0.1')
                  	#wv.load_url('https://www.google.co.jp')
                  	wv.present('panel')
                  

                  I also put apache in the jump server for testing.

                  I tried to change the source code, but I was logged in with ssh.However, the ssh session seems to be closed immediately and the process will not continue.

                  mikael 1 Reply Last reply Reply Quote 0
                  • mikael
                    mikael @tomomo last edited by

                    @tomomo, present is not modal, so the context closes immediately after, closing the tunnel.

                    Adding wv.wait_modal() after it should wait until you close the view.

                    1 Reply Last reply Reply Quote 0
                    • Gawellent
                      Gawellent last edited by

                      You need to set up the proxy configuration in the NSURLSessionConfiguration object before creating the NSURLSession object.

                      1 Reply Last reply Reply Quote 0
                      • harrietzaspel
                        harrietzaspel last edited by

                        This post is deleted!
                        1 Reply Last reply Reply Quote 0
                        • harrietzaspel
                          harrietzaspel last edited by

                          Yes, it is possible to use proxy or sshtunnel (Dynamic Port Forwarding) in UIWebView. However, you will need to set up your own proxy server to do so. It is important to note that UIWebView does not support SOCKS proxies, so you will need to use an HTTP proxy instead. You can get it from https://soax.com/online-facebook-messenger-proxy. To set up a proxy in UIWebView, you will need to create a configuration object to set the proxy settings. This object will contain the proxy's host, port, username, and password (if applicable) and any other required configuration settings. You can then pass this configuration object to the UIWebView instance's session configuration. This will make the proxy settings active for the UIWebView instance.

                          1 Reply Last reply Reply Quote 0
                          • PiersButler
                            PiersButler last edited by

                            This post is deleted!
                            1 Reply Last reply Reply Quote 1
                            • JacobChapman
                              JacobChapman last edited by

                              This post is deleted!
                              1 Reply Last reply Reply Quote 0
                              • PiersButler
                                PiersButler last edited by

                                Did you manage to solve the problem?

                                1 Reply Last reply Reply Quote 0
                                • JacobChapman
                                  JacobChapman last edited by

                                  Additionally, you are leaking DNS requests everywhere. Otherwise, your local computer will use your shift proxy io connection to seek DNS names, thus you must use an HTTP proxy on the SSH box. But if you're worried about being recognized, your VPS is just another IP address associated with your name. You should only use your approach if you don't trust your local connection but don't care about privacy.

                                  JacobChapman 1 Reply Last reply Reply Quote 0
                                  • JacobChapman
                                    JacobChapman @JacobChapman last edited by

                                    @JacobChapman Additionally, you are leaking DNS requests everywhere. Otherwise, your local computer will use your shiftproxy.io connection to seek DNS names, thus you must use an HTTP proxy on the SSH box. But if you're worried about being recognized, your VPS is just another IP address associated with your name. You should only use your approach if you don't trust your local connection but don't care about privacy. Consider the scenario where you are using unencrypted wifi at a coffee shop. You can use your solution to visit non-SSL websites without worrying about other customers in the coffee shop spying on you.

                                    For some reason, not all the text was posted

                                    1 Reply Last reply Reply Quote 0
                                    • First post
                                      Last post
                                    Powered by NodeBB Forums | Contributors