• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[MOD][XPOSED][4.0+] PeerBlock For Android - Block Ads, Goverment and more[10-08-2013]

Search This thread

DragonHunt3r

Senior Member
Aug 1, 2012
341
505
PeerBlock is now available in the Google Play Store! https://play.google.com/store/apps/details?id=com.peerblock

3NNjQ.png
PeerBlock For Android lets you control who your phone 'talks to' on the Internet.
By selecting appropriate lists of 'known bad' computers, you can block communication with advertising or spyware oriented servers,
computers monitoring your p2p activities, computers which have been 'hacked', even entire countries!
They can't get in to your phone, and your phone won't try to send them anything either.

And best of all, it's free!

Keep in mind that I'm not a member of the PeerBlock team, I just wanted PeerBlock for phone
You're able to grab the lists from iblocklist.com so you can start blocking those evil hosts
To add lists to PeerBlock create a new directory in the root of the sdcard (not external sdcard)
Called 'PeerBlockLists' here should be all the text files
Everytime you added a new/updated list to your PeerBlockLists please press the 'Rebuild cache blocklist' and reboot so that new hosts can be blocked

WARNING:
Root is required for XPosed to be installed
Use at your own risk!
WORK IN PROGRESS. WILL EAT YOUR CAT.
MOD EDIT : WARNING - Read entire thread before use, as well as comments on play store.

Features:
  • Block million of hosts
  • Add unlimited amount of block lists
  • Allow HTTP/HTTPS Traffic when PeerBlock is enabled, this will make a security hole tho so better if u keep it off
  • Block All Traffic (Paranoid Mode) every single application in android will not have internet
  • Block DNS - Block DNS Requests
  • Block the 'Ad' Keyword in host names to give a better success rate for blocking ad's

Permissions
  • WRITE_EXTERNAL_STORAGE

Todo's
  • Check if UDP is getting blocked
  • Remove space used by Ad's
  • Add MAC-Address filter white/black lists
  • Show notifications (if enabled)
  • Making the Ip Range check multi-core
  • Create a blacklist/whitelist for apps to allow internet
  • Blocklist updater/downloader
  • Create a whitelist for hosts/Ip Addresses
  • Root-Mode with IpTables (I will not remove XPosed from the project)
  • Remove host from blocked hosts
  • A popup window which shows allow/deny for establishing a connection

Todo's Finished
  • Create history of created/blocked connections
  • Check if other devices are compatible
  • Blocklist for keywords in the HostName

How To Install
1. Install XPosed Framework
2. Install PeerBlock For Android
3. Create a directory in the sdcard called "PeerBlockLists"
4. Go into XPosed Framework Installer and enable "PeerBlock For Android"
5. Reboot your device
6. Now go to the website iblocklist.com
7. Take any list you wish for example, http://www.iblocklist.com/list.php?list=bt_ads
8. Press the Update button to download the list (or copy the Update URL into your browser to download it)
9. Now simply copy/paste the .txt file into the sdcard in the folder PeerBlockLists
10. Go into the PeerBlock app and tick "Block DNS" and "Block 'Ad' Keyword in the Host name"
11. Go to the second tab "Block Lists" now hit the "Rebuild cache blocklist"
12. Reboot your device and enjoy ;)

How to block the goverment
1. Go to your sdcard and open the folder 'PeerBlock'
2. Open the file HostNames.txt (if not exist create it)
3. Write this in the file ".gov"
4. Save the file and be sure you have Block DNS enabled!
5. Any goverment website should be blocked

ChangeLog
1.00: Initial creation and upload of the app
1.01: Fixed App crash when PeerBlockLists directory did not exist
1.02: Changed the required API SDK to 14, Added a progress window for rebuilding the cache and some minor bug fixes
1.03:
Fixed DNS/Connection counters
Fixed double icons
Memory leak fix
Added history, system apps included (no root required)
Created CSV Format for saving settings
Improved performance
Apps with abnormal I/O behavior will get no internet
Updated error handling in rebuilding the cache list
Block hosts/subnet/ip from the history
App will be shown now in the 'Last Blocked Host'
Added comma's at the 'Blocking xx Ips' to read it better
Hooking a extra API if some rooted apps are calling it directly
Added to changelogs and about scrollbars

