For various reasons I need to change the android_id from time to time and to keep things nice and tighty, I always backup any settings before hand and restore to my original settings (android_id) when done. I wanted to have everything in one little package because plugging the commands in a terminal on the phone is not fun when the SDK is not available.
I could not find a solution for this so for simplicity, I wrote a quick bash script and decided to alter to make it more user friendly in case someone else has the need.
By default it will backup your settings.db (android_id location), generate a random letter/number 16 characters long and update the existing settings.db. You can edit the script to specific paths and even if you would like use your own hex code instead of a randomly generated one.
Anyways, from the terminal/adb this can be executed with 'sh android_id.sh'
Note: I used an array to generate the random hex. you may need to follow the steps here to obtain bash on your phone: http://forum.xda-developers.com/showthread.php?t=537827
can you explain a bit more abt the script? why is it needed to change the android_id?
nicandris said:
can you explain a bit more abt the script? why is it needed to change the android_id?
Click to expand...
Click to collapse
It's nothing too complicated..
the script provides a prompt with 3 options, backup, update and restore.
Backup does just that - it checks if the specified directory exists and if so, copies it to that location creating a backup of the original.
update checks for the settings.db in the backup location, generates a 16 character random number/letter string, updates the settings.db via sqlite and reboots the phone. Once your phone is rebooted, the randomly generated string is now your android id.
Restore deletes the altered settings.db and copies the original so the specified location reverting your phone back to it's original settings. This may or may not be necessary for some people....I'm just anal.
Why change the android_id?
I'm no stranger to Linux but am rather new to the droid. However, from what I read everybody has a unique android_id. Some apps will check the id when you register and won't allow you to register again (some games for example). Also, there are some roms will install a generic android id that multiple users may share. This can be problematic for certain apps that require a unique ID.
paxx- said:
Why change the android_id?
I'm no stranger to Linux but am rather new to the droid. However, from what I read everybody has a unique android_id. Some apps will check the id when you register and won't allow you to register again (some games for example). Also, there are some roms will install a generic android id that multiple users may share. This can be problematic for certain apps that require a unique ID.
Click to expand...
Click to collapse
thanx for the heads up! will have this on mind
Digging Deeper
paxx- said:
By default it will backup your settings.db (android_id location), generate a random letter/number 16 characters long and update the existing settings.db. You can edit the script to specific paths and even if you would like use your own hex code instead of a randomly generated one.
Anyways, from the terminal/adb this can be executed with 'sh android_id.sh'
Note: I used an array to generate the random hex. you may need to follow the steps here to obtain bash on your phone: http://forum.xda-developers.com/showthread.php?t=537827
Click to expand...
Click to collapse
I know this is an old post, But id like to know if this .sh can be added to a ROM and run after each ROM restore. The purpose is to use the same CWM backup, but during the restore process create unique android_id's.
I need to duplicate this on over 4500 devices. Pantech Element Tablet to be specific.
This is a solution for people looking to invert colors or force specific colors (e.g. white text / black background) on their web browser. Great for easier reading (especially at night) and saving power on OLED screens. CyanogenMod's browser has an invert colors option built in, but as far as I can tell, nobody has been able to port the CM browser to other ROMs. This solution works with any browser or ROM.
The basic idea is to run a web filter proxy such as Privoxy. Proxy filters are usually used for ad blocking, but they also have the power to completely rewrite a webpage. Privoxy is run in the background, and using the browser or WiFi/APN proxy settings, all web traffic is run through Privoxy. Privoxy rewrites the web pages based on the filters before it is displayed on your browser.
In the attached set, I've put together some badly-written but effective filters to force light text on black backgrounds. The filters rewrite the webpage so that the background is always black, text is always light gray, and links are always green. The filters only tweak the HTML/styles, so as a (usually) helpful side effect, the pictures remain unchanged. With my current configuration, Privoxy loads automatically in the background at startup, and all web pages run through Privoxy and are displayed in my designated colors. See the screenshots below to see it in action.
I put together a simple set of files that so folks can test this out.
Requirements
- You must have a rooted phone.
- You must be able to access proxy settings. Depending on your firmware, you might be able to set a proxy in Wireless and Network Settings (Wi-Fi settings -> Advanced, or Mobile Networks -> Access Point Names). You can also try an app like Transproxy or AutoProxy, or a browser that supports proxy settings, such as Firefox Mobile with the Proxy Mobile add-on.
Instructions
- Download and install Autostart (Root) from the Market.
- In your root folder, create a folder called /data/opt
- Download the attached "force_colors.zip" and extract the files
- Place all the files in /data/opt. Set appropriate permissions. (Privoxy and autostart.sh need to be executable.)
- Reboot your phone. Autostart should run the autostart.sh script (it will ask for superuser permission) and Privoxy will run in the background.
- Set your proxy host to localhost and the proxy port to 8118.
- If everything went correctly, all webpages should load in black background, light gray text and green links.
Note: If you use DroidWall or similar firewall settings, make sure that you allow access for "Applications running as root" so that Privoxy can access the network.
---
Note that these filters are infinitely customizable, if you know how to use regular expressions. Just edit force_colors.filter with the filters of your choice. For example, the Privoxy filters available here are specifically designed to invert some colors and make other ones darker, so you can still preserve some website colors in a more readable format.
In the next post, I'll describe everything I researched in pursuit of this solution. I am hoping others will pick up this project and make it into an easy-to-use package, and also to create some alternative filters to make them cleaner and/or more effective.
I think this feature is sorely needed in Android. Please pass the word to any developers who can help make it a reality!
[Note: This is my earlier post explaining what I did to make this solution work. Please note that I am a complete development noob! I hope this information is helpful and other people will improve on my solution.]
- There is an Android port of Privoxy on the Android Market called Privoxy (BETA 1). Install it and see if it works for you. On my phone, the app interface does not work. If I try to manually start Privoxy in a terminal window, it gives me a seg fault. Anyway, run the app once regardless, so that it copies the Privoxy files to the app data directory (/data/data/com.galoula.Privoxy/). We will use this directory as our base.
- A *working* Android port of Privoxy is included in Orbot: Tor on Android. (Tor uses Privoxy to pass the HTTP requests to a SOCKS proxy.) Download, install and run Orbot. You just need to run it once so that it copies the Privoxy binary to the app data folder.
- You'll find Orbot's Privoxy binary in /data/data/org.torproject.android/app_bin. Copy the "privoxy" binary and use it to replace the binary that came with Privoxy (BETA 1) (located in /data/data/com.galoula.Privoxy/bin). Set appropriate permissions. (We only installed Orbot for the binary, so you can uninstall Orbot now if you don't want it always loading in the background.)
- Now set up the filters. Download the attached force_colors.zip below. Extract the three files (force_colors.action, force_colors.filter, and privoxy_conf). Copy these files to /data/data/com.galoula.Privoxy/etc.
- Open a terminal window, navigate to /data/data/com.galoula.Privoxy/bin and start privoxy by running "./privoxy ../etc/privoxy_conf"
- By default, Privoxy will listen on port 8118. Go to your WiFi settings or APN settings. Set the Proxy name to "localhost" and the port to "8118". Now all web data will pass through Privoxy.
- Browse to a few websites and you'll see white text on black backgrounds! The default colors in the force_colors.filter are black for backgrounds, light gray for text, and green for links. Feel free to edit force_colors.filter to whatever color combination you prefer. I used HTML color names instead of hex codes to make it more readable.
- To run Privoxy every time at startup, I use an app from the Market called Autostart (Root). The directions are limited but basically, you just need to install the app and make a file called /data/opt/autostart.sh (set appropriate permissions). Then in autostart.sh, put this line: "/data/data/com.galoula.Privoxy/bin/privoxy /data/data/com.galoula.Privoxy/etc/privoxy_conf". The next time you reboot (might have to try it one or two times), Autostart will ask for superuser permission, and start Privoxy automatically.
Hope this is helpful for anybody else who wants to experiment.
hey claimui, this looks like a great approach! i'm looking forward to giving it a try this weekend and learning more about how the filtering works!
I spent a couple of days learning regular expressions (or at least some of them) and throwing together a simpler set of filters to force certain colors on a webpage. With this set, all backgrounds are black, all text is light grey, and links are green.
EDIT: My filters are now included in the force_colors.zip attached in the OP.
added to
black energy saving android apps for AMOLED screens
I made several updates to the original posts, including a suggestion on how to get Privoxy to start automatically on boot. After going through this whole process, this is a really effective solution. Privoxy starts automatically and invisibly whenever I start up my phone, and all of my webpages automatically pass through Privoxy and get displayed in my preferred colors.
For future tweaking, it would be nice to have a simple shortcut to enable/disable the filtering. (Although honestly I never want to disable it -- I always like my colors better!) Note that you can't simply kill Privoxy because your browser won't be able to find the proxy to connect to. So you either need a Privoxy command to toggle filtering on and off, or toggle the proxy settings to either use or bypass Privoxy.
In the meantime though, I think this still works really well. Hope others give it a try and can improve on the procedure.
Major update: I have finally consolidated all the steps into a small zip file and some simple instructions. You will need root access and a file manager or some basic knowledge of how to get around your phone. Just follow the instructions in the first post and you should be able to get it working very quickly.
Would like to test this but couldn't things to work...
Privoxy now updates to beta2.
Everything I try I get 404 Page can't loaded...
Have changed to localhost and port 8118 but doesn't work...
No need to install Privoxy from the Market. Just follow the instructions in my first post. After you install the Autostart app and put the files in the /data/opt folder, Privoxy will start at the next reboot.
Thx! Think it was a problem with SiyahKernel! After flashing from 2.0b2 to 2.0b3 now privoxy work!
Thx a lot! Have long time searched for something similar!
when I try to create the folder /data/opt it says it is created but in doesn't show up. also when I create the same folder and then move it to root folder it automatically renames it opt. I'm using root explorer.
In Root Explorer, first navigate to the /data folder, then click the button to Mount as R/W, then create the opt folder. Does that work?
Updated the OP to include some more suggestions for folks who are having trouble finding proxy settings. The basic options are:
1. See if your firmware comes with proxy settings. Under Wireless and Network Settings, look in Wi-Fi settings -> (menu button) Advanced, or Mobile Networks -> Access Point Names.
2. You can also try an app like Transproxy or AutoProxy.
3. Try a browser that supports proxy settings, such as Firefox Mobile with the Proxy Mobile add-on.
Nice.
Have you by any chance conducted a battery test or otherwise made any effort to notice the impact of this modification on battery life?
I haven't personally done any battery experiments (at least not for the browser) but this is a good reference: http://forum.xda-developers.com/showthread.php?t=660853
Basically yes, black backgrounds do save battery power on AMOLED screens. Personally I think the difference between 5% and 3% (or 3% and 2% at lower brightness) is not that big of a deal, probably not even noticeable in normal use. But if you want to squeeze the most milliwatts out of your battery then this will help.
To me the main benefit is that black backgrounds are just much easier to read, especially at night, and especially with the deep blacks / high contrast of the AMOLED screen.
Don't need 10 chars for this replay.
AWESOME!
Edit:
Sadly, from the time that passed since I posted this post, I stumbled upon a few annoying bugs.
1. Proccess locked at 50% cpu, (100% of a single core)
2. Some sites just don't work, and then I have to restart the browser.
Yes google mobile site everytime I would like to search something I get this Error:
This page contains the following errors:
error on line 3 at colum 31: AttValue: " or ' expected
Reparse document as HTML
I know regexp pretty well, but Privoxy syntax is a little bit confusing.
I'm trying to figure out the filters supplied by the OP, and they are just too confusing
To OP : How do you set the delimiter for the filters in Privoxy?
I know / and | are possible, are you using + for some reason?
All your filters start with s+, what is the + ?
Great work. Autostart didn't work on my Galaxy Note for some reason.
But maybe changing CSS is easier. This method works on Opera Mobile:
http://forum.xda-developers.com/showthread.php?t=1326434
eitama said:
Sadly, from the time that passed since I posted this post, I stumbled upon a few annoying bugs.
1. Proccess locked at 50% cpu, (100% of a single core)
2. Some sites just don't work, and then I have to restart the browser.
Click to expand...
Click to collapse
Hm, I haven't encountered these bugs. I am using the same files that I uploaded in the zip. Does it only happen with certain sites? Maybe I just need to tweak the filters. My regexp is poor so they are very crude, and could easily screw up some sites.
bgx said:
Yes google mobile site everytime I would like to search something I get this Error:
This page contains the following errors:
error on line 3 at colum 31: AttValue: " or ' expected
Reparse document as HTML
Click to expand...
Click to collapse
Can you tell me the specific URL? I notice you're on T-Mobile so maybe you have a carrier-specific browser/search settings.
eitama said:
I know regexp pretty well, but Privoxy syntax is a little bit confusing.
I'm trying to figure out the filters supplied by the OP, and they are just too confusing
To OP : How do you set the delimiter for the filters in Privoxy?
I know / and | are possible, are you using + for some reason?
All your filters start with s+, what is the + ?
Click to expand...
Click to collapse
Privoxy syntax is supposed to be like Perl -- well I don't know Perl so I'm just copying what I read. The basic reference is here: http://www.privoxy.org/user-manual/filter-file.html
In my filters, I'm using + as the delimiter. In Privoxy you can use whatever delimiter you want, and it doesn't make a difference (I think). I just copied the + from another filter set -- probably because it's easier to read than / when working with HTML.
The first couple of filters should not be too hard to figure out. For example:
Code:
# Set default colors
s+<body+<body bgcolor=black text=LightGray link=LimeGreen vlink=Green+isUg
This just makes sure every <body> tag starts with "<body bgcolor=black text=LightGray link=LimeGreen vlink=Green" (very crude, I know). The isUg at the end are the modifiers:
i = case insensitive matching
s = allow string to span multiple lines
U = ungreedy matching
g = global matching
Two filters substitute a tag with "JED-C-Anchor-color". This is not a valid tag; the browser will just skip it so the effect is basically the same as deleting the tag. Substituting instead of deleting just makes debugging easier. I used "JED-C" because I modified these filters from http://members.cox.net/pu61ic.1inux.dunc4n/software/privoxy.jed
tamarian said:
But maybe changing CSS is easier. This method works on Opera Mobile:
http://forum.xda-developers.com/showthread.php?t=1326434
Click to expand...
Click to collapse
Thanks for the tip! Yeah I know about changing CSS and that would be a better solution. But I don't think there is a way to change the CSS with the stock browser, and some people still like using the stock Samsung browser for hardware acceleration or whatever other reason. But maybe somebody could make a Privoxy filter that adds the same CSS code into all webpages?
I want my app (PerApp) to write to Settings.Secure on rooted devices, but without having the app to be installed in /system/app.
Any suggestions on how to do it?
One possibility is to launch a component of the app with root privileges via app_process, and then have the component with a static main() use reflection to access Settings.Secure. The latest version of my Force2SD does that successfully to access hidden functions of the packagemanager. However, the problem is that the standard API for Settings.Secure needs a Context, and I don't know how to gain a working Context for something that starts from the commandline with a static main().
I could include a sqlite3 binary, but I am concerned about the stability issued with writing directly to the settings database on the fly, and don't know if the OS will register the changes immediately. Moreover, loading a large binary like sqlite3 will slow things down.
This tutorial will show you how to setup your device as admin and configure other user profiles (this is important when you're not the owner). Your device maker disabled multiuser functionality in Kitkat, like on my Lenovo Tab 2 A10-70L? - then this for you. At least, that's where this procedure is tested on. Afaik, this should work on Lollipop too. But will it work for your device? - No clue, you tell us!
Basically it's an accumulation of what I've read here (thanks again) and my personal experience as a noob myself.
So far, this guide is incomplete and I'm hoping for some pro tipps to perfect it. Please help me sort out the unclear parts highlighted in red and I'll update this post accordingly. The sooner the better, because this actually is not my device and someday soon I'll have to pass it over to my mom since it's my present to her, I'm only setting this slab up...
Preconditions:
Android treats the first account created as "owner". Only owner will have root privileges if installed accordingly (=admin).
Root permission and a file manager (e.g. ES File Explorer) are required for this fix so go get that first. For the Lenovo Tab 2 A10-70L, I followed this beautiful guide, besides that, I can't help much here.
Unable/uninstall all bloatware (I was adventurous with Titanium Backup with no probs so far, but some crap remained from looking at new user folders; still in search of a vendor/device-specific "save to remove" list)
Install ALL apps you and the other users suppesdly need. This will avoid the need to redownload and reinstall all the apps for each and every user wasting storage. Think thrice, usually it'll be more than desired, but better you do it instead of a DAU... Each user will be able to install apps later though. Full control over user restrictions can be applied for "guest profile" only.
Steps:
In file explorer, go to /system/ and open build.prop
Check if you have anything like the below text (you shouldn't, otherwise edit accordingly) and add these lines at the end of it:
Code:
# Multi Users
fw.max_users=[COLOR="DarkGreen"]X[/COLOR]
fw.show_multiuserui=1
Replace X with your desired digit (up to 7?)
(I've read somewhere that 7 users is maximum that system can handle, but I haven't tried)
Save, reboot and log in as "owner" (your profile)
Go to Settings>Device and say hello to new item "Users"
Create new users and/or a guest profile (important: write down the order in which you created them!)
All new user profiles are now shown as "new user" no matter what you wrote in the profile properties (only guest will be shown as "guest"). Mind you, this also applies for the lockscreen!
In file explorer, go to /data/system/users/ to find your users' folders containing some system files (what exactly?) Now guess what - the order of the numbered folders and #.xml files match the order you created them. "0" is you, the owner.
Open each .xml file and replace "Owner" with "Your Name" and "New user" with "Username"
Put the device to sleep, trigger lockscreen and log in to each user profile and
Pull down shortcut menu from top right and enable autorotate
Go to Settings>Users>Security, check all settings and note each unlock-code
Disable background services like sync, location, etc. that could potentionally drain battery where applicable
Rinse & repeat 8) for all new profiles
Install "Multi-User App Share" and set apps per user. (Or is there a newer app or more hackish approach without the need for xposed or compiling stuff etc.?)
= DONE =
If you want the user icon in status bar, follow http://forum.xda-developers.com/gal...-users-mod-t3017782/post58659868#post58659868 (haven't tried that ).
Well... build.prop fixes are working, at least for me. It's good alternative to multi-user app from Xposed (we don't want to use Xposed too much...).
Still tried with decompiling & compiling framework for fixing icon problem, and... in framework-res there is not status_bar_expanded_header.xml file, se we are in deep ****.
I am working on: LP
DISCLAIMER:
It is extremely illegal to use this app against networks you don't own or don't have a permission to attack. I am not responsible for how you use it and any damage you may cause. Consider yourself warned.
Hijacker is a Graphical User Interface for the wireless auditing tools airodump-ng, aireplay-ng and mdk3. It offers a simple and easy UI to use these tools without typing commands in a console and copy&pasting MAC addresses.
This application requires an android device with a wireless adapter that supports Monitor Mode. A few android devices do, but none of them natively. This means that you will need a custom firmware. Nexus 5 and any other device that uses the BCM4339 (and BCM4358 (although injection is not yet supported so no aireplay or mdk)) chipset will work with Nexmon. Also, devices that use BCM4330 can use bcmon.
The required tools are included in the app. To install them go to Settings and click "Install Tools". This will install everything in the directory you select. If you have already installed them, you don't have to do anything. You can also have them at any directory you want and set the directories in Settings, though this might cause the wireless tools not being found. The Nexmon driver and management utility is also included.
Root is also necessary, as these tools need root to work. If you don't grant root permissions to it, it hangs... for some reason... don't know why...
Features:
View a list of access points and stations (clients) around you (even hidden ones)
View the activity of a network (by measuring beacons and data packets) and its clients
Deauthenticate all the clients of a network
Deauthenticate a specific client from the network it's connected
MDK3 Beacon Flooding
MDK3 Authentication DoS for a specific network or to everyone
Try to get a WPA handshake or gather IVs to crack a WEP network
Statistics about access points (only encryption for now)
See the manufacturer of a device (AP or station) from a OUI database (pulled from IEEE)
See the signal power of devices and filter the ones that are closer to you
Leave the app running in the background, optionally with a notification
Copy commands or MAC addresses to clipboard, so you can run them in a terminal if something goes wrong
Include the tools
Reaver WPS cracking (pixie-dust attack using NetHunter chroot)
.cap files cracking with custom wordlist
Let the user create custom commands to be ran on an access point or a client with one click.
Installation:
Make sure:
you are on Android 5+
you are rooted. SuperSU is required. If you are on CM, install SuperSU
have installed busybox (opened and installed the tools)
have a firmware to support Monitor Mode on your wireless interface
Download the latest version here.
When you run Hijacker for the first time, you will be asked whether you want to set up the tools or go to home screen. If you have installed your firmware and all the tools, you can just go to the home screen. Otherwise, click set up to install the tools. You can change the directories in which they will be installed, but I recommend that you leave them unchanged. The app will check what directories are available and select the best for you. Keep in mind that on some devices, installing files in /system might trigger an Android security feature and your system partition will be restored when you reboot. After installing the tools and the firmware (only Nexmon) you will land on the home screen and airodump will start. If you don't see any networks, make sure you have enabled your WiFi and it's in monitor mode. If you have a problem, go to settings and click "Test Tools". If they all pass, you probably don't have monitor mode enabled. If something fails, click "Copy test command" and select the tool that fails. A sample command will be copied to your clipboard so you can open a terminal, run it, and see what's wrong.
Keep in mind that Hijacker is just a GUI for these tools. The way it runs the tools is fairly simple, and if all the tests pass and you are in monitor mode, then you should be getting the results you want. But also keep in mind that these are AUDITING tools. This means that they are used to TEST the integrity of your network, so there is a chance (and you should hope for it) that the attacks don't work on a network. It's not the app's fault, it's actually something to be happy about (given that this means that your network is safe). However, if an attack works when you type a command in a terminal, but not with the app, feel free to post here to resolve the issue. This app is still under development so bugs are to be expected.
Troubleshooting:
First of all, if the app happens to crash at a random time, run it again and close it properly. This is to make sure that there are not any tools still running in the background, as this can cause battery drain. If it crashes during startup or exiting, open a terminal, run `ps | busybox grep -e air -e mdk` and kill the processes you see.
Most of the problems arise from the binaries not being installed (correctly or at all). If that's the case, go to settings, click "install tools", choose directories for binaries and the lib (libfakeioctl.so) and click install. If the directory for your binaries is included in PATH, then you don't have to do anything else. If it's not, the you need to adjust the absolute paths of the binaries, right below the "install tools" option. This might also cause problems (especially with mdk) since these programs require the wireless tools to be installed, and they won't find them if you install them anywhere other than the paths included in your PATH variable. If you don't know what the PATH variable is, then you probably shouldn't be using any of these programs.
If you are certain that there is problem with the app itself and not the tools installation, open an issue here so I can fix it. Make sure to include precise steps to reproduce the problem and a logcat (having the logcat messages options enabled in settings). If the app happens to crash, a new activity should start which will generate a report in /sdcard and give you the option to email it to me directly. I suggest you do that, and if you are worried about what will be sent you can check it out yourself, it's just a txt file and it will be sent as an email attachment to me.
XDA:DevDB Information
Hijacker, App for all devices (see above for details)
Contributors
chrisk44
Source Code: https://github.com/chrisk44/Hijacker
Version Information
Status: Testing
Current Stable Version: v1-RC.4
Stable Release Date: 2016-12-23
Created 2016-11-14
Last Updated 2016-12-26
Reserved
thank you
works great on my nexus 5 and note 3
not working on s6 edge problem i dont know i already installed in my device correctly and also hijacker airdump shows networks for attacking but not do real attack