So there are many topics covering both SSH tethering and SSH reverse tethering, but they were not helpful for me. Below, I'll quickly explain what I want. Hope you can help me. Thanks.
It's easy to SSH from Windows/Linux/OSX to Android through USB but I want the reverse. My raspberrypi's IP for USBnet is 192.168.2.2, so when I am in Windows, I can easily install RNDIS driver, set IP for Windows to 192.168.2.1 and gateway 192.168.2.2 and SSH from Windows to Android. The reverse in also possible by following this guide for example. BUT, what I want is SSH from my Android to my raspberrypi through USB OTG with:
Raspberry Pi : 192.168.2.2
Android: 192.168.2.1
Any help is appreciated.
Related
USB reverse tethering = Cellphone gets network connection from PC via USB.
I know how to do USB reverse tethering except for one problem: Many Android apps will check network connection using the code below before doing any useful work:
Code:
ConnectivityManager connectivityManager = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info = connectivityManager.getActiveNetworkInfo();
The problem is that, when using USB reverse tethering, the above code will report no network connection. However, there IS a network connection (which is the USB reverse tethering itself), and ping, wget and all programs not doing this stupid check work well.
So the question is: How can I hack the system to let this network connection check return success (so that I can fool these apps)?
BTW. I use Cyanogenmod 7. And any solution specific to this MOD is also welcome.
Hello,
Could you please tell me how did you do the USB reverse tethering? Since on USB connection there is no option to do that under CM 7.1?
...
Thank you. Unfortunately the binary /system/bin/netsharing is not part of CM7.1, apparently it exists with Sense ROM. How do you manage to run it under CM7.1?
Sense ROM has the reverse USB tether built-in ("Internet passthrough"), maybe if the 2 commands could be executed, thanks to existing HTC NDIS driver doing NAT inside the PC it will work?
I've tested in CM7 that netsharing is not needed. Just execute the rest of the commands will be OK. Of course you need to do NAT on the PC because what you've setup is just a small LAN with private IP addresses.
Thank you for your input.
What I understand:
1- connect the phone via USB cable, choose charge only
2- Assuming my router has IP 192.168.1.1:
So I have to type these commands, could you confirm?
Code:
echo 4 > /sys/devices/platform/msm_hsusb/usb_function_switch
route add default gw 192.168.1.1
ifconfig usb0 192.168.1.1 mtu 500 up
But then how to do the NAT thing is out of my knowledge!
In fact what I want is when there is no router (since mine is wireless) with available Internet connetion
(ADSL line down). So I have to use USB 56kbps modem with telephone line to access Internet from the PC (running XP).
And I would like to plug the Android phone with USB cable and allow the phone to access Internet (Internet sharing
with the PC). I am not sure of the operations to do then.
Sorry but I don't know how to set up NAT on Windows XP... I use Linux and a simple iptables command suffices:
Code:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
I have a Sensation 4g with CM9 ICS OpenSensation flashed.
In my computer i have installed Ubuntu 11.10
I want to connect my sensation to the internet using the Ubuntu's wired connection. How can i do this? I haven't find any program like connectify in the Windows.
Anyone can help?
Thanks in advance
If you can, put your wifi card ( pc side ) into AP mode.
Then connect your phone to your AP.
You can also use reverse usb tethering.
Here is a tool for windows : http://forum.xda-developers.com/showthread.php?t=1371345
For Linux try this http://blog.mycila.com/2010/06/reverse-usb-tethering-with-android-22.html
Good luck
dqb I assume that the AP mode means access point mode. I dont't think that i can do this. There is not a setting for this (or i haven't find it).
Ubuntu has a choice about making your wifi card a hotspot but it doesn't work properly. I have to look at Ubuntu forums about this problem.
I will take a look at the link you sent me. Thanks anyway.
If anyone has done what i am trying to do please post what you do.
Hi,
Yes, AP = Access Point.
If your wireless card is a pci card :
Code:
lspci | grep -i wireless
You get a result that looks like this :
Code:
06:00.0 Network controller: Broadcom Corporation BCM4313 802.11b/g/n Wireless LAN Controller (rev 01)
Take the 06:00.0 and in a console :
Code:
lspci -vv -s 06:00.0
Paste the result here please. We can see which wireless card you're using and the driver. We can tell you if your wifi card supports AP mode, and if possible how to do it properly.
Otherwise i've done the reverse tethering on linux and windows.. if you need help.
Ok dqb here are the result for what you told me to do.
command:
Code:
lspci | grep -i wireless
result:
Code:
09:00.0 Network controller: Intel Corporation Centrino Wireless-N 1030 (rev 34)
What exactly the "rev 34" means?
command:
Code:
lspci -vv -s 06:00.0
result:
Code:
09:00.0 Network controller: Intel Corporation Centrino Wireless-N 1030 (rev 34)
Subsystem: Intel Corporation Centrino Wireless-N 1030 BGN
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 57
Region 0: Memory at f7a00000 (64-bit, non-prefetchable) [size=8K]
Capabilities: <access denied>
Kernel driver in use: iwlwifi
Kernel modules: iwlwifi
Thanks
Ok i found an alternative solution to my problem.
I have an HTC Sensation 4g and this worked for me. I think it will work to other devices too.
If you want to give internet to your android phone device from the wired connection of your Ubuntu here is a potential solution.
Follow this two steps
Step 1:
First you have to create a proper ad-hoc network in you Ubuntu in order to share you internet. Here is the tutorial on how to do this http://tumutanzi.com/archives/8195
Step 2:
In this step now you need to detect this ad-hoc network with you android phone and connect to it. Here is the second tutorial on how to do this http://www.ce4arab.com/vb7/showthread.php?t=420240
This tutorial is a little bit tricky so if you have question just ask.
Hope this is helpful
Thanks
hello guys,
i'm developing an automatic vulnerability scanner/exploiter for android.
i'm adding the cool feature of using the metasploit framework from our android phones, but i'm having a big issue.
i can start the MsfRpcd ( the metasploit daemon ) from a su shell an make it bind to the 127.0.0.1 address.
i can connect to the server using busybox netcat ( no Java though here ).
i can't connect to 127.0.0.1 from the android app! i got ECONNREFUSED.
uff!
after a bit of google i understood that JavaVM have a separate network and it filter out my connection to localhost/127.0.0.1.
how can i connect to a service bind to 127.0.0.1 on my phone from an android app?
this is a jail!
NOTES:
i gave a quick look at iptables -L output, maybe i can make some hack there, but probably i will break the JavaVM network.
thanks in advance!
-- tux_mind
PS:
binding on wifi ip is not an answer.
WORKAROUND:
do not use socket library, use URLConnection:
Code:
u = new URL("http", InetAddress.getLocalHost().getHostAddress(), mPort, "/api/");
huc = u.openConnection();
huc.setDoOutput(true);
huc.setDoInput(true);
huc.setUseCaches(false);
huc.setRequestProperty("Content-Type", "binary/message-pack");
huc.setReadTimeout(0);
huc.getOutputStream().close();
-1 for google
I'm interested in setting up a reverse SSH tunnel with netcat and some shell. Basically I want to be able to
Code:
ssh -p 10022 localhost
on my server, which will give me a shell on my Nexus 6 (or any Android device). This will allow me ssh access without having to run an ssh server.
Now, to my surprise, I cannot find a precompiled netcat binary for Android ARM devices. Googling around and searching these forums have not turned up any obvious / easy guides to get netcat on my phone.
I was wondering if anyone could point me towards a guide / binary / anything. I'm ok with cross compiling, if that would work.
quickdry21 said:
I'm interested in setting up a reverse SSH tunnel with netcat and some shell. Basically I want to be able to
Code:
ssh -p 10022 localhost
on my server, which will give me a shell on my Nexus 6 (or any Android device). This will allow me ssh access without having to run an ssh server.
Now, to my surprise, I cannot find a precompiled netcat binary for Android ARM devices. Googling around and searching these forums have not turned up any obvious / easy guides to get netcat on my phone.
I was wondering if anyone could point me towards a guide / binary / anything. I'm ok with cross compiling, if that would work.
Click to expand...
Click to collapse
Busybox has a basic netcat as one of its applets. Apart from that, try looking into ncat (part of the nmap project) which is supposedly an advanced and improved version of netcat. See here for more info: https://nmap.org/ncat/. There are precompiled ARM binaries floating around.
I want to use the network ip of local host in emulator and how to configure it. please explain with steps in details