Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4

Thread: script

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    maniac lao's Avatar
    Join Date
    02 Sep 2009
    Posts
    3,722
    Mentioned
    31 Post(s)
    Rep Power
    107

    Default script

    Am gasit un script:
    http://www.scribd.com/doc/12848119/Cccam-Iptables
    Problema e ca da eroare:
    ./script.sh: line 29: eroare de sintaxÄ neaÅteptatÄ lingÄ `newline'
    ./script.sh: line 29: `grep 'illegal' $logdir/illegaluser.log | awk -F" " '{print $5,$7}' >'


    Daca este cineva mai priceput care sa poata arunca o privire asupra lui....
    Mi se pare ceva folositor
    Multumesc

    ---------- Post added at 15:21 ---------- Previous post was at 13:49 ----------
    REZOLVARE

    #!/bin/sh
    ###########################
    ## Auto Ban script
    ##
    ## Illegal CCcam Users
    ##
    ## Written By CC_Share
    ##
    ## Thanks to Unlocker-AL ##
    ## For the Basic idea
    ##
    ###########################
    workdir="/tmp"
    #This is there the debug info from CCcam is dumped
    firewall="/var/emu/log"
    #The saved firewall rules
    logdir="/var/emu/log"
    #The logfile directory
    EMAIL="top@gmail.com"
    #Email adres to mail result to
    SUBJECT="Illegal Userlist CCcam"

    #Subject title of the email
    EMAILMESSAGE="/var/emu/log/illegaluser.txt" #List that contains the Illegal users
    rm $workdir/debug.old
    cp $workdir/debug.txt $workdir/debug.old
    cp $logdir/iptables-save.new $logdir/iptables-save.old
    cat $workdir/debug.old|grep illegal > $logdir/illegaluser.log
    grep 'illegal' $logdir/illegaluser.log | awk -F" " '{print $5,$7}' >$logdir/illegaluser.txt
    grep 'illegal' $logdir/illegaluser.log | awk -F" " '{print $7}' | grep -o '^[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' > $logdir/badIP.out
    awk '{s[$0]++}
    END {
    for(i in s) {
    if(s[i]>1) {
    print i
    }
    }}' $logdir/badIP.out > $logdir/badIP.block

    while IFS= read -r EachLine
    do
    command="iptables -A INPUT -s "$EachLine" -j DROP"
    echo $command
    $command
    done < $logdir/badIP.block
    rm $logdir/badIP.block
    if [ -s $logdir/illegaluser.txt ] ; then
    iptables-save -c > $logdir/iptables-save.new
    /usr/bin/nail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE
    else
    echo "No Illegal Users found right now"
    fi
    sleep 1
    > $workdir/debug.txt
    exit 0
    Last edited by lao; 24-06-10 at 16:26. Reason: COMPLETARE

Posting Permissions

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