Thanks:
0
Likes:
0
Dislikes:
0
-
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
-
Standard RSP member
- Rep Power
- 60
-
...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 ?
-
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
-
Forum Rules