It's pretty obvious if you have a jail broken iPhone or rooted Android smartphone with SSHD (OpenSSH) running as a daemon, that SSH'ing into your phone is fairly trivial over a wireless network.
However, did you know that you can also SSH into your smart phone over mobile carrier networks as well (e.g. 3G, 4G, Edge, etc.)? How you ask? Reverse tunneling my friends...reverse tunneling - the cornerstone of anything conceivably cool. We truly heart OpenSSH here at the.hang4r.
It all starts at the smart phone by running the following command through a terminal application:
$ ssh -R 127.0.0.1:2222:127.0.0.1:22 <username@remote_ssh_host_on_the_net>
Now, it's simply a matter of SSH'ing into your "remote_ssh_host_on_the_net" and executing the following once you've authenticated:
$ ssh -p 2222 <smartphone_username>@127.0.0.1
It may be a bit slow, but you should see a shell prompt on your smartphone! Ha-ha-ha-ha-ha-ha!!! He-he-he, ahem <cough> Excuse me.
Here's a quick and dirty script to drop on your mobile device. Ensure you set the permissions by executing the following:
$ chmod 755 rev_ssh.sh
rev_ssh.sh:
#!/bin/bash
# Reverse SSH into a Smart Phone Over Mobile Carrier Networks ;)
if [[ $1 == "" ]]; then
echo "$0 user@host"
exit
fi
echo "Once connected to your host, reverse ssh into the Smart Phone with the following command:"
echo "ssh mobile@127.0.0.1 -p 2222"
ssh -R 127.0.0.1:2222:127.0.0.1:22 $1
# Reverse SSH into a Smart Phone Over Mobile Carrier Networks ;)
if [[ $1 == "" ]]; then
echo "$0 user@host"
exit
fi
echo "Once connected to your host, reverse ssh into the Smart Phone with the following command:"
echo "ssh mobile@127.0.0.1 -p 2222"
ssh -R 127.0.0.1:2222:127.0.0.1:22 $1
Enjoy!
If you enjoyed this post, send us = kudos =
(Bitcoin Addr: 19n6q3GZfoM64oqv5HsDnhzqvcEvJUvmdx)
No comments:
Post a Comment