Scripts people made:

oa3.png

clk.png
5o9.png
ro60.png


Tell your opinion, Share the bugs you find.

How to download:
Find PeerBlock in the google play store by simply searching for "PeerBlock" or "PeerBlock for Android" or click this link https://play.google.com/store/apps/details?id=com.peerblock

I removed downloads from the attachments so people need to grab it from the play store as it will give me all the error reports and total downloads
If the above methods for downloading don't work please contact me

Question's and Answers
Question: Can I use this together with adaway ?
Answer: Yes you can.

Question: Does PeerBlock modifies the hosts file?
Answer: No it does not.

Question: Why does nothing gets blocked?
Answer: Most likely you disabled the option "Block DNS"

Source code: https://github.com/AnguisCaptor/PeerBlockForAndroid

Contact
If you want to contact me for anything or just a chat you can add me at skype using this e-mail or just e-mail me, [email protected]
 

Attachments

  • bt_ads.txt
    132.2 KB · Views: 10,555
  • PeerBlockForAndroid1.03.apk
    603.9 KB · Views: 15,228
Last edited:

danlivesey

Senior Member
Dec 5, 2010
629
135
blackburn
Nice work, I've been looking for this for ages. I always use xposed for other stuff. I've just installed peer blocker and it's force closing and I can't get into the app. I'm on 4.2.2 Xperia z custom stock Rom as I can unlock my bootloader.

Sent from my C6603 using xda premium
 

DragonHunt3r

Senior Member
Aug 1, 2012
341
505
Nice work, I've been looking for this for ages. I always use xposed for other stuff. I've just installed peer blocker and it's force closing and I can't get into the app. I'm on 4.2.2 Xperia z custom stock Rom as I can unlock my bootloader.

Sent from my C6603 using xda premium
Can you take a look at your internal/external sdcard and see if a file exists called "PeerBlock.dbx"
I've only tested my app at the Galaxy S4 since that's the only device I own
Also try to start it a bunch of times and see if that helps
Also don't forget to enable PeerBlock in the XPosed Installer and reboot
 
Last edited:

danlivesey

Senior Member
Dec 5, 2010
629
135
blackburn
Yes sorry my mistake, I didn't add the folder. The app is running now. Just need to add some lists now. How do we know if it's blocking the list? On the pc peer block it shows a list of what's being blocked. Thanks

Sent from my C6603 using xda premium
 

DragonHunt3r

Senior Member
Aug 1, 2012
341
505
Yes sorry my mistake, I didn't add the folder. The app is running now. Just need to add some lists now. How do we know if it's blocking the list? On the pc peer block it shows a list of what's being blocked. Thanks

Sent from my C6603 using xda premium
Currently in the app it only shows the last host that's being blocked
Will add soon something like a history list so u can see everything that been blocked

Edit: Uploaded version 1.01 which includes bug fix for not creating the PeerBlockLists directory
 
Last edited:
  • Like
Reactions: danlivesey

jwthompson

Senior Member
May 24, 2010
169
79
Parse error on Verizon Samsung S3 4.1.2 VRBMF1 Jelly"Beans" rom

Sent from my SCH-I535 using Tapatalk 4 Beta
 

lopezk38

Senior Member
Apr 20, 2013
293
87
San Diego
The app appears to run on a Nexus 4, but I can't get the website to download the blocklists on my computer or my phone so I can't really test it.
 

danlivesey

Senior Member
Dec 5, 2010
629
135
blackburn
I've installed the list now rebuilt and rebooted, will test it better when I get home form work.

Sent from my C6603 using xda premium
 

danlivesey

Senior Member
Dec 5, 2010
629
135
blackburn
I get the odd force close now again but no big deal. Paranoid mode won't work for me, all my apps still have internet. Just hope it is blocking the lists, it does say it's blocking over 70 000. keep up the good work.

Sent from my C6603 using xda premium
 

Looki75

Senior Member
Apr 1, 2010
1,708
1,444
No worries folks will look into it in like 1-2 hours :)
Was gonna work at the app the whole night anyway
Please report all the bugs u can find
Please add me in skype, [email protected] so u can get versions quicker

Thanks! The thing with JB 4.1.2, is that your module cannot be installed at all.
When trying to install, it says "error while analyzing the package" or similar...

