[Security Discussion] unclefab:
@ Primokorn:

oh, strange, that line break must have come when I copied the script, sorry about that, I go edit OP.

Funny that an error in the script can paralyse su access, good to know!

[MENTION=4546136]silentvisitor[/MENTION]:

you know, anyone can learn that, one only needs some time and patience...

Yep, true, the addresses I put in OP are only addresses I hadn't found in the host files I checked.

I didn't copy my whole host file here since it's pretty long and since posts are limited in length.

Some host files weight as much as 15 mb, and it could definitely speed down devices with low specs.

To avoid this, and since one probably doesn't need such a big file, one can use a lighter file (mine weights about 750 kb) and make use of Network Log, as explained in OP, to manually block addresses specific to one's device.

Oh yeah, just now I remember of another app called Block it!, I add it to OP.

Talking about OP, here are the latest additions I put in there :

There's an apk called "Block it!" that can help you find host names for some stubborn web sites that can't be blocked using their IP, and whose host name can't be found otherwise AFAIK (like apis.google.com, ajax.googleapis.com, www.googletagservices.com, fonts.googleapis.com, google-public-dns-a.google.com, just to name a few that I found thanks to Block it!).

Here's another init.d script done with Pimp My Rom app (credits [MENTION=4752917]Androguide.fr[/MENTION]), to protect your phone from various MIM (Man In The Middle) attacks :

#!/system/bin/sh

### Pimp my Rom : Block Redirects

busybox sysctl -e -w net.ipv4.conf.all.accept_redirects=0;

busybox sysctl -e -w net.ipv4.conf.default.accept_redirects=0;

busybox sysctl -e -w net.ipv4.conf.all.secure_redirects=0;

busybox sysctl -e -w net.ipv4.conf.default.secure_redirects=0;

### Pimp my Rom : Block Source-Routing

busybox sysctl -e -w net.ipv4.conf.default.accept_source_route=0;

busybox sysctl -e -w net.ipv4.conf.all.accept_source_route=0;

### Pimp my Rom : IPv4 Tweaks

busybox sysctl -e -w net.ipv4.tcp_timestamps=0;

busybox sysctl -e -w net.ipv4.tcp_sack=1;

busybox sysctl -e -w net.ipv4.tcp_fack=1;

busybox sysctl -e -w net.ipv4.tcp_congestion_control=cubic;

busybox sysctl -e -w net.ipv4.tcp_window_scaling=1;

### Pimp my Rom : Avoid Time-Wait

busybox sysctl -e -w net.ipv4.tcp_tw_recycle=1;

busybox sysctl -e -w net.ipv4.tcp_tw_reuse=1;

### Pimp my Rom : Protection against SYN Attacks

busybox sysctl -e -w net.ipv4.tcp_syncookies=1;

busybox sysctl -e -w net.ipv4.conf.all.rp_filter=1;

busybox sysctl -e -w net.ipv4.conf.default.rp_filter=1;

busybox sysctl -e -w net.ipv4.tcp_synack_retries=2;

busybox sysctl -e -w net.ipv4.tcp_syn_retries=2;

busybox sysctl -e -w net.ipv4.tcp_max_syn_backlog=1024;

busybox sysctl -e -w net.ipv4.tcp_max_tw_buckets=16384;

busybox sysctl -e -w net.ipv4.icmp_echo_ignore_all=1;

busybox sysctl -e -w net.ipv4.icmp_ignore_bogus_error_responses=1;

busybox sysctl -e -w net.ipv4.tcp_no_metrics_save=1;

busybox sysctl -e -w net.ipv4.tcp_fin_timeout=15;

busybox sysctl -e -w net.ipv4.tcp_keepalive_intvl=30;

busybox sysctl -e -w net.ipv4.tcp_keepalive_probes=5;

busybox sysctl -e -w net.ipv4.tcp_keepalive_time=1800;

busybox sysctl -e -w net.ipv4.ip_forward=0;

CREDITS AND THANKS​

[MENTION=4419114]rovo89[/MENTION] for Xposed, respect! [MENTION=2799345]M66B[/MENTION] for the Xprivacy, respect!

[MENTION=4322181]Tungstwenty[/MENTION] for App Settings, Master Key Dual Fix and Fake ID Fix, respect! [MENTION=631273]Chainfire[/MENTION] for Super Su, respect!

[MENTION=3249429]ukanth[/MENTION] for AF+Firewall, respect! [MENTION=4376588]oasisfeng[/MENTION] for Greenify, respect!

[MENTION=600147]THE[/MENTION] Tor Project Team, respect! [MENTION=3237562]f-droid[/MENTION], respect! [MENTION=535343]all[/MENTION] the XDA people writing tutorials and sharing their knowledge, respect!

Did I forget anyone? If that's the case be insured that it was absolutely unintentionnal, send me a PM and I'll fix it...

Last but not least, all those guys have spent days, if not weeks or even months, coding, writing, tweaking, modding, in a word working, for us to enjoy better security on our devices.

They did it for free, in a materialistic, greedy and selfish world where gratuitousness and altruism are an oddity, so the least we can do is to support them.

Please consider sending them a donation, or buying the pro version/license of their apps, we are talking about a few dollars which is not much compared to what they have given, are giving, and will give to us.

Remember that we are nothing, or let's say not much, without them!!!

Thanks in advance for them..

LINKS​

http://repo.xposed.info/module/de.robv.android.xposed.installer

http://repo.xposed.info/module/biz.bokhorst.xprivacy

https://github.com/M66B/XPrivacy#xprivacy

http://repo.xposed.info/module/de.robv.android.xposed.mods.appsettings

http://repo.xposed.info/module/tungstwenty.xposed.masterkeydualfix

http://repo.xposed.info/module/tungstwenty.xposed.fakeidfix

http://xdaforums.com/apps/greenify

https://f-droid.org/repository/browse/?fdfilter=af&fdid=dev.ukanth.ufirewall

https://github.com/ukanth/afwall

https://f-droid.org/repository/browse/?fdfilter=network+log&fdid=com.googlecode.networklog

http://xdaforums.com/apps/greenify

https://www.torproject.org/

https://blog.torproject.org/

https://guardianproject.info/

https://prism-break.org/en/