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

Thread: script

  1. #1
    maniac lao's Avatar
    Join Date
    02 Sep 2009
    Posts
    3,190
    Mentioned
    29 Post(s)
    Rep Power
    85

    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

  2. #2
    Standard RSP member
    Join Date
    31 Dec 2007
    Posts
    33
    Mentioned
    0 Post(s)
    Rep Power
    60

    Default

    Salut,

    Cred ca ar trebui putin formatat ca sa arate mai lizibil .

    Cred ca mai bine foloseste mailx in loc de nail care e cam vechi
    Last edited by danutz68; 24-06-10 at 17:04.

  3. #3
    叛徒 daradici's Avatar
    Join Date
    12 Apr 2008
    Location
    覆盆子灌木
    Posts
    1,073
    Mentioned
    0 Post(s)
    Rep Power
    67

    Default

    ...script-ul asta interesant, poate fi rulat direct pe box ? Poate fi bagat si la crond ca sa fie rulat din cand in cand automat ?

  4. #4
    maniac lao's Avatar
    Join Date
    02 Sep 2009
    Posts
    3,190
    Mentioned
    29 Post(s)
    Rep Power
    85

    Default cron

    in cron sigur, pe box nu stiu
    vezi in pagina originala ce mai zice - in partea de jos

Posting Permissions

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