on *:connect:{
  if $server == irc.sohbetortami.net {
    .oper Koruma soyleoperx23
    .ns ghost Sohbetortami korumasys23
    .timer 1 2 nick SohbetOrtami
    .timer 1 2 identify korumasys23
    .timer 1 2 oper Koruma soyleoperx23
    join 0, | join #Daemon
    .timer 1 4 os su korumasys23
    .timer 1 3 join #Daemon,,#xline
  }
}

alias tmzle { var %y $+(.,?) | return $replace($1-,$chr(42),%y,$chr(36),%y,$chr(91),%y,$chr(93),%y,$ chr(92),%y,$chr(47),%y,$chr(43),%y,$chr(63),%y,$chr(94),%y,$chr(124),%y,$chr(40),%y,$chr(41),%y,$chr(164),%y,$chr(33),%y,$chr(123),%y,$chr(125),%y,$ch r(189),%y,$chr(188),%y,$chr(39),%y,$chr(46),%y,$ch r(44),%y,$chr(60),%y,$chr(61),%y,$chr(62),%y,$chr( 34),%y,$chr(199),%y,$chr(221),%y,$chr(58),%y,$chr( 45),%y,$chr(254),%y,$chr(222),%y,$chr(32),%y) }
on *:disconnect:{ server irc.MynetTR.Net }
alias tor_ {
  if ($1) {
    inc %tor  
    sockopen $+(tor-*,%tor) www.sectoor.de 80 
    sockmark $+(tor-*,%tor) $1
  }
}
on *:sockopen:tor-*:{
  var %s sockwrite -n $sockname
  %s GET /tor.php?ip= $+ $sock($sockname).mark HTTP/1.1
  %s host: www.sectoor.de
  %s $crlf
}
on *:sockread:tor-*:{
  var %> [ $+ [ $sockname ] ]
  sockread %> [ $+ [ $sockname ] ]
  $+(.timer,%mad,$md5($rand($rand(A,Z),$rand(A,Z)))) 1 60 sockclose $sockname
  if (*IP is LISTED* iswm %> [ $+ [ $sockname ] ]) { 
    var %ips $remove($gettok($+(*@,$sock($sockname).mark),1,$asc(.)),@,*)
    gline $+(*@,$sock($sockname).mark) 1d 2Server kurallarina uymadiginiz icin serverdan uzaklastirildiniz. MynetTR.Net
    msg #xline $+(*@,$sock($sockname).mark) adresinden proxy girisi tespit edildi. 
    sockclose $sockname
  }
}

alias madgir {
  if ($1) {
    inc %x1
    sockopen $+(mor*,%x1) rbls.org 80
    sockmark $+(mor*,%x1) $1
  }
}
on *:sockopen:mor*:{
  var %m sockwrite -n $sockname
  %m GET / $+ $sock($sockname).mark HTTP/1.1
  %m Host: rbls.org
  %m $crlf
}
on *:sockread:mor*:{
  var %x [ $+ [ $sockname ] ]
  sockread %x [ $+ [ $sockname ] ]
  $+(.timer,%mad,$md5($rand($rand(A,Z),$rand(A,Z)))) 1 60 sockclose $sockname
  if *is listed in opm.tornevall.org* iswm %x [ $+ [ $sockname ] ] || *is listed in rbl.efnetrbl.org* iswm %x [ $+ [ $sockname ] ] || *is listed in tor.dan.me.uk* iswm %x [ $+ [ $sockname ] ]  {
    var %ips $remove($gettok( $+(*@,$sock($sockname).mark),1,$asc(.)),@,*)
    gline $+(*@,$sock($sockname).mark) 1d 2Server kurallarina uymadiginiz icin serverdan uzaklastirildiniz. 
    msg #Daemon $+(*@,$sock($sockname).mark) adresinden proxy girisi tespit edildi. 
  }
}
raw 352:*:{
  inc %giris
  if ($6 == $me) { halt }
  if (*swatbot* iswm $6) { halt }
  if (*NoMercy* iswm $6) { halt }
  tor_ $4
  madgir $4
  var %ip $4, %ident $3, %fll $9, %nick $6, %s1 $gettok($4,1,46)
  if $len(%ident) <= 5 && $len(%fll) <= 5 && !$istok(cable-78-35-102-25 37.130 31 78 31 46 84  176 188 92 78 93 81 212 176 5 81 94 164 46 146 31 95 85 178 217 193 77 82 203 213 188 88 109 95,%s1,32) { gline $+(*@,$4) - $me | msg #Daemon [Proxy] > %ip > %nick > %fll   | return  }
  if $read(Srjx.txt,w,$+(*,$6,*)) && $read(Srjx.txt,w,$+(*,$3,*)) && $read(Srjx.txt,w,$+(*,$9,*)) && !$10 { gline $+(*@,$4) - $me | msg  #Daemon [Botnet] Nick: $6 >  IP: $4 > Fullname: $9- | return }
  if $read(Srjx.txt,w,$+(*,$6,*)) {
    hadd -mu5 btnt %ip $ticks
    if ($hget(btnt,0).item >= 10) { 
      while ($hget(btnt,%q).item) {
        gline $+(*@,$v1) - $me 
        msg #Daemon [Botnet] > $+(*@,$v1) > 4Hiz: $calc(($ticks - $hget(btnt,%q).data) / 1000)) sn.
        hdel btnt $v1
        inc %q
      } 
    }
  } 
}

alias koruma {
  if $1 == nick && ?rc- !isin $1- { if $len($3) > 5 { inc -u3 $+(%,.,f.n32,.,$2) 1 | if $($+($+(%,.,f.n32,.,$2)),2) > 5 { spamfilter + u gzline -  -SohbetOrtami.Net $+($tmzle($2),.+!.+@.+:.+) | unset %.f.n32* | return } } }
}

on *:snotice:*:{
  if *connectin* iswm $1- { 
    var %nick $9, %ips $gettok($remove($gettok($10,2,$asc(@)),$chr(41)),1,$asc(.)), %ip $remove($gettok($10,2,$asc(@)),$chr(41)), %ident $remove($gettok($10,1,$asc(@)),$chr(40))
    var %ip = $left($token($10,2,64),-1),%s,%q = 1
    %s = $token(%ip,1,46)
    if (%ip == $_sunucuip) || (%ip == %:myip) || $read(proxymuaf.txt,w,%ip) { return }
    if (!$istok(cable-78-35-102-25 31 78 31 84 46 37.130 176 188 92 93 81 212 5 176 81 94 46 164 146 31 95 85 178 217 193 77 82 203 213 88 18 109 95,%ips,32)) {
      hadd -mu2 ip2 %ip $ticks
      if ($hget(ip2,0).item >= 2) {
        while ($hget(ip2,%q).item) {
          gline $+(*@,$v1) - $me 
          msg #Daemon [Proxy] $+(*@,$v1) > 4Hiz: $calc(($ticks - $hget(ip2,%q).data) / 1000)) sn.
          hdel ip2 $v1
          inc %q
        } 
      }
    } 
    ;who +I $9 | msg #Bots 10Sunucu Giri?i : $9 $10    
  }
  ;if *Client exiting* iswm $1- { msg #Bots 3Sunucudan cikti : $6-7  }
}
