[Q] Naming the nook device / hostname? - Nook Color General

Does anybody know how to change the name of the Nook Color? In order to use an application in Citrix, it needs to have a specific name, and I can't figure out how to change it.
I've seen various ideas, such as:
http://forum.xda-developers.com/showthread.php?t=668300
which says to change the /proc/sys/kernel/hostname
I've done so, but disconnecting and reconnecting the wifi with the desired name for the NC in the above file does not work; the name stays the same. For me, the name is ROID7047BCFB-EB96-44.
How does the android/linux OS figure out a name for the NC, and how can I change it?
Thanks in advance for any help.
Update:
pinging ROID7047BCFB-EB96-44 works, as does pinging NEWHOSTNAME (what I want my NC to be called), both give the same IP address. However, my Citrix receiver still recognizes me as ROID* and boots me off.
Maybe this is some kind of DNS issue, or how do I get rid of the ROID* name and get my device to be recognized only by NEWHOSTNAME?
I suppose I can ask the Citrix/I.T. administrators to give me access on my NC (which they probably won't support doing), or I can rename my NC to something that already has access in Citrix.
It really shouldn't be that hard to name your NC, as you can any computing device.
Do I have to go into userinit.sh to set localhost to NEWHOSTNAME, or edit the init.rc file, or edit the .IMG on the ROM (it's been a while since I played around with unix, and so I'm pretty new to this stuff)?

Nook Color Device ID / Hostname
Didn't want to start a new thread on this topic...
Our network admin sees unknown devices as a security threat (or annoyance) to his network. He therefore requires a unique hostname to obtain a DHCP lease.
A hostname of "localhost" (the NC default), is seen as blank by the server. The Nook Color (and many other Android devices) must be rooted and modified to gain access.
Several posts recommend changing net.hostname. This did not work for me. Changing /proc/sys/kernel/hostname, however, would work.
For a single instance, use the following from a root prompt. THEN TURN OFF AND TURN ON WIFI to request a new DHCP lease.
# echo NEWHOSTNAME > /proc/sys/kernel/hostname
EDIT: Removed paragraph about setting at boot until I figure it out.

To set HOSTNAME / Device ID at boot
Thanks to JoshMiers for instructions on persistent settings following a reboot...
http://forum.xda-developers.com/showthread.php?t=901791
To set the HOSTNAME at boot (on rooted stock eclair, anyway)...
1. Create (via adb or RootExplorer) file /data/boot_complete_hook.sh
2. Add the following lines via a text editor (on Windows use Notepad++):
Code:
#!/system/bin/sh
#
## Set hostname/deviceID
#
echo yourchosenhostname > /proc/sys/kernel/hostname
3. At root prompt, change properties of new file
Code:
#chmod 755 /data/boot_complete_hook.sh
At root prompt, test to see if it works by executing
Code:
#/data/boot_complete_hook.sh
#cat /proc/sys/kernel/hostname
I did not need to reset the wireless after booting. If necessary, code could be added to the file to renew the DHCP lease or reset the wireless (tiwlan0).
I did have difficulty using ADB to do this, as Josh describes, and did not take time to debug. Instead, I used RootExplorer and Terminal to do it all directly on the NC.

KBMN said:
Does anybody know how to change the name of the Nook Color? In order to use an application in Citrix, it needs to have a specific name, and I can't figure out how to change it.
how about this?
http://forum.xda-developers.com/showthread.php?p=17287446#post17287446
Click to expand...
Click to collapse

Well, I can use the setprop net.hostname command to set the device hostname. However, the Citrix application takes the "clientname" from the android_id field in /data/data/com.android.providers.settings/databases/settings.db, regardless of the hostname. So, the Citrix application sees the device as "ROID"+android_id. I can't figure out how to get rid of the "ROID" part so I can make the device "clientname" to show as whatever is desired (after changing the android_id). Tried to put in a backspace character in the field, as "\b" to get rid of the "ROID" part, but that didn't work. Oh well.

Related

Is there a way to change your Wi-Fi Nexus One name

I tried a few searches in this forum and came up empty...but is there a way to change the name that the N1 identifies itself as to your Wi-Fi network? E.g. "Randy's Nexus One" or something like that?
Thanks in advance,
Randy
Yes go to portable hot spot setting then go to configure then advanced and you can change it to whatever u like
-------------------------------------
Sent via the XDA Tapatalk App
We're probably using different Nexus Ones, because on mine there is no "portable hot spot" settings. FroYo? Please elaborate.
For Eclair there's no easy way. I did something like this some time ago:
http://forum.xda-developers.com/showthread.php?p=6261359#post6261359
I hope FroYo added the option to do it easily...
jdmoore81 said:
Yes go to portable hot spot setting then go to configure then advanced and you can change it to whatever u like
-------------------------------------
Sent via the XDA Tapatalk App
Click to expand...
Click to collapse
I don't think OP's talking about the N1 as a portable hotspot... rather the device id/name a wireless router picks up when the N1 connects to the router...
I think OP is asking if it's possible to change the DHCP name of the phone
I'd like to know how to change my phone's hostname too.
Well, there are 2 ways to change the phone hostname... but both require root...
1. init.rc way
in init.rc, look for
Code:
on boot
# basic network init
ifup lo
hostname localhost
domainname localdomain
changing hostname to you desired name will change the phone hostname. So you change would look something like this...
Code:
on boot
# basic network init
ifup lo
hostname CRAiG
domainname localdomain
But this process involves building a boot.img with the new init.rc and flashing that boot.img
2. Using an init script in a mod like CM
As in a regular linux system, the following line will allow you to change you hostname without flashing a boot.img
Code:
echo CRAiG > /proc/sys/kernel/hostname
In CM, you can add this line to an init.d script like 01sysctl or 20userinit in /system/etc/init.d
And yeah, this changes the device name on your router, but you might have to delete the existing DHCP lease...
craigacgomez said:
Well, there are 2 ways to change the phone hostname... ...
In CM, you add this line to an init.d script like 01sysctl or 20userinit in /system/etc/init.d
And yeah, this changes the device name on your router, but you might have to delete the existing DHCP lease...
Click to expand...
Click to collapse
It shows that you didn't try it. You can't put it before 04 script, since the services aren't up yet, and it won't change a thing. It has to be after 05 - that's why it's best done through 20userinit or the script that it calls.
To clarify my question...
No, not using N1 as a hotspot, but how my wi-fi router sees my n1 while my N1 is a wi-fi client to it.
Randy
Jack_R1 said:
It shows that you didn't try it. You can't put it before 04 script, since the services aren't up yet, and it won't change a thing. It has to be after 05 - that's why it's best done through 20userinit or the script that it calls.
Click to expand...
Click to collapse
I did try it and I have it working with the change in 01sysctl... and you don't need services up and running to change ur hostname!!!!!
@rmagruder... what I said above with allow you to change how ur wifi router see ur n1
Hostname is for network interface. At least one (localhost) needs to be started for it to work. If there is any additional interface starting - it can change the settings during initialization, which is what's probably happening, at least on my Nexus w/ CM5.0.6. Tested with 01sysctl and it fails, as I wrote in the thread I linked above.

[MOD] Enabling tethering without paying for apps

Blatantly ripped off from richhed's thread. I'm a cheap [email protected]$#^&* so I wanted to enable wifi hotspot without paying for apps. Here's how.
I'm writing these instructions for Win7 x64, and assuming that your USB drivers and busybox are working. YMMV. No, I won't help you fix your phone if you brick it, and won't be responsible if it doesn't work for you.
1. Download Superoneclick 1.6.5 for rooting your phone. Your phone needs to be rooted, if you haven't done this yet you need to do it now.
2. Download SQLite database browser on your PC and unzip to some folder. Remember where this is.
3. Plug phone into PC and turn airplane mode on.
4. Open a command prompt as administrator (right-click, open as administrator)
5. Navigate in the command prompt to where your Superoneclick is unzipped (for me, it's in a folder on my desktop)
6. Run 'adb shell'
** note** all commands from step 7 to step 12 are in the ADB shell
7. su (if you rooted in step 1, you may have to allow access, watch your phone as it may ask)
8. mv /data/data/com.android.providers.telephony/databases/telephony.db /data/data/com.android.providers.telephony/databases/telephony.old
9. chmod 777 /data/data/com.android.providers.telephony/databases
10. chmod 664 /data/data/com.android.providers.telephony/databases/telephony.old
11. exit
12. exit
13. in the same command window which your second 'exit' command dropped you to, type 'adb pull /data/data/com.android.providers.telephony/databases/telephony.old ./telephony.db'
14. Run SQLite database browser and open the telephony.db file that you downloaded to the Superoneclick folder in the last step.
15. Click 'browse data' and select table 'Carriers'
16. You should see a long list of APN settings for various carriers, the ones you are interested in are rows 4, 6, and 7. Highlight row 4, named 'AT&T US HSDPA'. Scroll ALL THE WAY TO THE RIGHT where the title of the last column says "preloaded." Double-click the field that says 'true', and in the resulting dialog box change the "true" to "false" and click "Apply Changes". Repeat this step for rows 6 and 7.
17. Edit the 'type' (3rd last) field of row 6. Right now the field says 'tether'. Double-click and change it so that it says 'default,agps,fota,supl,tether' and apply changes.
18. Change the 'apn' (6th) field in row 6 from 'broadband' to 'wap.cingular' and apply changes.
19. Click 'save' and exit the DB browser.
20. Back in the command window, type 'adb push ./telephony.db /data/data/com.android.providers.telephony/databases/telephony.new'
21. Run 'adb shell'
** note** all commands from step 22 to step 32 are in the ADB shell
22. su
23. cd /data/data/com.android.providers.telephony/databases
24. su radio
25. cp telephony.new telephony.db
26. chmod 660 telephony.db
27. rm telephony.new
28. exit
29. cd ..
30. chmod 771 databases
31. exit
32. exit
33. Disable airplane mode
34. Go to Settings>Wireless + Networks>Mobile Networks>Access Point Names. Select radio button for AT&T Tether.
35. Reboot phone.
36. Mobile Hotspot will still validate but will turn on when using this APN. You might have to switch APN's after a reboot, I've had to and at least one other user has had to.
If you ever want to revert, we saved the file as /data/data/com.android.providers.telephony/databases/telephony.old in step 10. Just 'su' and 'cp' that puppy overtop of the existing telephony.db, remembering of course to enable airplane mode.
Not trying to start anything, but theres already a pretty good thread on this bro.
Sent from my MB860 using Tapatalk
http://code.google.com/p/android-wifi-tether/downloads/list
2.07 works flawless
lsxrx7 said:
http://code.google.com/p/android-wifi-tether/downloads/list
2.07 works flawless
Click to expand...
Click to collapse
for me as well
lsxrx7 said:
http://code.google.com/p/android-wifi-tether/downloads/list
2.07 works flawless
Click to expand...
Click to collapse
is this without modifying the sql db's??
stop linking android-wifi-tether.
Infrastructure AP (what this and richhed's method and others enable) > Adhoc (what android-wifi-tether enables)
Google the differences. Ill give you a couple reasons to start
1) a lot of corporate laptops disable adhoc connections
2) Adhoc only allows WEP - crackable in 30 seconds, a huge security risk. Infrastructure allows WPA2...
so if you dont care about any of those, then yes, android-wifi-tether is fine... and much simpler.
andy2na said:
stop linking android-wifi-tether.
Infrastructure AP (what this and richhed's method and others enable) > Adhoc (what android-wifi-tether enables)
Google the differences. Ill give you a couple reasons to start
1) a lot of corporate laptops disable adhoc connections
2) Adhoc only allows WEP - crackable in 30 seconds, a huge security risk. Infrastructure allows WPA2...
so if you dont care about any of those, then yes, android-wifi-tether is fine... and much simpler.
Click to expand...
Click to collapse
sweet. thanks bro
andy2na said:
stop linking android-wifi-tether.
Infrastructure AP (what this and richhed's method and others enable) > Adhoc (what android-wifi-tether enables)
Google the differences. Ill give you a couple reasons to start
1) a lot of corporate laptops disable adhoc connections
2) Adhoc only allows WEP - crackable in 30 seconds, a huge security risk. Infrastructure allows WPA2...
so if you dont care about any of those, then yes, android-wifi-tether is fine... and much simpler.
Click to expand...
Click to collapse
Number 2 is kinda a mute point as if your using your phone to tether i doubt its going to be your primary connection. Also the fact that your not even going to see your phone after about a 100ft for tethering it would be pretty easy to narrow down someone hacking into your wep
LancerV said:
Number 2 is kinda a mute point as if your using your phone to tether i doubt its going to be your primary connection. Also the fact that your not even going to see your phone after about a 100ft for tethering it would be pretty easy to narrow down someone hacking into your wep
Click to expand...
Click to collapse
Number 2 is pretty important; it only takes about a minute to hack through WEP when the connection is in use.
Yea think you missed it completely
Sent from my MB860 using XDA Premium App
Thanks for this, I will try this out this weekend.
Bakano said:
is this without modifying the sql db's??
Click to expand...
Click to collapse
Yes. I flashed Motorola Atrix 4G U4_1.5.2 last night, restore my apps with mybackuppro this morning and this was the first thing I tried.
Just loaded it. Didnt have to do jack. Changed SSID, changed encryption. Not letting me change password, wanking the 13 character requirement when I enter a 16 character ASCII password is too short.
But the app worked beautifully. I have tried the other methods, modding db's. That didn't work until I added this below.
Tether without at&t tethering plan: (thanks to Fixter)
http://forum.xda-developers.com/show...&postcount=193
after doing this. mobile hotspot is still greyed out in settings. It says 'high speed coverage required'. granted i am on edge with no way to test 3g atm. I am wondering if this is normal and if there is a way to enable the hotspot over edge? (yes i know it would be impractically slow)
Finally got around to doing this and it worked great.
A few corrections to your steps.
Step 3. Plug phone into PC. (I know stupid explanation, but some people may forget.)
Step 15. Select Table 'Carriers'
Step 34. 34. Go to Settings>Wireless + Networks>Mobile Networks>Access Point Names. Select radio button for AT&T Tether.
Finally, I had a ton of APNs listed in my phone. Something like 80. The ATT ones were listed near the bottom. I am not sure if this is because who I purchased my phone from, Walmart, but maybe you should give some description of rows 4,5, and 6 so that people will not get confused. I figured it out fine, but you never know.
Finally, this works in webtop, but it appears that on every reboot of the phone you have to change the APN setting when you first use webtop. It doesnt seem to matter if you are already in tethering, you have toswitch away and then switch back. After you do this once everything works fine until the next reboot.
Thanks again.
andy2na said:
2) Adhoc only allows WEP - crackable in 30 seconds, a huge security risk. Infrastructure allows WPA2...
Click to expand...
Click to collapse
It isn't so much someone could access your wifi tether, but more that the data can be captured and easily decrypted. Anything you do over that connection may as well be broadcast for all to see. (Unless you're using https etc for everything)
I use the android-wifi-tether app on bluetooth only, unfortunately it also sucks battery more than the usb port on my mac can supply so the battery depletes in a few hours.
Thank you to the OP for providing a way to enable the built-in tethering.
krkeegan said:
A few corrections to your steps.
Click to expand...
Click to collapse
Thanks, OP fixed.
Thanks for the step by step
I am not sure if it made any difference to it working, but as I'm with Telstra (Australia) I added 'default,agps,fota,supl,tether' to the entry for "Telstra Internet" and it works perfectly.
Not sure if this has been beaten to death yet, but do we for sure know that AT&T cannot track this? How are connection speeds?
I've read a few posts expressing concerns about AT&T automatically switching people to the tether/4GB plan (I have the 2GB plan), and also slow (<1mbit) download speeds. Can someone shed some light on this?
i think they can tell when we swtich from "phone" to "wap.cingular," it showed a record of me switching between the two. I also looked up my data usage and got 2 reports of usage rather than just one. still my data plan has remained unchanged. this also happened when i would switch out my sim card b/w my windows 7 samsung focus and my dell streak, and att didn't do anything. i figure if they contact me about this i can just say i've been swapping my sim card between phones. don't think they can tell the difference there (may be wrong).

