How to implement a ssh tunnel base vpn in flutter - android

this is my first question at this comunity, so please forgive me if I made a mistake in asking the question
I want to connect to my server through Flutter and the ssh command and pass all the traffic of my application through the tunnel like a VPN through port forwarding and a socks5 proxy.
Currently, there are some Github projects that do this for android and for now android is enough for me.
One example I found is ConnectBot, and it first connects to the server with the ssh command, then executes a portForwarding command on the server.
Then we can use a socks5 proxy and port in our apps by starting the service.
But I need a tunnel, not just a proxy
There are several Android applications in the Play Store, such as netmod, that do this
that's mean
1- Connecting to the server through ssh
2- Port forwarding
3- Running socks proxy
4- Tunneling the traffic of the entire device
Please help if you have any information about this
thank you

Related

gRPC Quick start for Android/Kotlin tutorial - UNAVAILABLE in Server response

Following gRPC Quick start for Android/Kotlin, I managed to build and run the server successfully on my PC and also to install the Android app (Connected with adb over TCP in local network, same subnet, PC firewall is off).
But when running the application, typing e.g. "Alice" and hitting SEND GRPC REQUEST, I'm getting UNAVAILABLE in Server response. The server is running, listening to port 50051.
I have a fully functional connection: when running e.g. python3 -m http.server on my PC, I can access it from my android device without a problem.
One thing I find strange is, that nowhere in that tutorial it's mentioned to specify the IP address of the server in the client code/application.
What am I missing?
In order to specify the IP address of the server, we need to add -PserverUrl=http://xxx.xxx.xxx.xxx:50051:
.\gradlew :android:installDebug -PserverUrl=http://xxx.xxx.xxx.xxx:50051

How can I connect an android client to my XMPP (ejabberd) server, hosted on my local machine (Windows based OS)?

I want to test my ejabberd (xmpp) server, which I've hosted on my laptop, which is working on windows 10 based OS. I want to connect my android client to this server. So I went on to the internet, and found some solutions. But they seem don't work for me. This is what I've tried:
1.) Create a hotspot on a phone. Don't use data/wifi connection, as server is already on the machine.
2.) Connect the laptop to the hotspot.
3.) On cmd (running as admin), type 'ipconfig', after starting xmpp server (Obviously).
4.) Copy IPv4 address (External IP), and access web panel on the mobile browser through it.
So, I hurried toward my phone, and typed
http://[IPv4 Address]:[port open on the server for incoming connection/5280]/admin
But it(browser) throws 'Can't reach the webpage' error.
When I run
http://localhost:5280/admin
on my laptop, I could easily access my web portal, but It's unreachable on my android phone. What can I do now?
Well I solved this problem by accessing IPv4 of my laptop through my wifi router, and connecting to the port of my server through it. Initially, my browser (both of my laptop and my phone) weren't able to reach the server's port. But I later figured out it was problem in my .yml configuration file. Server wasn't set to listen all the IPv4 calls, instead it was listening to all IPv6. So I changed this, and it then become accessible to all devices on the same wifi. So it was my bad idea to connect it through the hotspot :P

How can i access my localhost XAMP server from my Android mobile?

When i run my project on Emulator than localhost servery is working but when run on real Android phone than localhost server not found. So how can i access my localhost server from my real Android Device. I use XAMP server.
You cannot access localhost from your mobile device because the server is limited to your system only. In order to test the application you have to run the application on emulator so that it could find the server. Although there is a way...if you are creating a whole server that is backend and you have a network to which your mobile and system is connected then you can set your server to listen to a port on that network. I used NodeJs to accomplish that. You can search some tutorials for using NodeJs through which you can access you xampp server. You can also try AdonisJs which is a framework for NodeJs for a better approach. But keep in mind that you need a common network through which your system and your mobile device is connected. It is a bit complicated method but yes that can work. Accessing localhost directly from system to your mobile device is not possible..if you want to avoid learning NodeJs then you'll have to keep using emulator for the testing but learning something new is always amazing. So i would suggest you to learn NodeJs . Anyways you can avoid all the trouble and keep testing your application using your emulator. I hope this answer will help you :)
You should have told which ip you used running on emulator.
Your client on the android device should use the ip of the computer where your server is running on.
Android device and server computer in same WLAN.
If your computer and mobile are connected through same internet line then you can use ip of your computer instead of localhost can do the work.
You cannot access the local host server from a different node eventhough both nodes are connected to same network only way is that change the ip configuration of server to 0.0.0.0: so that you can access the server from any node just by typing the ip of the server followed by port no...

