Netcat for Android? - Android Q&A, Help & Troubleshooting

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.

Related

Optware for Android released by Novaports

Optware was originally developed as a distribution mechanism for software for the Open Source Linux project for the Linksys NSLU2 (a small low cost network storage device). That consumer storage device ran on Linux, and the community opened it up, but they needed a lightweight distribution mechanism for their lightweight devices.
Since 2004 Optware has been adopted by a variety of Linux communities and device developers including the webOS community working on the Palm Pre and Pixi, and developers for devices as diverse as Asus WL-500g,WL-HDD, WL-500gx, WL-500gP routers, the Synology DS-101 and DS-101g+ NAS devices.
At its core, Optware is a package manager to allow you to easly install and uninstall cross-compiled linux applications on your device over the internet. At this time, optware supports the automatic download and installation of over 1500 programs. (See the list at the end of the wiki article.)
Why should I use Optware?
Like the original slug, android devices lack a distribution mechanism to install Linux/command line tools programs and utilities. Many in the Android community who want or need to do command line processing on their device use a chroot of some sort (Debian seems popular) to get their distribution and package management tools. With Optware, it becomes possible to simply run whatever utility or program you want on the native underlying Linux.
Additionally, Optware For Android installs openSSH making it possible to access your Nook from any PC with SSH capability, and sets up an unprivileged username/password login system for the device at the command line. All in all then, since it can be installed with a single script, since it's lightweight, and since it's designed for small and embedded devices, Optware is a perfect fit for the Android community.
Optware for Nook is the first Optware for Android release by the Novaports team and is their gift to the Android community members who have helped them so much with information on Android devices.
What does it do?
The Optware bootstrap installed the IPKG package manager. It installs the optware Busybox. It installs openSSH and makes the ssh demon persistent. It creates an unprivileged user with a username and password you choose.
See Installation instructions and details at the Optware for Android page at Nookdevs.com
For completeness of licensing compliance, the source code for all optware package can be found at the following locations:
1) build scripts at svn.nslu2-linux.org in the /svnroot/optware/ area
2) tarballs at sources.nslu2-linux.org in the /sources area (this is a *large* directory)
To contribute code to Optware, see www . nslu2-linux . org in the /wiki/Optware/AddAPackageToOptware area
-- Rod Whitby
-- Original NSLU2-Linux Project Lead and Optware Architect
This works beautifully! Thank you!
Gonna try this and see if i can get samba to work.. a SMB mount over wifi would be awsome...
Many thanks!
I don't suppose there's a quick and easy way to completely remove optware?... not looking forward to culling through scripts and manually un-doing it all.....
adduser: not found
When it gets to the part in the install script to add the username of the unprivileged user, I enter a name, then it says: adduser: not found.
If it helps, I am using Rooted Stock 1.1.
Anyone get Optware to install on CM7 (newer nightly)
I am running CM7 #103 and would love to have optware installed.
But I get Fail if I try to use the method from Nookdevs
Tonight when I have more time I will look at the errors and see if I can tell what is up.
It looked like partially due to missing dir's for one (/tmp)
madrascafe said:
Gonna try this and see if i can get samba to work.. a SMB mount over wifi would be awsome...
Click to expand...
Click to collapse
The market has your answer and it's free:
https://market.android.com/details?id=com.funkyfresh.samba&feature=search_result
Am I the only one that wants Optware on CM7?
It goes fine on a manualnootered 1.2.0 NC But I prefer CM7 (And use the nightlies)
I would love to get this going on my NC as well. Running CM7 N121 w/ 6/30/2011 OC kernel. Was able to manually work past the tmp directory problem you mentioned, but I can't seem to execute the ipkg binary or installed. I've verified it indeed exists in the path I'm trying to execute it from, it has +x perms for user/ group/ other, but it always gives the error below:
/data/opt/bin/ipkg: not found
I've tried messing with bin directory and ipkg binary ownership, but no dice. If anything it should at least find it even if permissions aren't correct.
Looks like the contents of the binary reference ELF libraries which sounds like an issue attempting to execute in an Android environment. Going to see if I can chroot an environment that will work for it.
Sent from my NookColor using Tapatalk
This is happening because it's looking for /lib/ld-linux.so.3, and not finding it. I worked around by
ln -s /data/opt/lib/ld-linux.so.3 /lib/ld-linux.so.3
I also had to make these links:
ln -s /data/opt /opt
ln -s /data/tmp /tmp
And then set this:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/lib
export PATH=$PATH:/opt/bin/:/opt/sbin
in my bash profile to get things to start working.
One problem is my symlinks seem to get erased every reboot. I worked around by re-creating them in my bash profile, but I wish I knew how to make them permanent. This may be a ROM specific thing - this was written for a rooted stock nook, and I'm on an Epic running SFR.
I do not have a ld-linux.so.3 file on my NC w/ CM7 125
I have many other errors that show up:
Downloading the latest ipkg-opt package from the Optware package feed:
Connecting to ipkg.nslu2-linux.org (140.211.169.161:80)
wget: can't open 'ipkg-opt_0.99.163-10_arm.ipk': File exists
(NOTE the above file 'ipkg-opt_0.99.163-10_arm.ipk' does not exist
(on my NC - from a find / -name ipkg-opt_0.99.163-10_arm.ipk)
Updating the Optware package database:
ERROR: Failed to update the local Optware package database
Updating the Optware package database:
/data/optware-bootstrap-0.0.1.shar: ipkg-opt: not found
ERROR: Failed to update the local Optware package database
Any ideas?
The actual file it needs is /data/opt/lib/ld-linux.so.3 - you need to create a symlink in /lib in order to see it. But I think that file comes from the optware installer - if the installer is failing, you won't have it there either. It sounds like you may have bits of a previous install that failed, and it's preventing the install from running properly. Try looking at the log in /data/tmp for more info. After that, try rm -rf /data/tmp/* to clean up the old install and trying again.
Thank You for any pointers.
I deleted everything in /data/tmp first last attempt - like you suggested.
Same result
I have it down to only this error now when I run it (optware-bootstrap-0.0.1.shar):
Updating the Optware package database:
optware-bootstrap-0.0.1.shar: ipkg-opt: not found
ERROR: Failed to update the local Optware package database
ipkg-opt should be in /data/opt/bin. Check to see if it's there... if not, something went wrong in one of the previous steps - probably somewhere around "Downloading the latest ipkg-opt package from the Optware package feed". See if wget is actually downloading anything, where it's putting it, and what it's doing with it afterwards.
If it is there, try running it manually. If you see /data/opt/bin/ipkg or /data/opt/bin/ipkg-opt but it claims it's not there when you run it, it may be a library linking error. Mine was looking for /lib/ld-linux.so.3 but it was actually installed at /data/opt/lib/ld-linux.so.3. mount -o remount,rw followed by ln -s /data/opt/lib/ld-linux.so.3 /lib/ld-linux.so.3 fixed that. I also had to run
ln -s /data/opt /opt
ln -s /data/tmp /tmp
before things started working.
By the way:
ntfsprogs - NTFS filesystem libraries and utilities
Could that be of any use? At the moment, it's not possible to mount NTFS storage on the NC
i would love to know how you guys get to this point even. When i try to install the very fist line of the script is an error and then nothing at all happens .... something about not finding busybox or something of that nature.
So you guys are getting WAY farther than I've been able to.
Tkx Tonygoes.
It is there in /data/opt/bin but it reports /data/opt/bin/ipkg: not found
I cannot find a ld-linux.so.3 on my NC at all.
I did the other links et al fro your comments also
obsid:
Try post 12 above:
and I had some other suggestions from someone:
might try thses FIRST the script seems to do it but may not actually get it done.
mount -o remount,rw / /
mount -o remount,rw /dev/block/mmcblk0p5 /system
you should also if tried before do this: rm -rf /data/tmp/
then do the items in post #12 above
NOTE for me the ln -s to ld-linux.so.3 does not work as I do not have that file on my system

[Q] VPN Connections - anybody running on Archos 70 IT ?

Hello,
I'm trying to connect to a Cisco VPN client by using VPN Connections on an Archos 70 IT 250 GB, that is rooted.
I always get a "Connection failed" message, after which the app crashes.
Did anyone succeed in getting VPN Connections working on Archos 70 IT ?
Regards,
Tonny
TonnyVanmunster said:
Hello,
I'm trying to connect to a Cisco VPN client by using VPN Connections on an Archos 70 IT 250 GB, that is rooted.
I always get a "Connection failed" message, after which the app crashes.
Did anyone succeed in getting VPN Connections working on Archos 70 IT ?
Regards,
Tonny
Click to expand...
Click to collapse
Hi,
I used to have the same error on my Galaxy S, when trying to create a VPN tunnel to my companies CISCO gateway.
The problem seems to relate to the missing tun.ko library.
I'm not sure if the Samsung Galaxy files will work for Archos, but you might want to adapt and try the following how-to: http://forum.xda-developers.com/showthread.php?t=793712&highlight=tun.ko
Regards,
Patrick
TonnyVanmunster said:
Did anyone succeed in getting VPN Connections working on Archos 70 IT ?
Click to expand...
Click to collapse
I found a possible clue. After trying several free pptp vpn services and noticing that it seemed to resolve a url one time then just hang, I set up a vpn on my lan and tried the local coffee shop connection to access it. I found that if encryption was completely disabled on the lan vpn and unchecked on the 70 IT, it would connect and I could browse, check email, etc. As soon as I set the policy on the vpn server to enable any level of encryption it was back to the resolve 1 url and hang behavior. Of course an unencrypted vpn is about as worthless as t*ts on a bull but it's the only clue I've found. As a control, I tried an ip*d touch w/encryption on against the same vpn with all levels enabled and that worked.
If anybody else who's running a local vpn can duplicate and confirm this, it's a step in the right direction!
VPN Connections 0.99 (aka get-a-robot-vpnc) working on A101IT with urukdriod-0.6
I've managed to make get-a-robot-vpnc (aka VPN Connections 0.99) work on urukdroid0.6 on Archos 101 IT.
There are two issues with default vpnc.script, and one issue with output of 'ps' command needed by VPN Connections 0.99 GUI, to check is there a connected vpnc process.
Resolving vpnc.script issues:
1. Symbolic link is missing that links /bin/busybox (or /usr/local/bin/busysbox on urukdroid) to 'which' command (cd /usr/local/bin; ln -s busybox which)
2. Symbolic link is missing that links /bin/busybox (or /usr/local/bin/busysbox on urukdroid) to 'ip' command (cd /usr/local/bin; ln -s busybox ip)
$aur0n told me that this two commands/links will be included in urukdroid-0.7.
Resolving GUI 'ps' issue (a bit harder ):
VPN COnnections GUI do 'ps | grep 'vpnc$' to see is there active vpnc process (established connection), but output of 'ps' command(s) found on urukdroid is not what GUI expects, so it cannot find vpnc proccess even if it is running and VPN is established.
On urukdroid there is 2 versions of 'ps' command:
1st is /bin/ps which is symbolic link to /bin/busybox (very old version of busybox (1.7.2, I believe) and output of ps this command is not suitable for VPN Connections (GUI)
2nd is /usr/local/bin/ps which is native ps command, but its output is also not suitable for VPN Connections (GUI)
There is a (hidden ) 3rd 'ps' command in /usr/local/bin/busybox (that version of busybox is 1.17.2) - but also not suitable output for VPN Connections (GUI).
Experimenting a bit I've found that '/usr/local/bin/ps -A' gives an suitable output, so I:
1. renamed /usr/local/bin/ps to /usr/local/bin/ps.new
2. made a script /usr/local/bin/ps with:
Code:
#!/bin/sh
ps.new -A
exit $?
3. chown root:root /usr/local/bin/ps; chmod 755 /usr/local/bin/ps
After that, everything worked.
Hope this solves issues for some of you
P.S. Forgot to mention - urukdroid 0.7 will have its own vpnc service built-in.
Works in UD 1.5
nenadr said:
I've managed to make get-a-robot-vpnc (aka VPN Connections 0.99) work on urukdroid0.6 on Archos 101 IT.
There are two issues with default vpnc.script, and one issue with output of 'ps' command needed by VPN Connections 0.99 GUI, to check is there a connected vpnc process.
Resolving vpnc.script issues:
1. Symbolic link is missing that links /bin/busybox (or /usr/local/bin/busysbox on urukdroid) to 'which' command (cd /usr/local/bin; ln -s busybox which)
2. Symbolic link is missing that links /bin/busybox (or /usr/local/bin/busysbox on urukdroid) to 'ip' command (cd /usr/local/bin; ln -s busybox ip)
$aur0n told me that this two commands/links will be included in urukdroid-0.7.
Resolving GUI 'ps' issue (a bit harder ):
VPN COnnections GUI do 'ps | grep 'vpnc$' to see is there active vpnc process (established connection), but output of 'ps' command(s) found on urukdroid is not what GUI expects, so it cannot find vpnc proccess even if it is running and VPN is established.
On urukdroid there is 2 versions of 'ps' command:
1st is /bin/ps which is symbolic link to /bin/busybox (very old version of busybox (1.7.2, I believe) and output of ps this command is not suitable for VPN Connections (GUI)
2nd is /usr/local/bin/ps which is native ps command, but its output is also not suitable for VPN Connections (GUI)
There is a (hidden ) 3rd 'ps' command in /usr/local/bin/busybox (that version of busybox is 1.17.2) - but also not suitable output for VPN Connections (GUI).
Experimenting a bit I've found that '/usr/local/bin/ps -A' gives an suitable output, so I:
1. renamed /usr/local/bin/ps to /usr/local/bin/ps.new
2. made a script /usr/local/bin/ps with:
Code:
#!/bin/sh
ps.new -A
exit $?
3. chown root:root /usr/local/bin/ps; chmod 755 /usr/local/bin/ps
After that, everything worked.
Hope this solves issues for some of you
P.S. Forgot to mention - urukdroid 0.7 will have its own vpnc service built-in.
Click to expand...
Click to collapse
Just wanted to say thanks! I'm using Urukdroid 1.5 and had the same issue. Used your trick and now VPNC connects to my companies VPN ^_^

[Q] Apple Mac OSX & Support for MTP

I have spent many hours traulling the net, scanning through forums across multiple websites and found no information on how to make my device which in its current software incarnation currently seems to only allow MTP as the option for transferring data via the USB cable to and from my Mac running OSX 1.7.3.
Please note, that that google app for file transfers DOES NOT WORK (for me). I cannot get it to work no matter which god I've prayed to or what kinda dance I did. So I looked for alternatives.
ADB worked, but I got tired of ADB to push files across (which is effective, but not what I would call fun). I came across MacPort, giving us ports of Linux/Unix stuff in the world of OSX. YAY!
Found that the various libraries for MTP and MTP-FS was ported! YAY!
After installing the hell out of macport (found: www macports org) and runing the updates.
Drop to the command line and then run these commands once:
Code:
sudo port install libmtp
sudo port install mtpfs
Every time you load your device:
Code:
sudo mtpfs
Awesome! Progress, plug in the device and run mtpfs. But then I get this:
Code:
bergenmacbook:Applications bergenlarsen$ sudo mtpfs
Listing raw device(s)
Device 0 (VID=04e8 and PID=6860) is a Samsung GT-P7510/Galaxy Tab 10.1/S2/GT-N7000/Galaxy Nexus.
Found 1 device(s):
Samsung: GT-P7510/Galaxy Tab 10.1/S2/GT-N7000/Galaxy Nexus (04e8:6860) @ bus 250, dev 6
Attempting to connect device
PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
LIBMTP libusb: Attempt to reset device
inep: usb_get_endpoint_status(): Operation timed out
outep: usb_get_endpoint_status(): Operation timed out
LIBMTP PANIC: failed to open session on second attempt
Unable to open raw device -208647360
I'm running MIUI v4 (2.4.13) with Siyah Kernel (currently 3.1RC5).
Help?
BergenLarsen said:
I have spent many hours traulling the net, scanning through forums across multiple websites and found no information on how to make my device which in its current software incarnation currently seems to only allow MTP as the option for transferring data via the USB cable to and from my Mac running OSX 1.7.3.
Please note, that that google app for file transfers DOES NOT WORK (for me). I cannot get it to work no matter which god I've prayed to or what kinda dance I did. So I looked for alternatives.
ADB worked, but I got tired of ADB to push files across (which is effective, but not what I would call fun). I came across MacPort, giving us ports of Linux/Unix stuff in the world of OSX. YAY!
Found that the various libraries for MTP and MTP-FS was ported! YAY!
After installing the hell out of macport (found: www macports org) and runing the updates.
Drop to the command line and then run these commands once:
Code:
sudo port install libmtp
sudo port install mtpfs
Every time you load your device:
Code:
sudo mtpfs
Awesome! Progress, plug in the device and run mtpfs. But then I get this:
Code:
bergenmacbook:Applications bergenlarsen$ sudo mtpfs
Listing raw device(s)
Device 0 (VID=04e8 and PID=6860) is a Samsung GT-P7510/Galaxy Tab 10.1/S2/GT-N7000/Galaxy Nexus.
Found 1 device(s):
Samsung: GT-P7510/Galaxy Tab 10.1/S2/GT-N7000/Galaxy Nexus (04e8:6860) @ bus 250, dev 6
Attempting to connect device
PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
LIBMTP libusb: Attempt to reset device
inep: usb_get_endpoint_status(): Operation timed out
outep: usb_get_endpoint_status(): Operation timed out
LIBMTP PANIC: failed to open session on second attempt
Unable to open raw device -208647360
I'm running MIUI v4 (2.4.13) with Siyah Kernel (currently 3.1RC5).
Help?
Click to expand...
Click to collapse
Tried installing gvfs-gphoto2 and nautilus?
Read more here:
How To: Fix Samsung Galaxy Nexus MTP File Transfer for Ubuntu GNU/Linux 11.10

[Q] there is no place like 127.0.0.1 [WORKAROUND FOUND]

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

SSH over USB from Android to RaspberryPi

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.

Categories

Resources