I don't know ANYTHING to java or programming on Android, so I don't know for sure, but it looks like you declared the app as compatible only with 4.2.2, or it uses libraries exclusive to 4.2.2 or something like that...

Since my ROM is unrooted (company policy), I cannot use any of "ad blocking" apps like adaway which require root in order to write the hosts file...

But my ROM has Xposed cooked in it... so I am very excited by your module!!!! :D:D:D

Thanks! Waiting for it!!! ;):D
 

DragonHunt3r

Senior Member
Aug 1, 2012
341
505
Thanks! The thing with JB 4.1.2, is that your module cannot be installed at all.
When trying to install, it says "error while analyzing the package" or similar...

I don't know ANYTHING to java or programming on Android, so I don't know for sure, but it looks like you declared the app as compatible only with 4.2.2, or it uses libraries exclusive to 4.2.2 or something like that...

Since my ROM is unrooted (company policy), I cannot use any of "ad blocking" apps like adaway which require root in order to write the hosts file...

But my ROM has Xposed cooked in it... so I am very excited by your module!!!! :D:D:D

Thanks! Waiting for it!!! ;):D
XPosed installed and no root ? haha :D
I think I'm having the 4.1.2 working... well atleast it's working for my emulating android
Just wanna finish some progress window for creating cache and then I think I'll pm it to you for test ;)
PeerBlock has also been tested at the Galaxy S3 and worked
 
  • Like
Reactions: Looki75

DragonHunt3r

Senior Member
Aug 1, 2012
341
505
Version 1.02 is up, Havefun 4.1.2 users ;)
For people who already have 1.01 installed, please go to the sdcard and remove PeerBlock.dbx
U might will see strange chinese characters orsomething if u used it from version 1.0 or 1.01
Need to find a better way to store information, can't use SQL. SharedPerferences appearently those don't work for some reason in XPosed or I'm just using it wrong lol
 
  • Like
Reactions: badkill

badkill

Senior Member
Apr 17, 2011
525
367
México
www.google.com
Version 1.02 is up, Havefun 4.1.2 users ;)
For people who already have 1.01 installed, please go to the sdcard and remove PeerBlock.dbx
U might will see strange chinese characters orsomething if u used it from version 1.0 or 1.01
Need to find a better way to store information, can't use SQL. SharedPerferences appearently those don't work for some reason in XPosed or I'm just using it wrong lol

Thanks friend, I can finally test your module

I'm using adblock, I have to uninstall this app
 