How to tunnel to Charles? To debug android against dev hidden behind vpn

for network issue reasons I need to tunnel to Charles.
More specifically,
Windows laptop:
- Connected to VPN to test environments
- Can connect to public Web
- Can not connect to office wifi
- Can run Charles or such (can install SW, have admin but can't control network layer)
Linux computer:
- Can connect to public Web
- Can install anything
Idea: Setup Proxy on Android phone to go to Linux. Tunnel Linux to Charles Proxy on Windows. Windows session can then connect to corporate network which is behind VPN.
Issue: Charles listens for incoming proxy connections. I cannot connect phone directly to it. Can I setup SSH on the Linux to link the two? How?
Very late answer but I managed to achieve this. I had a server that is publicly available and a laptop with Charles installed. I used SSH tunneling to forward the port on the server to my mac. Therefor I could use my Android phone to connect to this proxy using the public ip of my server. If this is what you wanted to accomplish it can be done using the following command:
ssh -R 9000:localhost:3000 user#example.com
In this case port 9000 is the server port that forwards to the localhost on the laptop on port 3000.
However there are a few things you might run into. the following setting should be in your sshd config file on your server.
GatewayPorts yes
And make sure your firewall or anything alike does not block the connection.
Hope this helps someone.
source: http://blog.trackets.com/2014/05/17/ssh-tunnel-local-and-remote-port-forwarding-explained-with-examples.html

Cannot access localhost from Android device

Emulator can access web service fromlocal host but my real device cannot although I use LAN ip address (192.168.xx.yyy) instead of 10.0.2.2. Of course, my android mobile was recognized by adb and it connected my laptop via usb port.
I already read some similar questions at stackoverflow but still didn't know how to access webservice from a real android mobile. The answer of this question How can I access my localhost from my Android device? my be useful but i don't really understand that answer.
Anyone helps me? Thanks you!
Possibly the web server is listening on the loopback interface but not on the network interface. This means that hits on 127.0.0.1 and localhost will work, but 192.168.xxx.xxx will not (whether from localhost, LAN, or WAN).
To determine which interface the server is listening on, look here for a command to tell you about the listening ports (I used lsof -Pan -i tcp -i udp). Then look for your server process in the list. For the lsof command, if for port 8888 you see something like TCP *:8888 (LISTEN) then your server is listening on all interfaces. But if you instead see something like TCP [::127.0.0.1]:8888 (LISTEN) then you have identified your problem!
The next step to solve your problem is to set up your server's run configuration to listen on all interfaces. I don't know what server you are using, but if you can specify an IP address, then you may want to try 0.0.0.0. Usually you can do this near where it lets you specify the listening port. Thus, if you have a configuration like:
--port 8888
Then you can try:
--port 8888 --address 0.0.0.0
In my opinion, the below point is more important for developer community
I am not a network expert; like me many developers may be there.
change to 0.0.0.0:80 in httpd.conf is very important.
In normal(default) settings, port 8888 throws error in WAMPSERVER (even in Windows Browser). That is why I explained the exact environment where port 8888 throws error.
Specific information about what configuration throws error and what configuration works successfully is more important.
Have you tried using a wifi router which is connected to your LAN? Then you just need to connect to the wifi using your mobile and you should be able to access (192.168.xx.yyy)

Categories

Resources