×

WARRNING

VIEWING PAY TV WITHOUT A VALID SUBSCRIPTION IS ILLEGAL!! ALL FILES AVAILABLE HERE ARE FOR EXPERIMENTAL AND EDUCATIONAL PURPOSE ONLY
Results 1 to 3 of 3
  1. #1
    Status
    Online

    Users Flag!
    Geosharing's Avatar
    GS Administrator
    Join Date
    May 2014
    Location
    -=UAE=-
    Interests
    CardSharing
    Receiver
    VU+HD
    Receiver
    DM900UHD 4K
    Posts
    1,865
    Thanks
    6
    Thanked 36 Times in 20 Posts

    Iptables country ban script!

    PHP Code:
    #!/bin/bash
    # Purpose: Block all traffic from AFGHANISTAN (af) and CHINA (CN). Use ISO code. #
    # See url for more info - http://www.cyberciti.biz/faq/?p=3402
    # Author: nixCraft <" target="_blank" class="externalLink ProxyLink" data-proxy-href="http://www.cyberciti.biz>" rel="nofollow">www.cyberciti.biz> under GPL v.2.0+
    # -------------------------------------------------------------------------------
    ISO="af cn"

    ### Set PATH ###
    IPT=/sbin/iptables
    WGET
    =/usr/bin/wget
    EGREP
    =/bin/egrep

    ### No editing below ###
    SPAMLIST="countrydrop"
    ZONEROOT="/root/iptables"
    DLROOT="http://www.ipdeny.com/ipblocks/data/countries"

    cleanOldRules(){
    $IPT -F
    $IPT 
    -X
    $IPT 
    -t nat -F
    $IPT 
    -t nat -X
    $IPT 
    -t mangle -F
    $IPT 
    -t mangle -X
    $IPT 
    -P INPUT ACCEPT
    $IPT 
    -P OUTPUT ACCEPT
    $IPT 
    -P FORWARD ACCEPT
    }

    # create a dir
    [ ! -d $ZONEROOT ] && /bin/mkdir -p $ZONEROOT

    # clean old rules
    cleanOldRules

    # create a new iptables list
    $IPT -N $SPAMLIST

    for c  in $ISO
    do
        
    # local zone file
        
    tDB=$ZONEROOT/$c.zone

        
    # get fresh zone file
        
    $WGET -O $tDB $DLROOT/$c.zone

        
    # country specific log message
        
    SPAMDROPMSG="$c Country Drop"

        
    # get
        
    BADIPS=$(egrep -"^#|^$" $tDB)
        for 
    ipblock in $BADIPS
        
    do
           
    $IPT -A $SPAMLIST -s $ipblock -j LOG --log-prefix "$SPAMDROPMSG"
           
    $IPT -A $SPAMLIST -s $ipblock -j DROP
        done
    done

    # Drop everything
    $IPT -I INPUT -j $SPAMLIST
    $IPT 
    -I OUTPUT -j $SPAMLIST
    $IPT 
    -I FORWARD -j $SPAMLIST

    # call your other iptable script
    # /path/to/other/iptables.sh

    exit 

  2. #2
    Status
    Online

    Users Flag!
    Geosharing's Avatar
    GS Administrator
    Join Date
    May 2014
    Location
    -=UAE=-
    Interests
    CardSharing
    Receiver
    VU+HD
    Receiver
    DM900UHD 4K
    Posts
    1,865
    Thanks
    6
    Thanked 36 Times in 20 Posts
    add countries here :
    ISO="af cn"

  3. #3
    Status
    Offline
    rolhas77's Avatar
    GS Registered
    Join Date
    May 2014
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks great work

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Christmas pack all channels all country playlist 23-12-2016
    By ayz4u in forum Free IP Tv Channel List
    Replies: 0
    Last Post: 12-23-2016, 07:24 AM
  2. Dream pack all channels all country playlist 23-12-2016
    By ayz4u in forum Free IP Tv Channel List
    Replies: 0
    Last Post: 12-22-2016, 10:14 PM
  3. Giga pack all channels all country playlist 23-12-2016
    By ayz4u in forum Free IP Tv Channel List
    Replies: 0
    Last Post: 12-22-2016, 09:37 PM
  4. [DOWNLOAD] FarmVille 2 Country Escape v5.6.1036[Mod]
    By eros10 in forum MOBILE'S WORLDS
    Replies: 0
    Last Post: 09-04-2016, 12:17 AM
  5. Block IP's by Country
    By Geosharing in forum CSP
    Replies: 0
    Last Post: 05-10-2014, 09:44 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

All posts written express the point of view of its owner, does not imply in any way the point of view of management forum.