[Guide][Linux] Reverse-tethering + working app store over USB.

After a few evenings of searching, reading and testing, I finally found a solution for setting up a reverse-tether connection between my Droid 3 and my Ubuntu box over a USB cable, which I can use to download apps and app updates from Google Play without eating up my mobile data credit. And since it seems to me that complete and clear explanations of how to do this with USB and Ubuntu are not available anywhere, I want to detail here all the steps of my connection setup process, in a way that will hopefully be accessible to most users of Android and Ubuntu. So here goes:
Prerequisites:
- a PC that is connected to the Internet and running Ubuntu, where you have root access and a free USB port
- a rooted Android device (in my case the Motorola Droid 3) with a SIM and an active mobile subscription
- a USB cable (I have the one that came with the phone).
Setup:
#1. Disconnect your Android device's data connection from your mobile carrier by touching the corresponding icon in the notifications tray (2 parallel vertical arrows pointing in opposite directions) or by switching your phone to Airplane Mode.
#2. Launch the Terminal emulator app on your Android device and enter this command:
ifconfig
You should get a response that shows only one network interface, named "lo" or "lo0" or something like that, with an information field that says "inet addr:127.0.0.1". This is the local loopback connection. We will not be using it - just know that it's always there in responses to "ifconfig" and ignore it from now on.
#3. Re-enable your Android device's data connection by reversing what you did at #1. Go back to the Terminal and do another
ifconfig
This time, in addition to the "lo" interface, you should see another interface that is used to communicate with the Internet through your mobile carrier. For me this interface is called "ppp0"; you may have something else, but just remember what it is because you will have to use it later wherever you see me use ppp0 in the commands below.
#4. Now connect your Android device to your Ubuntu PC using the USB cable. Access the USB connection notification in your Android notifications tray and select "PC Mode" as your USB Mode. (If you don't have this option, then I don't know what to say, you will probably have to try them all, but in that case I wouldn't start with the "Mass storage" option - that's the least likely one to work for this.)
#5. Still on the Android, open Settings -> Wireless & networks -> Tethering & Mobile Hotspot and enable "USB tethering". You should get a second, green USB icon on your status bar after tethering is enabled.
#6. Go back to the Terminal app on your Android device and do yet another
ifconfig
This time you should receive information for 3 network interfaces: in addition to "lo" and "ppp0" you should now see a new interface that corresponds to your USB. For me it's called "gether0"; remember what yours is and use it wherever I use gether0 in the commands below.
Also, look at the "inet addr:" specification of your gether0 interface and remember this IP address because we will need it later. (My USB tether interface always gets the same IP address - 192.168.42.129 - so this is what I will be using in my example commands below.)
#7. Now let's look at the PC's network interfaces. Open a terminal emulator (I use Ctrl-Alt-T to do this; depending on what launchers, shortcuts or desktop environments you have, you may need to find it in a menu or do something else to get to it) and type
ifconfig
This response depends a lot on how your PC is set up, but generally I'd expect to see at least a "lo" (local loopback) interface, a "usb0" interface, one or more "eth0", "eth1" etc. interfaces and maybe a "ppp0" interface. The "ppp0" and "eth0" type interfaces will be for your PC's Internet connection and the "usb0" interface will correspond to the USB cable connecting you to the Android device. If you have a "ppp0", that's probably the one you should use in all setup commands to be run on the PC where I will use ppp0. Otherwise if you only have "lo", "usb0" and "eth0", your PC's Internet is probably on "eth0", so use that one in place of my ppp0 in commands run on the PC. (If you have any other combinations without a "ppp0", I don't know what to suggest except try them all one by one, everything you have besides "lo" and "usb0".)
#8. Back to the Android device. What we want here is for the ppp0 interface to remain enabled - because that's the only way the app store will agree to download any apps - but all our Internet communication to actually go through the gether0 interface, i.e. through the USB tether. To do this, we need to change the default route Android apps use to send data, namely to delete the default route that points to ppp0 and add a new default route that points to gether0 and that uses as a gateway the IP address of the Ubuntu PC (an address we will set up on the PC at the end of this process). So run these commands in the Terminal on the Android:
su
route del default
route add default gw 192.168.42.1 dev gether0
setprop net.dns1 8.8.8.8
Notice that the gateway IP address we will be using is made up of the first 3 numbers from our USB tether interface's IP from step #6, followed by a ".1" instead of whatever the 4th group was in the original IP.
#9. On the PC we want to set up standard Internet connection sharing between usb0 and ppp0 according to the instructions from the Ubuntu manual, so we will run these commands in the terminal window:
sudo su -
(enter your password here to get root access and then do 5 more lines)
iptables -A FORWARD -o ppp0 -i usb0 -s 192.168.42.0/24 -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -F POSTROUTING
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
Here again you can see we're using the first 3 numbers from the USB tether interface's IP, but adding a ".0" and a "/24" at the end to specify an entire class of IPs we're going to accept packets from over the USB, a class that includes our Android's actual IP, 192.168.42.129. (We could probably just use that single IP without a "/24", but whatever, this class stuff is usually the way it's done.)
#10. Finally, we will set our PC's usb0 interface IP to the gateway IP we already told the Android to send everything to, i.e. 192.168.42.1, after which we need to quickly check that the connection is working and jump right into Google Play to download some apps. I say "quickly" because in my case, for whatever reason, after I set the gateway IP on the PC I can only leave the connection unused for about 1 minute before it drops on its own. So don't wait too much after #10.1 to do the rest:
#10.1. Enter this into your PC's terminal:
ip addr add 192.168.42.1/24 dev usb0
#10.2. Check that the connection is up by entering this into your Android's terminal first:
ping -c 3 google.com
If you get 3 responses from Google, you're all set to launch Google Play and download some apps:victory:. If there's no response, go back to #10.1 and try again.
Another indication that the PC has dropped the connection is that you get a notification popup on the PC that says "Wired network/ Disconnected". That tells you you need to jump back to #10.1 to get the USB link working again.
Also, you will know you need to do this again if you find Google Play is suddenly refusing to load apps or pages even though it was loading them before - you probably waited too long between clicks and allowed the connection to drop.
#11. To reset all the connections to normal when you're done, make sure to
#11.A. Go to Settings -> Wireless & networks -> Tethering & Mobile Hotspot and disable "USB tethering" before you unplug the USB cable from either device, otherwise the gether0 interface may remain active and interfere with your ability to get back your data link to your mobile carrier.
#11.B. Do steps #1 and #3 again to get your Android to automatically re-establish the proper settings for the link to your mobile carrier.
Final remarks:
- In order to streamline this process, especially steps #8-#10, you should probably put these commands and your specific interface names and IP addresses in some scripts - one on the PC, one on the Android device - that you can then launch more easily. I'm a newbie at both Ubuntu and Android, so I have to do some more searching to figure out how to do this properly.
- Keeping the connection up even if you're idle - e.g. while reading app descriptions and deciding what to download - is probably a matter of sending some dummy packets periodically through the USB, which would probably involve another script running in the background - again something I haven't taken the time to figure out how to set up yet.
- Anytime you get paranoid about whether the apps are being downloaded through the USB cable or your mobile data plan, go to your Android terminal and check whether your default network route is still pointing to your gateway PC by running:
route
This will show you all the routes that are configured on your Android. The last line in the table should say "default", then "192.168.42.1" and end with "gether0". This means the data is still going through the USB and not eating up your mobile data credit.
Enjoy!
It seems to work, but I'm still not sure whether my phone uses my computer's internet connection or my 3G. Upon executing:
Code:
busybox route
I get a lot of lines instead of just "192.168.42.1" ended with "rndis0" (this is how its named on my device) though this "192.168.42.1" exists.
leledumbo said:
It seems to work, but I'm still not sure whether my phone uses my computer's internet connection or my 3G.
Click to expand...
Click to collapse
The simple way I confirm it is by looking at the 3G icon at the top: during normal usage the two arrows in the icon light up depending on whether I'm transmitting or receiving or both; when I'm reverse-tethered they never light up at all.
I get a lot of lines instead of just "192.168.42.1" ended with "rndis0" (this is how its named on my device) though this "192.168.42.1" exists.
Click to expand...
Click to collapse
Well, in principle you should only need to care about the "default" line, but if by any chance you have some rule in that table that specifies a non-default route for exactly the websites you're trying to access in all this and that rule happens to specify a different interface than "rndis0", then yes - you might be using your mobile data plan after all. But I wouldn't bet on it. I have a few routes on there, but I think they're just related to services my carrier is offering at some specific IPs it has.
If you can't confirm the 3G is being bypassed by looking at the icon and if you can't spare the traffic to do a direct consumption test (query how much traffic is left/spent, use some more traffic through this setup, query again and compare), then the only other way to make sure that I can think of is to clean up the whole routing table ("route del" everything) and leave only the "default" rule from the instructions above. Then there really won't be any other path for your network packets to take but through the USB. But then you have to hope the routing table will get rebuilt as it was after you reset everything. Or you could just write down all the rules you had before so you can reconfigure them if they don't get re-created automatically at reset.
In fact - what am I talking about? - there's another way you can make sure your Android is really trying to go through the USB to get to the Internet: when you do step #10.1 on the PC just set up a wrong gateway IP, for example 192.1.1.1. If your Android fails to open any webpages or the app store and then if you do #10.1 properly it starts working (again), then it's clear that it's trying to go through the USB cable and isn't using any alternate route.
Weird, the method doesn't work anymore for the subsequent trials. I'll try rebooting the phone.
Works for Windows too
I mixed the instructions found in this thread with another thread here in xda and it worked well under Windows 7.
Thank you for the excelent guide!
donjoe0 said:
After a few evenings of searching, reading and testing, I finally found a solution for setting up a reverse-tether connection between my Droid 3 and my Ubuntu box over a USB cable, which I can use to download apps and app updates from Google Play without eating up my mobile data credit. And since it seems to me that complete and clear explanations of how to do this with USB and Ubuntu are not available anywhere, I want to detail here all the steps of my connection setup process, in a way that will hopefully be accessible to most users of Android and Ubuntu. So here goes:
[guide goes here, edited quote]
Enjoy!
Click to expand...
Click to collapse
So I tried everything on a LG Phoenix running Kitkat and no go. All the commands go through except the ping command. Any suggestions?
AndrMatr said:
So I tried everything on a LG Phoenix running Kitkat and no go. All the commands go through except the ping command. Any suggestions?
Click to expand...
Click to collapse
All I can say is this method continued to work for me pretty much the same as described when I switched to KitKat on an ASUS Padfone 2 with two minor exceptions:
- busybox was no longer set up to be invoked automatically on this other custom ROM so I had to prefix some commands with "busybox " (e.g. the "route" commands)
- my USB tether connection is now named "rndis0" instead of "gether0"; I had to fiddle around a bit with the "netcfg" command to figure that out.

Is MAC Filtering Supported?

I have a rooted Samsung Galaxy Exhibit II (SGH-T679) and I am attempting to do some MAC filtering, but opposite of what most people do.
I want to prevent my phone from accessing a specific router (I have the router BSSID). I downloaded "Android Terminal Emulator" and typed
Code:
su
and pressed enter. I enabled access to superuser. Then I typed
Code:
iptables -A INPUT -m mac --mac-source 00:00:00:00:00:00 -j DROP
(obviously substituting the mac address for the BSSID of the router). It just went to a new line (no message or anything). Then I typed
Code:
iptables -A FORWARD -m mac --mac-source 00:00:00:00:00:00 -j DROP
and pressed enter. Still the same thing (new line; no message). I opened another app to see if it would connect to the internet. I still had a internet connection. I want the connection to drop for that specific router.
What is going on? Does my phone even support MAC address filtering? Especially the way in which I'm trying to do it? I even tried downloading AFWall+, Android Firewall and DroidWall, and entered the iptables in them. Still won't block me off of the internet for that specific BSSID.
Is this even possible?
P.S. The reason why I am trying to do this is that I'm testing this on my own phone and router before I implement it for a friend. I have set up Tomato with Access Restrictions and OpenDNS on my friend's router, but his son has been using his neighbour's wifi in the middle of the night to get online. I have the BSSID of the neighbour's router (thanks to Tomato's Wireless Survey). Maybe someone has another idea of how I can prevent him from accessing the neighbour's router? (and no, we don't want to ask the neighbour to change the password, because the neighbour's son will likely just give the password to my friend's son again).
That command updates the firewall rules, which has nothing to do with whether the phone connects to a particular wifi connection.
Other than not trying to connect to begin with, I'm not sure there is a way to do that. But it may depend on the rom you have.
Sent from my SGH-T679 using xda app-developers app
---------- Post added at 03:32 PM ---------- Previous post was at 03:18 PM ----------
Found an app that does what you are looking for.
https://market.android.com/details?id=com.hogdex.WifiRuler
Haven't tried it myself, as I just don't connect automatically and don't manually connect very often outside of a few places.
Sent from my SGH-T679 using xda app-developers app
I figured things out. For one, after I added the iptable rule, I needed to REBOOT my phone for it to apply (which I wasn't doing). Secondly, I needed to use the LAN Mac Address (NOT the BSSID/Wireless MAC address) in order for the iptable rule to work.
Thirdly, I downloaded AFWall+. It allowed me to set it as administrator to prevent uninstallation. The only thing missing is that the developer needs to password protect removing the app as administrator.
Then I downloaded Android Terminal Emulator. In order to find the LAN MAC address for the connection that I am looking to block, I typed this into the emulator:
Code:
arp -n
Then I used the MAC address that was given in the terminal and put that into this rule here to be place in "custom scripts" in the firewall:
Code:
$IPTABLES -A INPUT -m mac --mac-source 00:00:00:00:00:00 -j DROP

[Plugin] Remote Adb Shell

Hi everyone!
I just created my first Tasker plug-in. This plug-in enables you to send an adb shell command to any other device on the network that has adb over wifi enabled. I for example use it to turn my androidtv on or off by sending it the command "input keyevent POWER". You can also open specific activities in apps for example or simulate touch input.
Please read the description before using it and don't hesitate to leave feedback/bug reports/tips! This is my first app ever published so I still have a lot to learn.
You can download it for free from the play store:
https://play.google.com/store/apps/details?id=com.ADBPlugin
Edit: It's now also available on XDA Labs! You can find it here
First update is live!
This includes proper (cat)logs and Tasker errors if something went wrong, so if you run in any problems, you can now tell me . It also plays a lot nicer with the Tasker timeout system.
@Humpie
Thanks for this plugin. I allready made a project for my sony android tv. Start apps and controll media play.
But to make the plugin better I have some featur requests:
It would be nice to be able to work with tasker variables. e.g input text "%mytext".
Another feature reqest would be to get a output variable for commands with output like adb shell pm list packages.
MartelKombat said:
@Humpie
Thanks for this plugin. I allready made a project for my sony android tv. Start apps and controll media play.
But to make the plugin better I have some featur requests:
It would be nice to be able to work with tasker variables. e.g input text "%mytext".
Another feature reqest would be to get a output variable for commands with output like adb shell pm list packages.
Click to expand...
Click to collapse
Thanks for the tips! Will definitely add variable support and I'll also have a look at output variables. They are visible in the logs already, but not yet to tasker.
Why can't we use the built-in code Acton in Tasker? Is there a difference?
loogielv said:
Why can't we use the built-in code Acton in Tasker? Is there a difference?
Click to expand...
Click to collapse
In fact there is, since android 4.something google removed adb from android devices, so you can't perform adb commands from your phone, well aside from my plugin that is.
There would however be no difference if your remote device did have Tasker and you programmed it so that a certain action does something with code. However, you would have to figure out a way to contact that device etc...
Second update! The Plugin now has Tasker variable support!
(enjoy @MartelKombat btw I'm still thinking about how to implement your other request!)
I doont understand. I can type the code, but i do have to remove the "adb sell" part of the code but it's good to go… is that not what this plugin does?
Humpie said:
Thanks for the tips! Will definitely add variable support and I'll also have a look at output variables. They are visible in the logs already, but not yet to tasker.
Click to expand...
Click to collapse
Humpie said:
Second update! The Plugin now has Tasker variable support!
(enjoy @MartelKombat btw I'm still thinking about how to implement your other request!)
Click to expand...
Click to collapse
Any news on the output variable? I have high hopes since you mentioned you already see the output in the logs...
Thanks a lot for this plugin! It makes an unrooted phone much easier to control!
How to run root commands on an unrooted device with this plugin
I just wanted to share how I use this plugin, just to give others an example of what this nice plugin is capable of.
Recently, I bought a new device and for now, I have no intention of rooting it. Coming from a rooted OnePlus One, this means some of my Tasker profiles do not work as expected anymore and I have to find workarounds.
On LineageOS (and CyanogenMod before that), we have the option to display left/right cursor arrows in the navigation bar when typing text. I always loved this feature, since placing the cursor in the right position by tapping will always be a hit&miss game. Since my new device (S7 Edge) has no onscreen navigation bar, I was searching for a replacement solution to move the cursor. I came up with the idea that it would be quite handy to use the volume buttons for this. So, the idea was the following:
IF the keyboard is shown THEN use the volume keys to move the cursor (and suppress any volume changes, if possible).
It took me a while to figure out how to determine whether the keyboard is out (solution: install another keyboard and intercept the "change input method" notification as a trigger). Suppressing the volume keys' usual behaviour was easy (AutoInput -> Key Suppress) but the final step turned out to be quite difficult: How to move the cursor?
After doing some extensive research, I always came to the same point: "not possible without root". Damn.
But then, this plugin came in. The keyword "remote" in its name might suggest that you can use this plugin only to act from one device to another, but that's not true. Actually, you can use this plugin to run adb commands on the same device.
What does that mean? It means that you can run an adb shell command like "adb shell input keyevent xy" on your phone WITHOUT ROOT. In my case, I can run "input keyevent 21" and "input keyevent 22" to move the cursor. So, how can we do that?
Prerequisites:
Connect your device via ADB to a PC (google it if you don't know how) and run the command "adb tcpip 5555". That's it, you can disconnect your device now.
Then in Tasker, create an action with this plugin and type in the following:
IP Address: localhost
Port: 5555
ADB Shell Command: input keyevent POWER
Hit the play button to test this action. If you've done everything right, your screen will turn off.
Congrats, you just executed a command on an unrooted device which usually requires root privileges!
Important:
The only downside is, the tcpip setting does not survive a reboot, so you have to set the port 5555 again via PC after rebooting the device.
I hope I explained the important part well enough. If that's not the case, don't hesitate to quote me and I'll answer here.
digitalpig82 said:
Any news on the output variable? I have high hopes since you mentioned you already see the output in the logs...
Thanks a lot for this plugin! It makes an unrooted phone much easier to control!
Click to expand...
Click to collapse
I'm sorry for my absence, really busy with school etc. (honestly, I also completely forgot, I hope you can forgive me). I'll try to look into it soon (this week or the next) and see how far I get. I really like that you like my plugin! I just found out myself last week that I can let unrooted phones send shell commands to themselves using my plugin, so I'm glad to see you found it out as well! (I used it for snapchat to simulate volume key presses, which is also possible without root indeed: https://www.reddit.com/r/tasker/comments/699sav/project_share_handsfree_snapchat_picture_and/ It also works for other camera apps that require you to hold the button to film, like whatsapp etc)
Edit: I hope it pleases you to hear that today I started working on it again. I already have the responses bundled in a list in Java, now I just need to parse them to Tasker
loogielv said:
I doont understand. I can type the code, but i do have to remove the "adb sell" part of the code but it's good to go… is that not what this plugin does?
Click to expand...
Click to collapse
Yes, you have to remove the "adb shell" part since all my plugin does is access the adb shell part. This means commands like adb pull etc won't work, that requires a different type of connection, that for now I can't achieve with Tasker. But running any remote shell command should be fine (like how you would run it if you were directly running the commands from a terminal on your phone)
digitalpig82 said:
I just wanted to share how I use this plugin, just to give others an example of what this nice plugin is capable of.
Recently, I bought a new device and for now, I have no intention of rooting it. Coming from a rooted OnePlus One, this means some of my Tasker profiles do not work as expected anymore and I have to find workarounds.
On LineageOS (and CyanogenMod before that), we have the option to display left/right cursor arrows in the navigation bar when typing text. I always loved this feature, since placing the cursor in the right position by tapping will always be a hit&miss game. Since my new device (S7 Edge) has no onscreen navigation bar, I was searching for a replacement solution to move the cursor. I came up with the idea that it would be quite handy to use the volume buttons for this. So, the idea was the following:
IF the keyboard is shown THEN use the volume keys to move the cursor (and suppress any volume changes, if possible).
It took me a while to figure out how to determine whether the keyboard is out (solution: install another keyboard and intercept the "change input method" notification as a trigger). Suppressing the volume keys' usual behaviour was easy (AutoInput -> Key Suppress) but the final step turned out to be quite difficult: How to move the cursor?
After doing some extensive research, I always came to the same point: "not possible without root". Damn.
But then, this plugin came in. The keyword "remote" in its name might suggest that you can use this plugin only to act from one device to another, but that's not true. Actually, you can use this plugin to run adb commands on the same device.
What does that mean? It means that you can run an adb shell command like "adb shell input keyevent xy" on your phone WITHOUT ROOT. In my case, I can run "input keyevent 21" and "input keyevent 22" to move the cursor. So, how can we do that?
Prerequisites:
Connect your device via ADB to a PC (google it if you don't know how) and run the command "adb tcpip 5555". That's it, you can disconnect your device now.
Then in Tasker, create an action with this plugin and type in the following:
IP Address: localhost
Port: 5555
ADB Shell Command: input keyevent POWER
Hit the play button to test this action. If you've done everything right, your screen will turn off.
Congrats, you just executed a command on an unrooted device which usually requires root privileges!
Important:
The only downside is, the tcpip setting does not survive a reboot, so you have to set the port 5555 again via PC after rebooting the device.
I hope I explained the important part well enough. If that's not the case, don't hesitate to quote me and I'll answer here.
Click to expand...
Click to collapse
So...is it possible to create a version of the plugin that runs locally and doesn't disappear on a reboot?
kenkiller said:
So...is it possible to create a version of the plugin that runs locally and doesn't disappear on a reboot?
Click to expand...
Click to collapse
I would like to be able to create such a think but I don't think Google would allow it since it's a big security flaw to have adb opened to the world at all time without notifying the user. Some devices however have a debug over wifi function hidden in the developer options (like the nvidia shield android tv), there you can just enable it and it will probably survive a reboot.
However what I would advise to do if this option is not available, is to create a .bat file on your desktop containing "adb tcpip 5555". That way after a reboot you can just plug in your phone, click the bat file and be done!
Humpie said:
I would like to be able to create such a think but I don't think Google would allow it since it's a big security flaw to have adb opened to the world at all time without notifying the user. Some devices however have a debug over wifi function hidden in the developer options (like the nvidia shield android tv), there you can just enable it and it will probably survive a reboot.
However what I would advise to do if this option is not available, is to create a .bat file on your desktop containing "adb tcpip 5555". That way after a reboot you can just plug in your phone, click the bat file and be done!
Click to expand...
Click to collapse
Hmm....But there's this custom nav bar app where it allows users to grant it adb shell permissions, and the permission survives over reboots. Auto tools and Securetask relies on the same process as well.
I guess what we're asking for is something that's not as encompassing as your plugin. Me, I just want to execute the power command without root in a way that respects smart lock, which is possible now with your app but doesn't survive a reboot, or with the custom nav bar app, which survives a reboot, but restricts me to using it in a tiny button on the nav bar, as the dev doesn't seem interested in exposing the commands to external usage.
---------- Post added at 07:30 AM ---------- Previous post was at 07:28 AM ----------
We discussed it in this part here....
https://forum.xda-developers.com/an...avigation-bar-customize-t3590967/post72212488
kenkiller said:
Hmm....But there's this custom nav bar app where it allows users to grant it adb shell permissions, and the permission survives over reboots. Auto tools and Securetask relies on the same process as well.
I guess what we're asking for is something that's not as encompassing as your plugin. Me, I just want to execute the power command without root in a way that respects smart lock, which is possible now with your app but doesn't survive a reboot, or with the custom nav bar app, which survives a reboot, but restricts me to using it in a tiny button on the nav bar, as the dev doesn't seem interested in exposing the commands to external usage.
---------- Post added at 07:30 AM ---------- Previous post was at 07:28 AM ----------
We discussed it in this part here....
https://forum.xda-developers.com/an...avigation-bar-customize-t3590967/post72212488
Click to expand...
Click to collapse
It seems this app uses specific android permissions to be able to send events etc. However my plugin has no direct access to the android system (only by using the adb bridge), so granting my plugin these permissions won't help. What however would help is if I could find a way to enable adb over wifi using only some permissions... I have no clue whether this is possible though as the app would have to call service.adb.tcp.port 5555 for itself and that needs root or an adb connection (so it still requires a laptop XD). I'm still trying though.
Humpie said:
It seems this app uses specific android permissions to be able to send events etc. However my plugin has no direct access to the android system (only by using the adb bridge), so granting my plugin these permissions won't help. What however would help is if I could find a way to enable adb over wifi using only some permissions... I have no clue whether this is possible though as the app would have to call service.adb.tcp.port 5555 for itself and that needs root or an adb connection (so it still requires a laptop XD). I'm still trying though.
Click to expand...
Click to collapse
No worries. It's just that it's so close yet so far, heheh.... I guess I'll have to reboot only when home.
kenkiller said:
No worries. It's just that it's so close yet so far, heheh.... I guess I'll have to reboot only when home.
Click to expand...
Click to collapse
I found out it is in fact possible to have wireless adb survive a reboot! However it requires a build.prop edit.
in \system\build.prop "service.adb.tcp.port=5555" needs to be added at the end of the file and then after a reboot adb over wifi will still be enabled (at least it was in my case).
The downside is that this modification can't be done via adb without root unless you have a custom recovery like TWRP and run adb while having that opened and /System/ mounted.
I'm trying to create a zip that modifies the build.prop how it should be modified, but I don't think it's possible to run it through a non-custom recovery...
Edit: I added my .bat file for modifying the build.prop adding that line. It uses an adb connection that requires more rights than what android allows when booted, but should probably work if you are able to access adb from recovery and you are of course booted in recovery mode (using recoveries like TWRP or even some stock manufacturer ones).
Update 4.3 is live!
As requested you can now access the output from the console directly in Tasker.
I tried to order everything neatly in a list, with each line in the console being an item in the list, but this does mean that the initial "device\sdcard $" et cetera get added as an item as well.
But since I didn't want to cut off anything important I just kept it that way. You can just modify the list in any way you want (AutoTools has some handy Array handling tools built in).
I also added some hints in the main screen just for fun.
If you run into any strange behaviour, bugs or have tips, please tell me!
digitalpig82 said:
Any news on the output variable? I have high hopes since you mentioned you already see the output in the logs...
Thanks a lot for this plugin! It makes an unrooted phone much easier to control!
Click to expand...
Click to collapse
Enjoy
Since most people are using my Plugin locally instead of remotely, I'm thinking of renaming it to just 'ADB Shell [Tasker]'. It would make it simpler when googling it. What do you think?

Categories

Resources