Adblock hosts for Firefox OS - Firefox OS General

I recently bought a ZTE Open C and was surprised there's no adblocker (shame on you mozilla!). Since I'm using AdAway (available from F-Droid store) on my Android Tablet I simply extracted those hosts file and put it on my ZTE Open C - et voila: it works, much less ads while browsing now. [tested on an modified CAF build I found somewhere else]
Following sources used:
Code:
# http://adaway.org/hosts.txt
# http://hosts-file.net/ad_servers.asp
# http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext
# http://winhelp2002.mvps.org/hosts.txt
Instructions for setup on GNU/Linux (I'm not responsible if adb kills kittens or if your fridge explodes):
1. Download hosts file here
2. Enable ADB: Settings > Developer > USB Debugging > ADB
3. Connect device to PC
4. Setup
Code:
adb root ### run adb as root
adb shell ### open shell on ZTE Open C
mount -o rw,remount / ### remount root partition read-write
mount -o rw,remount /system ### remount system partition read-write
exit ### return to PC shell
adb push /path/to/my/hosts /hosts ### copy hosts file to ZTE Open C
adb shell ### back to ZTE Open C shell
cat /hosts > /system/etc/hosts ### write AdAway hosts to system hosts
rm /hosts ### remove no longer required temporay hosts file
exit ### back to PC
adb reboot ### restart phone to make changes take effect
Suggestions welcome.

Thank you very much. I didn't think about that solution to avoid ads on FFOS.
Do you know an elegant way to update the hosts from time to time (like with adway on android)
without adding double entries?

Related

CIFS / Windows file share module

Through sheer geekitude, I've compiled a custom cifs / windows file sharing kernel module which I'll make available here. This is specifically geared toward rooted CDMA Heros using stock HTC software or the MoDaCo ROM.
First let me lay this out there:
This is not for the feint of heart, does not currently have any automated methods, is not really all that useful in it's current state, and requires your phone to be rooted.
One of the beautiful things about open source, however, is once the tools are available, someone will (hopefully) make it useful. Right now, it's very 'command line' oriented.
What this allows you to do:
Mount Windows / SMB / CIFS fileshares on your Hero, which can be accessed via a file browser such as Astro or Linda file managers.
Copy files to/from your Hero to your PC via these shares.
What this does not allow you to do (currently):
Allow you to stream music / video / images from your PC through the default music player.
The Guide:
Download the attached cifs-module.zip file, extract it somewhere on your PC.
Connect your phone via USB. Run:
Code:
./adb shell
$ su (if you're not already root)
#
If your /system partition isn't already mounted read/write, you'll need to remount it inside the shell:
Code:
# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
Change the permissions of the modules folder to allow you to push in the module (again, you should be in the adb shell):
Code:
# chmod 777 /system
# chmod 777 /system/lib
# chmod 777 /system/lib/modules
# exit
$ exit
Now, back at your command prompt, push the kernel module you just downloaded and extracted:
Code:
./adb push cifs.ko /system/lib/modules/cifs.ko
Back into the shell to load it in, reset the permissions, and mount your fileshare.
First, load the module (and fix the /system permissions):
Code:
./adb shell
$ su
# insmod /system/lib/modules/cifs.ko
# chmod 775 /system
# chmod 775 /system/lib
# chmod 775 /system/lib/modules
Congrats so far! You've just loaded in a kernel module! Now to actually use it. You'll want to be connected to your network via WiFi, and have an accessible file share to mount.
Make a folder where you'll mount the share:
Code:
# mkdir /system/remote
Next, mount the share. The username, password, and share name will of course be the info for your local fileshare. The IP I'm using here is just an example, you'll want to use the IP of the PC where your fileshare is located:
Code:
# mount -t cifs -o username=yourusername,password=yourpassword //192.168.1.20/sharename /system/remote
If that goes off without a hitch, you're done! You've successfully mounted a fileshare from your PC to your phone. You can verify by taking a look at the contents:
Code:
# cd /system/remote
# ls
<you should see your list of shared files>
You can also at this point use an app on your phone like Asrto or Linda file manager to browse to this /system/remote folder and copy files to/from your PC!
Again, this is very raw, only tested on my own phone so far, and will really only allow you to copy files to/from your PC. I was able to play a couple of MP3s via Astro, but unfortunately the stock music player can't access the /system or /data folders on your phone, and because your /sdcard is a fat32 filesystem, you cannot mount other filesystems there unfortunately.
If someone knows a good way to get the stock apps reading from the share, please share.
The module is rather large as well, ~ 2.9mb. If anyone can give me some tips on optimizing the module for size, that'd be great - This is the first ARM modules I've ever built, and did so using a cross-compiler, I'm not sure of all the little tricks of the trade yet.
Enjoy!
You might have more luck if you run an ext3/4 fs on the sd card, although I am not sure if that would work.
I tried the above steps on a nexus one running cyanogen mod 5.0.6 and the insmod command failed with a execute error.
Im guessing the model is not build for an ARM v7 chip?!
What were you steps in building the module? I would be keen on trying it myself.
I dropped development on this ages ago as there are far better options available for CIFS/Samba sharing.
Try out EStrong's File Explorer from the market, has a much more usable implementation of LAN file sharing built right in.
I followed these step in order to copy my cifs.ko to modules dir but I get an "out of memory" error when trying to copy the file to the modules dir
any hint?

Velocity Cruz Tablet Bloatware Removal (ADB Method)

How to Remove Bloatware from the Velocity Cruz Tablet
Downloads and Setup
Unfortunately, I can't post links in the forum (yet!). For the links to these sources, check out my post with the same title on the Slatedroid Forum...If someone with link posting privileges would be willing to add the links below, I would greatly appreciate it.
1] Download and install the ADB drivers on your device from the Velocity Micro support site. Detailed instructions are available on their site.
2] Download and install the Android SDK on your computer.
3] Connect your Tablet to your computer via the USB cable and mount the device
4] Open your SDK directory on your desktop computer and navigate to the tools directory
5] Write down or copy the directory path to this tools directory (you will use it again below!)
Remove the Bloat
6] For Windows users, select Run from your Start menu
7] Type cmd.exe in the text field and click ok
8] At the command line, use the following series of commands:
cd C:\xxx\android-sdk-windows\tools (where the xxx is the path to your SDK directory)
adb shell (you should see a # sign after this)
cd /system/app (this changes your directory to the app directory on the Tablet where the apk's are located)
ls (optional: will allow you to view all of the apk's that are installed so that you know what to remove)
mount -o remount,rw /system (provide yourself with write permission on the system directory to remove files)
Then for each of the apk files that you want to remove, type:
rm /system/app/filename.apk (replace filename with the actual name of the file)
You can change the system directory permission back to read only with the following command if you would like:
mount -o remount,r /system
Copy and Paste
>cd C:\xxx\android-sdk-windows\tools
>adb shell
# cd /system/app
#ls
#mount -o remount,rw /system
#rm /system/app/filename.apk
#mount -o remount,r /system

[HOWTO] Run startup scripts using Chulri's rw root

I couldn't run scripts in init.d, and it took me a while to figure this out, so I'm sharing. There is more than one way to do this.
Step 1. Install chulri's rw root.
Step 2. Create a script directory and a runall script to run all the scripts in a given directory. To do that, you can type the following in an adb shell:
Code:
su
mkdir /data/local/bootscript
chmod 755 /data/local/bootscript
cd /data/local/bootscript
cat > runall
#!/bin/sh
for x in /data/local/bootscript/*.sh ; do /bin/sh $x ; done
(You can copy and paste that into a DOS window running adb.) Now press ctrl-d, enter. Then continue:
Code:
chmod 755 runall
Step 3. Edit /init.rc. You can do that on-device with vi and ssh, or you can install an editor that preserves Linux line-endings on your desktop (I use CONTEXT). I'll assume you're doing this with adb. So on the desktop do:
Code:
adb pull /init.rc init.rc
Now, edit init.rc on the PC, and to the section listing all the services, add:
Code:
service bootscript /data/local/bootscript/runall
enabled
oneshot
Then put it back on the device:
Code:
adb push init.rc /tmp
adb shell
su
mv /tmp/init.rc /
Step 4. Now you can put whatever scripts you want to run in /data/local/bootscript. Just make sure you they have a .sh extension. All scripts will be run with /bin/sh and there is no need to specify #!/bin/sh . Also, there is no need to chmod the scripts to render them executable. You can just copy scripts in.
To disable a script, just change its .sh extension to .disabled.
There are, of course, other ways of doing this.
great tutorial!

Ad Blocking on ZTE Open

Until there are ad blocking apps for FFOS it needs a DIY method.
I'll assume you know how to use adb and have it set up on your machine. I'll also assume you have rooted your phone following the instructions here.
I use Linux so my commands may be a bit off in places.
1. Collect a suitable hosts file. I used the one on my Android phone but this one seems to update regularly http://winhelp2002.mvps.org/hosts.txt
2. Save the file as 'hosts' to a known location on your PC.
3. Open a shell window (command window) on your PC and check adb works.
Code:
adb devices
should return roamer2. If not, on your phone, go to settings > More Information > Developer - and check Remote Debugging.
4. In the shell window - change directory to where you have saved the hosts file. then type:-
Code:
adb push hosts /sdcard/
5. When that completes type:-
Code:
adb shell
you'll see $ prompt
Code:
su
If you are rooted correctly you'll see # prompt
Code:
mount -o remount,rw /system
Mounts the system folder for read / write permissions.
Code:
cat /system/etc/hosts
Should show just '127.0.0.1 localhost'
Save this if you want as hosts.old
Code:
busybox mv /system/etc/hosts /system/etc/hosts.old
Now replace the hosts file with the new one:-
Code:
busybox mv /sdcard/hosts /system/etc/hosts
To check your hosts file has been replaced type
Code:
cat /system/etc/hosts
And lots of domain names will whiz past.
All done.

[TRICK]Installing Google Dialer after towelroot

I spent a few minutes struggling to install Google Dialer after rooting my latest OTA note 3 with towelroot. Here's what I discovered worked (works for putting anything in the system folder):
Step 1: Install ADB on your computer, push tr.apk (towelroot) and install. Run towelroot, install busybox
Step 2: Open up two command prompts on your computer. In one, ADB shell and su. I will refer to this as "the su terminal" for now. Ignore the second for a bit.
Step 3: type "mount | grep system" and extract the first bit:
Code:
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,seclabel,relatime,
data=ordered 0 0
The important part is the first section, /dev/block/platform/msm_sdcc.1/by-name/system. Also notice that it is mounted as RO, read only.
Step 4: type the following, replacing the /dev/... line with your own from above (maybe the same, idk)
Code:
# mount -o rw,remount /dev/block/platform/msm_sdcc.1/by-name/system
Step 5: Confirm it worked by running mount | grep system again:
Code:
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 rw,seclabel,relatime,
data=ordered 0 0
Note that it is now RW.
Now we run into an issue, if you go to your second terminal and try to use ADB to push to system it still says read only. If you go to adb and try to adb root it says disabled for production builds. If you go into an app such as ES file manager, it still says read only. I also tried pushing the file to the sd card and using MV to move it while in a su shell, but that didn't work either (error about cross device something or other)
However... I found a workaround.
Step 6: On the second terminal, use adb to push your file to somewhere on your sd card, in my case, /storage/emulated/legacy/ worked.
Step 7: on the second terminal, adb shell and su.
Step 8: On the first terminal cd /system/priv-app/ (or any folder where you need to write something)
Step 8.?: On the second terminal cd /storage/emulated/legacy/
Step 9: Run the following commands
First terminal:
Code:
nc -l -p 1234 > com.google.android.dialer-1.1.apk
Second Terminal:
Code:
nc localhost 1234 < com.google.android.dialer-1.1.apk
Finally, on the first terminal, chmod 777 com.google.android.dialer-1.1.apk, and install by tapping within ES file manager or similar, then adb reboot.
You will need to use a tool to create a shortcut for the application, it does not get one this way.
You now have the google dialer installed on your Verizon Note 3, rooted with TowelRoot.
Trick can be used to push to the system folder without adb root or adb remount working.
Enjoy!

Categories

Resources