Related
i have an idea for an application to remotely control a daemon on my desktop through a telnet connection. i can connect to the daemon through normal telnet methods (locally and connectbot), but can't operate the daemon through koushik's raw telnet client or the java code from inside eclipse.
the code that i have written so far can establish a connection, but pauses/freezes/stops after the socket is opened. no input or output is transferred. examining the tcp packets in wireshark, i've come to the conclusion that the connect method i'm using (org.apache.commons.net.telnet.TelnetClient) doesn't send WILL_ECHO to the host, and that keeps the daemon from finishing the connection -- at least, the failing connection methods stop (read: it's not there) at this packet while the working connection methods have this packet and everything after. it exhibits the same behavior using both my java code and koushik's telnet client, so i don't think it's anything i've written, rather, i think it's something i haven't written.
what i'm looking for is a bit of help in getting java connected to the daemon. if i can get the code to connect from eclipse, the rest should be a snap. if anyone has been able to get a telnet connection established using java, the android sdk, or just plain-old knows more about TCP than i do, i would appreciate some pointers - actual code examples, ideas, nudges, or where to go for deeper information.
attached are plaintext packet captures of what i have. the first is from the java code (inside eclipse) to the localhost daemon showing the fail, the second is from connectbot on the phone to the same daemon showing a working connection.
- tasker.
Try using just a raw socket. Telnet daemons don't care what connects to them typically and you can send commands and such with a socket without issue. I've done it in regular Java before, unfortunately it was for work so I can't share code. The basic examples in the javadocs should work though.
Figured out what my problem was.
after it connected my code was waiting for a character that never came, thus leaving the InputStream open and not doing anything else. Adjusted the string that it was waiting for and BAM! -- it worked.
been searching all over the internet and have tried a few methods but nothing seems to stick on the tab. im doing this because my mac address is something funky, 12:34:56... and i cant connect to my schools wifi. my IT department doesnt service "gadgets" so im on my own. ive tried the instructions here:
http://blog.thecodecracker.com/hacks/spoof-mac-address-in-android/
but they dont seem to stick. when i connect back to my wifi network (at home) it just goes back to the corrupt one. anyone have any experience with this?
i havent been able to connect in about 3 months so as you might imagine, im really getting frustrated with it. any help would be great.
Ayman
been searching all over the internet and have tried a few methods but nothing seems to stick on the tab. im doing this because my mac address is something funky, 12:34:56... and i cant connect to my schools wifi. my IT department doesnt service "gadgets" so im on my own. ive tried the instructions here:
http://blog.thecodecracker.com/hacks/spoof-mac-address-in-android/
but they dont seem to stick. when i connect back to my wifi network (at home) it just goes back to the corrupt one. anyone have any experience with this?
i havent been able to connect in about 3 months so as you might imagine, im really getting frustrated with it. any help would be great.
Ayman
Edit*
Temporary Fix:
1) Go to wireless & network settings
2) Disconnect and forget ALL previous SSID's that you connected to before
3) download a terminal emulator from the market
4) type the following, make sure you hit enter after every line
Code:
su
busybox ip link set eth0 address XX:XX:XX:XX:XX
Where XX:XX:XX:XX:XX is, make you have to put the MAC address you want there.
to confirm if it worked type:
Code:
busybox ip link show
it should show the new MAC address. Go connect to your network as normal.
NOTE:
If you go to the status option in the settings, you will see that the MAC Address DID NOT CHANGE. This is normal. It wont show the new MAC Address; at least it didnt for me.
One thing to keep in mind, sometimes you cant just put in an hexadecimal combination and expect it to work. It didnt work for me. So what I did is I connected to the school's network from my vibrant making sure I could surf the internet. then i disconnected and copied its MAC address to my tab. when i tried putting in my own custom MAC address, it didnt work. I could connect but packets wouldnt be sent.
Unfortunately when I reboot, my settings are not saved and I have to repeat the procedure. Simplest fix is to just download gscript lite from the market and put in the command I wrote above and whenever i restart my tab run the script quickly. If someone knows of a permanent fix, please let me know so I can update this.
feels good to finally be able to connect after 3 months.
I wrote a quick app that will do this - but i hardcoded the script for something else. I will modify it tomorrow so you can customize the script it runs and put it up here tomorrow or sunday if i get the time.
I would sincerely appreciate that!
Sent from my GT-P1000 using Tapatalk
ayman07 said:
One thing to keep in mind, sometimes you cant just put in an alphanumeric combination and expect it to work.
Click to expand...
Click to collapse
"alphanumeric"?
More like "hexadecimal"
Valid charachters are 0123456789abcdef and nothing more, if you used something else that would explain why it didn't work.
Sent from my GT-P1000 using Tapatalk
AlexTheStampede said:
"alphanumeric"?
More like "hexadecimal"
Valid charachters are 0123456789abcdef and nothing more, if you used something else that would explain why it didn't work.
Sent from my GT-P1000 using Tapatalk
Click to expand...
Click to collapse
Fixed
Sent from my GT-P1000 using Tapatalk
Ok here is the boot script loader.
I didn't spend any time on the interface or layout for you:
Obviously requires root to run
you don't need to start script with "su"-everything runs as su
enter the script in the edit box, click test to test it, click save to save it. It will run whatever has last been saved every boot.
Do NOT move to SD card or it will not pick up the BOOT_COMPLETED intent
i haven't tested if it runs before the SD card is fully mounted: so don't get carried away with your scripts. I suppose I could add options to run only after SD card is mounted but... i probably don't have time
Since this runs as root, do stupid things in your script things at your own risk. I'm not responsible in anyway.
the output from testing or from the boot log is:
stdOut
..some stdOut text
stdErr
..some stdErr text
where stdOut text is the results of your commands (you can see testing with a simple script containing just "ls" without the quotes)
and stdErr is any errors that occurred while running the script (you can see testing with a simple script containing "aasdf" without the quotes
click the "Thanks" button if you use this and it works
i really appreciate this. unfortunately i wont be able to try it out till monday when im at school. ill update it then.
thanks a lot of the script loader. it seems to do its job. but it seems my situation is a bit more complex than i thought. see i can only change the MAC address if i delete all the previously connected SSID. if i remove the dchp.list will that remove/forget all the previous SSIDs? i would have to run a cmd to forget all the SSIDs prior to running the MAC address change cmd.
I typed busybox ip link set eth0 address XX:XX:XX:XX:XX
i am receiving " bad address"
Pls help me
Anyone else getting routing issues with android and pptp? I connect and its stable, I get an IP, but it doesnt browse. Every once in about 20 attempts it works for a minute or 2, then stops.
Sent from my DROID3 using XDA App
ive been using ipsec and havent had any routing issues. I may not be fully understanding you, but you are connected to vzw, pptp to a ddwrt, and its not assigning you a local ip?
Maybe an MTU problem. What's the name of the pptp interface?
If you're browsing through a proxy it might not work. I ended up getting an un-NATed public IP address to avoid exactly what is happening to you, for some reason I couldn't connect to anything but my home network when I would connect to my VPN setup at home through my Cisco e4200 w/ dd-wrt firmware. Since I couldnt connect to the mobile browsing proxy when connected to my PPTP VPN, I just avoided it entirely by getting the public IP address... now it works great! (Not to mention I don't have to worry about any ports being blocked by my ISP).
Not sure what VZW's stance is on handing out Public IP addresses but it was pretty easy with Bell Mobility, costs me $5 a month but totally worth it IMO.
Sent from my XT860 using xda premium
disable the encryption. Android is known to have issues with mppe encryption.
Sorry I went MIA family issues. I tried without encryption, same thing. I get an ip. 1/10 time it will route some traffic. But when it does it dies in like 3 minutes MAX. I stay connected, just no data.
Sent from my DROID3 using XDA App
As I said, it sounds like it COULD be an MTU problem. I asked you about the name of your pptp interface before. Try this (as root on command line):
iptables -t mangle -A POSTROUTING -p tcp --tcp-flags SYN,RST SYN -o <YOUR_PPTP_DEVICE_NAME> -j TCPMSS --set-mss 1200
Unknown Arg
I tried what you said, I got unknown arg --set-mss
I have found that I can ping IPs, but not route data any other way.
What a pitty, either the stock iptables command doesn't support it or there is a module missing. That makes it much more difficult. I will try to check it out, but cannot promise you a timeline.
Thank you
Thank you for all you've done already
I fear this tcp-mss is a dead end. A module xt_TCPMSS.ko is needed. I compiled and loaded it, however still doesn't work. I think it it's related to the fact that all stock iptables options are built in the kernel, no modules.
However, I have another idea. Very simple, but could work -- tested it with my D3, looked good. On command line, as root, try this:
ifconfig <YOUR_PPTP_DEVICE_NAME> mtu 1200
That command works, but same problem. I used a different pptp server just in case, same issue, connect, get ip, no browse
Sent from my DROID3 using XDA App
OK, then it's most likely not an MTU problem.
If you want, we can do a little bit more troubleshooting. I love to track down that kind of problems.
Is your busybox installed in /system/xbin? Please type the following commands and provide me with the output:
/system/xbin/ifconfig
/system/xbin/netstat -rn
And we can go a bit farther. Please install the app "Shark for Root" from the market.
Then run your pptp, then open a terminal and type the following command:
/data/data/lv.n3o.shark/files/tcpdump -n -i <YOUR_PPTP_DEVICE_NAME> -w /sdcard/tcpdump.dmp
Try to browse until it fails. Then switch back to the terminal and stop the tcpdump with Ctrl-C.
I need the file /sdcard/tcpdump.dmp, please post it here (it's binary data) or provide it otherwise.
doesn't seem to install
I tried to get shark to install, but nothing seems to work. It appears to die when I try to browse. I can ping though. I've also tried without encryption. I can setup a vnc meeting and you can ADB and play with it if you are down.
4th Update 5/2/2013 - Found a bug... Nothing that would affect the overall functionality, but it could cause some users to think that their phone is successfully connected via USB debugging, when it really isn't.
Update: 5/2/2013 - Per user requests, adding link to VirtualBox download site on the original post.
3rd Update 5/1/2013 - I changed the code that 'finds' the exploit file to make sure it get executed successfully. It's now using the "PATH" environment to do this. This is more reliable than the actual Linux 'find' command I was using before. Also added some additional instructions to clarify some steps based on feedback from users. Finally, added code to detect if the network adapter is not configured correctly. It will alert the user to configure the network adapter properly in the VirtualBox application.
2nd Update 5/1/2013 - I added some lines to the script to stress the importance of pressing one of the three hardware buttons on the phone (Volume up, Volume Down, or Power) once the exploit has been executed. After discussing this with the author of the exploit, this is an important step to obtaining root.
UPDATE 5/1/2013 - New and improved .ova file. Contains improved logic in the exploit script to help with some of the problems that have been encountered by users.
If you've had trouble rooting, please download the new version and try again!
Hey folks, I'm a UNIX admin by profession, so I took the challenge over the weekend to come up with an easy root process for Bionic stock Jelly Bean, specifically for those who aren't familiar with Linux.
I decided to build a Linux VM under Oracle VirtualBox on my Windows PC. This seemed like the logical choice since VirtualBox is free, a relatively small download, is easy to install and it's easy to import VMs.
My first attempt was using CentOS Linux. It worked, but the file required for users to download was over 450MB... Back to the drawing board!
Started looking for very small Linux distros and found Tiny Core Linux. This worked well. The file required for download is 50 MB.
Everything you need to root the Bionic is here and it is automatic. The process will walk you through connecting to the Samba file share, connecting the phone in USB debugging mode, and OF COURSE, it will run the process to root the phone.
Here are the steps:
1) Install Sun VirtualBox on your Windows PC.
http://download.virtualbox.org/virtualbox/4.2.12/VirtualBox-4.2.12-84980-Win.exe
Note: We've had one report that this file also works with VMWare Workstation and VMWare Player. If you don't want to install VirtualBox feel free try the file with VMWare.
2) Download the VirtualBox .ova file containing the Linux VM from one of the following links:
http://www.knite.net/Bionic/Root_Bionic_JB_20130501-4.ova
http://www.mediafire.com/?a2i6forosp77xrd
https://dl.dropboxusercontent.com/s...fhiAIiSwc0jD1AdVFNY27QdoeKP9ot_7IdDetSvw&dl=1
3) Import the .ova file into VirtualBox. (Click "File" then "Import Appliance".)
4) Start the imported VM in VirtualBox (Click the big "Start" Button. It has a green arrow icon.)
5) Follow the instructions on the Linux console.
That should do it. If you need help I will be monitoring this thread.
Willing Tester
I am not familiar with Linux but I am familiar with root, supersuser, recovery, and fxz/rsd lite. I am up for a new phone next month so I am willing to try this on my Bionic. This doesn't sound too hard....(famous last words). Will try on my Windows 7 laptop.
Will report if this works. Won't be able to until later today.
Thank you OP!
Found a problem with the script. Should work now. Download and import again, if you've already downloaded. I also managed to get the download down to 46MB by defragging and compacting the .vmdk file.
dl.dropboxusercontent.com/s/bb53ayj5c3nd5ie/Root_Bionic_JB.ova?token_hash=AAGSOYfPuDXTur_e9qlYl2JRERovPyfMwe-2xNzHXg4Lxg&dl=1
Downloading new link now. Haven't tried to root yet. I'm at work right now.
Do you have any other suggestions before I start? I don't have to be completely stock do I...? (all stock apps, no superuser, etc.) I am on stock jelly bean 4.2.1, ver. 98.72.22.XT875.Verizon.en.US, stock recovery...but I did use OTA Rootkeeper so I have a (semi-functioning) superuser install. Do you suggest starting fresh with fxz?
I will be home in a couple hours to give it a try.
Well....my problem is that I can get my phone to connect to the share. My guess is that its due to a network thing on my laptop. Is the phone supposed to be connected via USB when I try that?
Awesome! I've got root again thanks to this. Was very easy to follow your instructions, great job!
Great, I just wanted to do something to make it easier for everyone, since so many seemed to be struggling with Linux.
lc75 said:
Awesome! I've got root again thanks to this. Was very easy to follow your instructions, great job!
Click to expand...
Click to collapse
So, in order for the phone to connect to the share, your phone needs to be connected by wi-fi to the same network as the computer that is running VirtualBox and the VM.
TechnoHippie said:
Well....my problem is that I can get my phone to connect to the share. My guess is that its due to a network thing on my laptop. Is the phone supposed to be connected via USB when I try that?
Click to expand...
Click to collapse
marty45714 said:
So, in order for the phone to connect to the share, your phone needs to be connected by wi-fi to the same network as the computer that is running VirtualBox and the VM.
Click to expand...
Click to collapse
Ok that's gonna be my problem then ...I'll give it a shot when I get home and I'm not connected to my office network.
USB 3.0?
My laptop only has USB 3.0 ports. Is that why I am having trouble connecting to the VMbox? SMB share connected over WIFI no problem. USB fails every time.
I am struggling with the directions and feeling dumb about it... Not sure what to put for the "Host IP Address"
EDIT: Restarted the virtual machine and it gave me the information I needed. The first time around the field was blank.
I appear to still lack root because the SU app wants to update the binary and fails to do so.
I'm not sure, but one thing you can check. When the Linux console is up in the VirtualBox window, there is a section in the lower, right hand corner of that window that shows a bunch of icons. Click the USB icon and very that you see your Bionic as an option for hardware that is connected to your laptop.
Also, I'm making an assumption that you have the Motorola UBS drivers already loaded on your Windows system before you even started this whole process. Maybe I shouldn't make that assumption???
cakessi said:
My laptop only has USB 3.0 ports. Is that why I am having trouble connecting to the VMbox? SMB share connected over WIFI no problem. USB fails every time.
Click to expand...
Click to collapse
First of all, thank you very much for creating a easy root tool for those of us who thought the previous methods were too daunting.
I've got a 32bit Windows PC and followed the instructions as you listed them. The problem I kept encountering was that my phone would not accept the IP address or group name suggested by the VirtualBox. When I looked up IP address of the VirtualBox my computer (cmd/ipconfig) I noticed it conflicted with the address that the box was telling me to enter into my Bionic. I wonder if this is the cause of the connectivity issue, and I have a hunch it's because my router is set to give dynamic IPs to the devices on my home network (which is larger with multiple routers and devices).
Any input would be greatly appreciated. Thanks.
You can test the connectivity to the SMB share from your Windows PC first. That's what I suggest.
In your Windows PC, go to My Computer and type in:
\\192.168.1.11\share
where 192.168.1.11 represents the IP address that the Linux server is telling you to use.
You can also go to the windows command line (cmd) and type:
telnet 192.168.1.11 445
which will show if your windows computer can connect to port 445 (SMB).
If these are successful, you probably have an issue that your phone and computer are not connected to the same network.
If you believe they are, you may want to see if your router is set up to not bridge the wireless and LAN traffic, which would mean that the computers on the LAN segment cannot communicate with the computers on the WI-FI segment.
Hopefully something here will help you out.
Please post your results.
Also, make sure when you are typing in names, passwords, groups and IP addresses, that you are not leaving trailing spaces on the ends of things.
MNEman13 said:
First of all, thank you very much for creating a easy root tool for those of us who thought the previous methods were too daunting.
I've got a 32bit Windows PC and followed the instructions as you listed them. The problem I kept encountering was that my phone would not accept the IP address or group name suggested by the VirtualBox. When I looked up IP address of the VirtualBox my computer (cmd/ipconfig) I noticed it conflicted with the address that the box was telling me to enter into my Bionic. I wonder if this is the cause of the connectivity issue, and I have a hunch it's because my router is set to give dynamic IPs to the devices on my home network (which is larger with multiple routers and devices).
Any input would be greatly appreciated. Thanks.
Click to expand...
Click to collapse
Any way we can get another link for this. I'm really wanting to try this out.
Error (509)
This account's public links are generating too much traffic and have been temporarily disabled!
New link. See original post. I have it on Mediafire now.
dcmcc99 said:
Any way we can get another link for this. I'm really wanting to try this out.
Error (509)
This account's public links are generating too much traffic and have been temporarily disabled!
Click to expand...
Click to collapse
marty45714 said:
You can test the connectivity to the SMB share from your Windows PC first. That's what I suggest.
In your Windows PC, go to My Computer and type in:
\\192.168.1.11\share
where 192.168.1.11 represents the IP address that the Linux server is telling you to use.
You can also go to the windows command line (cmd) and type:
telnet 192.168.1.11 445
which will show if your windows computer can connect to port 445 (SMB).
If these are successful, you probably have an issue that your phone and computer are not connected to the same network.
If you believe they are, you may want to see if your router is set up to not bridge the wireless and LAN traffic, which would mean that the computers on the LAN segment cannot communicate with the computers on the WI-FI segment.
Hopefully something here will help you out.
Please post your results.
Also, make sure when you are typing in names, passwords, groups and IP addresses, that you are not leaving trailing spaces on the ends of things.
Click to expand...
Click to collapse
Thanks for the help and instructions. After a few hours of fiddling around I still cannot get my phone to connect to the SMB. My computer connects successfully and after I connect via \\192.168.1.11\share the VirtualBox even progresses a bit to the point where it asks me to plug in my Bionic, but without my phone's wifi file share the process stalls. I am sure that both phone and PC are connected to the same network, sharing is all on, and firewalls are down. At this point I must assume that my router isn't bridging for some reason. Tonight I'll do some more investigation into the Airport Express settings and see if it will fix this issue.
Alright, you can also verify the network connectivity between the phone and the VM by using the 'ping' command.
Find the IP address of your phone by selecting Settings, then Wi-Fi, then click your left most menu button on the bottom and select Advanced. You will see the IP address of the phone. The first 3 octets of that address (xxx.xxx.xxx) should be the same on both the computer and the phone on MOST networks.
So from the Linux console, if you press Ctrl-c, it will drop you to a Linux prompt, from here you can try to ping the phone:
ping 192.168.1.11
Again, where 192.168.1.11 represents the IP address of your phone, that you just found from the menu.
Also, you can try to ping the Linux VM from your phone. If you've installed the Android Terminal app, you can lauch it and type:
ping 192.168.1.11
Where 192.168.1.11 represents the IP address of the Linux server. This is presented to you by the Linux console when it gives you the information to put into your phone in order to connect to the SMB share.
MNEman13 said:
Thanks for the help and instructions. After a few hours of fiddling around I still cannot get my phone to connect to the SMB. My computer connects successfully and after I connect via \\192.168.1.11\share the VirtualBox even progresses a bit to the point where it asks me to plug in my Bionic, but without my phone's wifi file share the process stalls. I am sure that both phone and PC are connected to the same network, sharing is all on, and firewalls are down. At this point I must assume that my router isn't bridging for some reason. Tonight I'll do some more investigation into the Airport Express settings and see if it will fix this issue.
Click to expand...
Click to collapse
I made it all the way through and the exploit said it was successful, but I don't have root. Any thoughts there?
marty45714 said:
Alright, you can also verify the network connectivity between the phone and the VM by using the 'ping' command.
Find the IP address of your phone by selecting Settings, then Wi-Fi, then click your left most menu button on the bottom and select Advanced. You will see the IP address of the phone. The first 3 octets of that address (xxx.xxx.xxx) should be the same on both the computer and the phone on MOST networks.
So from the Linux console, if you press Ctrl-c, it will drop you to a Linux prompt, from here you can try to ping the phone:
ping 192.168.1.11
Again, where 192.168.1.11 represents the IP address of your phone, that you just found from the menu.
Also, you can try to ping the Linux VM from your phone. If you've installed the Android Terminal app, you can lauch it and type:
ping 192.168.1.11
Where 192.168.1.11 represents the IP address of the Linux server. This is presented to you by the Linux console when it gives you the information to put into your phone in order to connect to the SMB share.
Click to expand...
Click to collapse
Here are some tips that I posted for someone over on Droid Forums. Hopefully some of this will help us figure out what is going on:
Need you to do some investigation. Run the exploit again. Once your phone is connected to the SMB share and the Linux script verifies the connectivity, press Ctrl-C to break out of the script and return to the Linux command prompt. Make sure your phone is connected to USB. From there execute the following commands and share the output with me:
sudo ash
cd /home/guest/share
./adb.linux shell
(if you execute the above command and DO NOT see this prompt: [email protected]_targa/ $
then you have USB connectivity issues and need to make sure you get your phone successfully connected
to VirtualBox and the Linux VM)
ls -l /storage/rfs0
I want to see the output of the "ls" command to verify that the SMB share is being mounted to /storage/rfs0
This can cause the exploit to fail is it's not.
If you see no output from that command, run this command:
find /storage -name pwn
If you get that far and this looks good. Can you type:
su -
and see if you get a root prompt? A root prompt means your prompt will end with '#' instead of '$' before the cursor.
If you do get this, it could be that your Superuser app is simply broken and need re-installed.
The command that the exploit runs to root the phone, once you get this far is:
/storage/rfso/pwn 1
You can try running that manually and see what happens.
caskieadam said:
I made it all the way through and the exploit said it was successful, but I don't have root. Any thoughts there?
Click to expand...
Click to collapse
So I haven't yet rooted my phone. That's next up on the list. I'm just wondering if (after rooting) if there will be a way to manually add a route when connecting via OpenVPN. The device connects perfectly to the server and the server pushes a route to my device. It's just that when I type 'ip route' in a terminal app on the Note, the pushed routes don't actually get added to the device's routing table. I've read many threads that don't really offer any solution.
I'm just hoping that I can create a Tasker or similar automated task that establishes the connection, manually adds the routes, and then packets start a flowing.
Any thoughts on OpenVPN on KitKat? Surely I'm not the only one stuck in this rut!
Any replies or thoughts are appreciated!
Sent from my Note 4 using the XDA app. Damn this thing's sweet!
EDIT: So I rooted the phone using ChainFire's method. It worked flawlessly. I connected to my VPN (which locally is 192.168.1.1/24). After connecting, I verified that the route didn't exist using a terminal command.
su
ip route
I saw nothing mentioning the 192 network. So, I added 'ip route add 192.168.1.0/24 dev tun0' and BAM I'm in business. (I ran netcfg to determine which interface my VPN was on -- I assumed tun0 but I did check!)
Hopefully this helps somebody as I've been tearing my hair out for a couple days over this thing. I did reboot and although the routes weren't there (they're evidently not persistent) the VPN still functioned as designed. I ran a DNS leak test and all of my requests were successfully being routed over the VPN -- and that was all I wanted! Cheers....