Top Liked Posts

  • There are no posts matching your filters.
  • 73
    PeerBlock is now available in the Google Play Store! https://play.google.com/store/apps/details?id=com.peerblock

    3NNjQ.png
    PeerBlock For Android lets you control who your phone 'talks to' on the Internet.
    By selecting appropriate lists of 'known bad' computers, you can block communication with advertising or spyware oriented servers,
    computers monitoring your p2p activities, computers which have been 'hacked', even entire countries!
    They can't get in to your phone, and your phone won't try to send them anything either.

    And best of all, it's free!

    Keep in mind that I'm not a member of the PeerBlock team, I just wanted PeerBlock for phone
    You're able to grab the lists from iblocklist.com so you can start blocking those evil hosts
    To add lists to PeerBlock create a new directory in the root of the sdcard (not external sdcard)
    Called 'PeerBlockLists' here should be all the text files
    Everytime you added a new/updated list to your PeerBlockLists please press the 'Rebuild cache blocklist' and reboot so that new hosts can be blocked

    WARNING:
    Root is required for XPosed to be installed
    Use at your own risk!
    WORK IN PROGRESS. WILL EAT YOUR CAT.
    MOD EDIT : WARNING - Read entire thread before use, as well as comments on play store.

    Features:
    • Block million of hosts
    • Add unlimited amount of block lists
    • Allow HTTP/HTTPS Traffic when PeerBlock is enabled, this will make a security hole tho so better if u keep it off
    • Block All Traffic (Paranoid Mode) every single application in android will not have internet
    • Block DNS - Block DNS Requests
    • Block the 'Ad' Keyword in host names to give a better success rate for blocking ad's

    Permissions
    • WRITE_EXTERNAL_STORAGE

    Todo's
    • Check if UDP is getting blocked
    • Remove space used by Ad's
    • Add MAC-Address filter white/black lists
    • Show notifications (if enabled)
    • Making the Ip Range check multi-core
    • Create a blacklist/whitelist for apps to allow internet
    • Blocklist updater/downloader
    • Create a whitelist for hosts/Ip Addresses
    • Root-Mode with IpTables (I will not remove XPosed from the project)
    • Remove host from blocked hosts
    • A popup window which shows allow/deny for establishing a connection

    Todo's Finished
    • Create history of created/blocked connections
    • Check if other devices are compatible
    • Blocklist for keywords in the HostName

    How To Install
    1. Install XPosed Framework
    2. Install PeerBlock For Android
    3. Create a directory in the sdcard called "PeerBlockLists"
    4. Go into XPosed Framework Installer and enable "PeerBlock For Android"
    5. Reboot your device
    6. Now go to the website iblocklist.com
    7. Take any list you wish for example, http://www.iblocklist.com/list.php?list=bt_ads
    8. Press the Update button to download the list (or copy the Update URL into your browser to download it)
    9. Now simply copy/paste the .txt file into the sdcard in the folder PeerBlockLists
    10. Go into the PeerBlock app and tick "Block DNS" and "Block 'Ad' Keyword in the Host name"
    11. Go to the second tab "Block Lists" now hit the "Rebuild cache blocklist"
    12. Reboot your device and enjoy ;)

    How to block the goverment
    1. Go to your sdcard and open the folder 'PeerBlock'
    2. Open the file HostNames.txt (if not exist create it)
    3. Write this in the file ".gov"
    4. Save the file and be sure you have Block DNS enabled!
    5. Any goverment website should be blocked

    ChangeLog
    1.00: Initial creation and upload of the app
    1.01: Fixed App crash when PeerBlockLists directory did not exist
    1.02: Changed the required API SDK to 14, Added a progress window for rebuilding the cache and some minor bug fixes
    1.03:
    Fixed DNS/Connection counters
    Fixed double icons
    Memory leak fix
    Added history, system apps included (no root required)
    Created CSV Format for saving settings
    Improved performance
    Apps with abnormal I/O behavior will get no internet
    Updated error handling in rebuilding the cache list
    Block hosts/subnet/ip from the history
    App will be shown now in the 'Last Blocked Host'
    Added comma's at the 'Blocking xx Ips' to read it better
    Hooking a extra API if some rooted apps are calling it directly
    Added to changelogs and about scrollbars

    Scripts people made:

    oa3.png

    clk.png
    5o9.png
    ro60.png


    Tell your opinion, Share the bugs you find.

    How to download:
    Find PeerBlock in the google play store by simply searching for "PeerBlock" or "PeerBlock for Android" or click this link https://play.google.com/store/apps/details?id=com.peerblock

    I removed downloads from the attachments so people need to grab it from the play store as it will give me all the error reports and total downloads
    If the above methods for downloading don't work please contact me

    Question's and Answers
    Question: Can I use this together with adaway ?
    Answer: Yes you can.

    Question: Does PeerBlock modifies the hosts file?
    Answer: No it does not.

    Question: Why does nothing gets blocked?
    Answer: Most likely you disabled the option "Block DNS"

    Source code: https://github.com/AnguisCaptor/PeerBlockForAndroid

    Contact
    If you want to contact me for anything or just a chat you can add me at skype using this e-mail or just e-mail me, [email protected]
    7
    the per app log is great, maybe a background color variation for blocked vs allowed.

    I've got a 3.1 billion list, overhead seems negligible for both cpu and ram. I'd assume it breaks even on battery with as many blocked net transmissions there are.

    I'm not sure if it's handled the same way here as I haven't seen them in the history log yet, but afwall's iptables manager can block kernel net requests and apps running as pid 0 (root) so if that's already happening or possible then hell yeah.

    sent from the mobile thing
    Every single app in android is first getting through PeerBlock and seeing if the DNS or connection should be blocked or allowed
    Even rooted apps will go through this process, I need to fix some bug though when some apps are not allowed to access the storage
    Oh well currently working at the new UI :eek:
    New UI/features are not really implemented yet but oh well I'm getting there

    pwn8.png
    4m1w.png
    7
    FYI I'm working on a very stupid and simple script to download the lists, right now I'm using it to dl the files hourly. Would be nice if there was a function to reload the lists on file updates.

    I'll post the script later, use at own risk.

    =-=-=-=-=-=-=-=-= UPDATE =-=-=-=-=-=-=-=-=
    as promised, shotty code, and horrible stuff. ;)

    1. download the attachments
    2. remove the '.txt' extensions
    3. create a dir /sdcard/PeerTools or run the script in terminal via sh bl_updates.sh
    4. copy the list file you downloaded into /sdcard/PeerTools/
    5. execute bl_updates.sh
    6. insult coder as he didn't do much error handling and didn't take into account many things other than himself.

    --------------------------------------------------------------------

    Code:
    #!/system/bin/sh
    
    ###############################################################################
    #
    # bl_updates.sh
    # ------------
    # download iBlock list files, unzip, concatenate into single file.
    #
    ###############################################################################
    #
    # VERSION HISTORY (most recent first)
    # ---------------
    #
    VERSION = '1.0.0'  # <--- REMEMBER to update this variable too!
    #
    #
    # Version   Date            Author
    # -----------------------------------------------------------------------------
    # 1.0.0     2013-08-14      c0ns0le
    #               * Chg: fixed exclusions and variables
    # 0.0.1     2013-08-14      c0ns0le
    #               * New: Initial Coding
    # Fix    = Bug fix
    # New    = New functionality
    # Chg    = Change of existing functionality
    #
    ###############################################################################
    
    PeerBlockLists=/sdcard/PeerBlockLists
    
    # comment if you want to place the tools on your internal sdcard, and remove comment on line below.
    PeerTools=/storage/extSdCard/PeerTools
    
    # uncomment if you want to place the tools on your internal sdcard
    #PeerTools=/storage/sdcard0/PeerTools
    
    if [ ! -d ${PeerBlockLists} ]
    then
       mkdir ${PeerBlockLists}
    else
       rm ${PeerBlockLists}/* >/dev/null 2>&1
    fi
    
    if [ ! -d ${PeerTools} ]
    then
        mkdir ${PeerTools}
    fi
    
    if [ ! -f ${PeerTools}/list ]
    then
       echo "No Block List present in ${PeerTools}"
       echo "Block list format:"
       echo "<BlockListName>|<BlockListURL"
       echo "Block Lists can be found at:
       echo "   - http://goo.gl/g0Y8Jd  "
       echo "   - http://goo.gl/ZOqJTZ "
       ##### to be added later ###
       #echo "OR"
       #echo "wget -O ${PeerTools}/list 
       exit 1
    fi
    
    for lst in $(grep -v ^# ${PeerTools}/list | cut -d '|' -f2)
    do
     fname=$(grep "${lst}" ${PeerTools}/list |grep -v ^# | cut -d'|' -f1 |sed -e 's: :_:g' -e 's:(:_:g' -e 's:):_:g')
     wget -O ${PeerBlockLists}/${fname} "${lst}" >/dev/null 2>&1
    done
    
    echo '' > ${PeerBlockLists}/iblock.lst
    
    for i in $(ls ${PeerBlockLists}|grep -v iblock)
    do
        if [ "$(wc -l ${PeerBlockLists}/${i} |awk '{print $1}')" -ne "$(cat ${PeerBlockLists}/${i} |gunzip |wc -l)" ]
        then
            cat ${PeerBlockLists}/${i} | gunzip >> ${PeerBlockLists}/iblock.lst
        else
            cat ${PeerBlockLists}/${i} >> ${PeerBlockLists}/iblock.lst
        fi
        rm ${PeerBlockLists}/"${i}" >/dev/null 2>&1
    done
    
    cat ${PeerBlockLists}/iblock.lst | sort | uniq > ${PeerBlockLists}/iblock_uniq.lst
    rm ${PeerBlockLists}/iblock.lst

    The List, the format of the list is <NAME>|<URL>
    Comment out the list you don't want for your block list.
    -----------------------------
    Code:
    #LIST
    #apple|http://list.iblocklist.com/?list=aphcqvpxuqgrkgufjruj
    ads|http://list.iblocklist.com/?list=bt_ads
    #Atma|http://list.iblocklist.com/?list=tzmtqbbsgbtfxainogvm
    #bad-peers|http://list.iblocklist.com/lists/bluetack/bad-peers
    #bogon|http://list.iblocklist.com/?list=bt_bogon
    #bt_proxy|http://list.iblocklist.com/?list=bt_proxy
    #bt_rangetest|http://list.iblocklist.com/?list=bt_rangetest
    #Business ISPs|http://list.iblocklist.com/?list=jcjfaxgyyshvdbceroxf
    #CI Army|http://list.iblocklist.com/?list=npkuuhuxcsllnhoamkvm
    dhca_faker|http://list.iblocklist.com/lists/dchubad/faker
    dhca_hacker|http://list.iblocklist.com/lists/dchubad/hacker
    dhca_spammer|http://list.iblocklist.com/lists/dchubad/spammer
    DROP|http://list.iblocklist.com/?list=sh_drop
    dshield|http://list.iblocklist.com/lists/bluetack/dshield
    edu|http://list.iblocklist.com/?list=bt_edu
    forumspam|http://list.iblocklist.com/?list=ficutxiwawokxlcyoeye
    #General Corporate Ranges|http://list.iblocklist.com?list=ecqbsykllnadihkdirsh
    hijacked|http://list.iblocklist.com/lists/bluetack/hijacked
    #level1|http://list.iblocklist.com/?list=bt_level1
    #level2|http://list.iblocklist.com/?list=bt_level2
    #level3|http://list.iblocklist.com/?list=bt_level3
    malc0de|http://list.iblocklist.com/?list=pbqcylkejciyhmwttify
    Malicious|http://list.iblocklist.com/?list=npkuuhuxcsllnhoamkvm
    #Microsoft|http://list.iblocklist.com/?list=bt_microsoft
    #Palevo|http://list.iblocklist.com/?list=erqajhwrxiuvjxqrrwfj
    #Pedophiles|http://list.iblocklist.com/?list=dufcxgnbjsdwmwctgfuj
    primary-threats|http://list.iblocklist.com/lists/tbg/primary-threats
    #RapidShare|http://list.iblocklist.com/?list=zfucwtjkfwkalytktyiw
    #Search Engines|http://list.iblocklist.com/?list=pfefqteoxlfzopecdtyw
    #sh_drop|http://list.iblocklist.com/?list=sh_drop
    #spider|http://list.iblocklist.com/?list=bt_spider
    #SpyEye|http://list.iblocklist.com/?list=zvjxsfuvdhoxktpeiokq
    spyware|http://list.iblocklist.com/?list=bt_spyware
    #tor|http://list.iblocklist.com/?list=tor
    web-exploit|http://list.iblocklist.com/lists/bluetack/web-exploit
    #ZeuS|http://list.iblocklist.com/?list=ynkdjqsjyfmilsgbogqf
    6
    Yo thanks for your response, lol the host "yolo" was a test I totally forgot to remove it it's already removed from the new version
    Will be added to the todo's to remove a host that is blocked
    And filtering at history for block/allowed connections I was actually working on it already ;)

    I find it pretty interesting that back in August you said you removed Yolo and yet now in January for months it's been connecting to this mysterious Yolo host of yours through Google services, and doing it hundreds of times a day.

    Top of the list screenshot, bottom of the list screenshot, total screenshot. Look at the times!!! 13:55 at the top, 18:55 at the bottom. It shows 2313 "Allows" for Google Services to this mysterious "Yolo" test that he said was removed back in August. No freekin wonder Google Play Services has been draining my battery at 50% every 8 hours. This "Yolo" host is also under my email, contacts, google market, amazon, everything! Thousands of times in a matter of hours. I thought the god damn NSA and Corporate america was bad... christ. We really need to start a vetting process here because I no longer trust ANYONE.

    FYI This is with the latest Google Market version of PeerBlock, downloaded directly from Google Play.
    5
    1. I hope you do...I would love to contribute.
    2. That is a shame as I am sure there are many others that don't have access to Google Play.
    3. I meant that as opposed to being able to blacklist an IP from the history...can you also whitelist an IP.
    Black/White listing for hostnames and ip addresses is at the todo's, will upload apk soon :)
    Note: Look at the first post and you'll see at attachments the version 1.03 ;)