mIRC Port Taraması TCL Eggdrop

############################ Anti-Socks v1.1 ##############################
# by Cashflo #
# Cashflo@GalaxyNet.Org #
# http://www.galaxynet.org/ircops/cashflo.html #
# Final Beta tested on Eggdrop1.3.23/26 w/ tcl8.0/1 #
# Copyright (c) 1999 Cashflo All Rights Reserved. #
###########################################################################
# The first real anti socks/wingate scanner out there for tcl, connects #
#per RFC and see’s if server responds with no authorization required. No #
#scanning Telnet ports which could be a possible security threat, or just #
#seeing if 1080 is open which could be a nukenapper. Actually tries to #
# connect as a sock client to the server, and sees if a no authorization #
#needed responce is returned. Works for both socks4 and socks5. Script #
# is capable of checking for socks, via dcc, msg, pub, by any user & a #
#option to allow any IrcOp to be able to scan via msg & pub, as well as a #
# option to have the bot scan scan server connections as a local IrcOp #
# connection monitor and be able to k-line and or local wallop on socks. #
#Script can Ban/onotice/log/lwallop on cooresponding automatic Triggers. #
###########################################################################
# Any problems or suggestions please contact me on irc or e-mail. #
# Same goes for if you want to edit this script or use parts of it. #
###########################################################################
# GalaxyNet Eggdrop’s also check out glxauth*.tcl.gz avaliable on sodre. #
# Script has been edited to support galaxynet auth if it is loaded, but #
# make sure in config source line for glxauth comes before anti-socks. #
###########################################################################
# Special Thanks to: Andyh, Fwibbly & of course Gawyn (as always) #
# For helping me w/ rfc1928 and such. #
###########################################################################
# This script Requires, tcl8.0+ and if you don’t edit main.c yourself #
# you need eggdrop1.3.23+, reason for this is because Tcl_DoOneEvent was #
# put in main.c on 1.3.23, if running a earlier version you are going to #
# have to compile it yourself by searching main.c for the following line #
#”debug0(“main: entering loop”);”, below that line is the main while loop #
#inside the while loop add the following “Tcl_DoOneEvent(TCL_DONT_WAIT);” #
# After saving those changes to main.c, remake/compile the bot, and then #
# go to line 260 about in this script and remove scanning for 1.3.23+ #
#And also make sure to compile in bind raw if pre 1.3.* via src/eggdrop.h #
#line 86 “#define bind raw” in 1.1.5, not sure if will elimiate all probs #
# Bottom line, I recommend and its easier if you upgrade to 1.3.* #
# but in any case you are going to need tcl 8.0 or greater!!! #
###########################################################################
# Important to GalaxyNet Users!! if you are running GlxAuth 2.2 or less, #
# make sure this script is loaded in config AFTER glxauth is loaded. #
###########################################################################
# If you are running this as a IrcOp’ed Connection Monitor, please make #
# Sure your bot is secure, ie. remove .tcl and any scripts that you are #
# not 100% sure are secured, and won’t let anyone send raw data to server #
# Also watch who you let into bot, and limit access and amount of users #
# on the bot. I will not be held liable for anything, including but not #
# limited to problems resulting from badly configured oper’ed bots. #
###########################################################################
# Don’t forget to check for updates, either on ftp’s or on GalaxyNet IRC #
# network /ctcp glxauth cdcc list This is latest as of 4/23/99 #
###########################################################################
###########################################################################
###########################################################################
# Translated to Turkish – TuRKeR(admin@eggdropturk.com) #
# Turkcelestiren – TuRKeR(admin@eggdropturk.com) #
# Bu dosya http://www.eggdropturk.com adresinden cekilmistir. #
# Komutlar: #
# #
# .socks <host/nick> soket denetlemesi yapar.(dcc’de) #
# /msg bot socks <host/nick> soket denetlemesi yapar.(mesaj olarak) #
# !socks <host/nick> soket denetlemesi yapar.(kanal komutu) #
# .sockshelp [komut] Komut hakkinda bilgi verir. #
# .sockset <komut> Komut ayarlari yapmanizi saglar. #
# .showsocks [all/last #n/arguman] Belirtilen arguman ile arama yapar. #
# .viewset [setting] Tum ayarlarinizi gosterir. #
# .delsocks log kayitlarini siler. #
###########################################################################
# Bu sciriptin yapabildikleri: #
# #
# 01) Soket taramasi yapabilir: #
# A) Kanal Girisleri. #
# B) Baglantilari. #
# C) Dcc ile .socks <host/nick>. #
# D) Msg ile /msg bot socks <host/nick>. #
# E) Kanal komutu ile !socks <host/nick>. #
# 02) Acik soket varsa: #
# A) Kanal girisinde ban. #
# B) Baglanti varsa k-line. #
# C) Baglanti varsa lwallop. #
# D) Log dosyasina kayit. #
# E) Kanal girisinde ONOTICE. #
# F) Acik portu olan kullaniciya mesaj gonderme. #
# 03) 15sn icinde DCC baglantisini keser. #
# 04) Bot oper olabilir eger $onick/$opass/$sockconnect #
# degiskenleri tanimlanmissa. #
# 05) Dogru versiyon tcl ve eggdropun yuklendigini sinar. #
# 06) .sockshelp Komutuyla Yardim: #
# A) .sockshelp #
# B) .sockshelp socks #
# C) .sockshelp showsocks #
# D) .sockshelp sockshelp #
# 07) Loglanan acik soket bilgilerini gosterir. #
# 08) .sockset Komutuyla Ayarlari Degistirir: #
# A) Kanal girisinde soket aramasi yapar. #
# B) Eger acik soket varsa zamanli ban koyar. #
# C) Aranmasini istemediginiz hostlari aramaz. #
# D) Log tutulup tutulmayacagini belirler. #
# E) Baglantilarda arama yapilip yapilmayacagini belirler. #
# F) Baglantilarda lwalloping yapilip yapilmayacagini belirler. #
# G) Baglantilarda otomatik k-line yapilip yapilmayacagini belirler. #
# H) Botun o-line nickini degistirir. #
# I) Botun o-line sifresini degistirir. #
# J) Botun oplara mesaj gondermesi saglanabilir. #
# K) Belirli bayraga (flag) sahip kullanicilar #
# arama disi birakilabilir. #
# 09) .viewset [ayar] ile Ayarlari Gormenizi Saglar. #
# 10) .delsocks ile Loglari Silmenizi Saglar. #
# 11) Kanala wingate portu acik biri girerse onotice #
# yapilip yapilmayacagini belirler. #
###########################################################################

# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #
# !!!!!!!!!!!!!!!!!!!!!!!—– ASAGIDAKI AYARLAMALARI YAPIN —–!!!!!!!!!!!!!!!!!!!!! #
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #

# — Kanal Girisleri Denetlemesi —

# Kanal girisinde arama yapilsinmi? (0 Off/ 1 On)

set sockjoin 1

# Soket aramasi yapilmayacak kanallar. (eger sockjoin on durumundaysa)
# Sadece belirtilen kanllarda soket aramsai yapilmaz.
# Botun oldugu diger kanallarda yapilir.
set sockchans { “#sock_exempt_chan1″ “#sock_exempt_chan2″ }

# Acik port varsa ban suresi (dakika cinsinden)

set bantime 60

# Acik port bulunursa oplara mesaj gonderilsin mi? (0 Off/ 1 On).
# paranoya :))

set socknotice 0

 

# —Aranmayacak Hostlarin Listesi—

# Baglantilarda soket armasi yapilmamasini istediginiz hostlarin (USERS@HOST degil) listesi

set sockhosts {
*.unixshells.com
*.benimhost.com
}

# Hangi bayraga(flag, yetki) sahip kullanicilar arama disi birakilacak

set sockflags “f o m n”

# —Aranmayacak Hostlarin Listesi Sonu—

# Log dosyasi adi. log tutmak istemiyorsaniz “” olarak birakin.

set socklog “”

# IrcOp’larin botunuzun /msg bot socks <host/nick> komutunu kullanarak
# arama yaptirmasina izin veriyormusunuz? (0 Off/ 1 On)

set sockoper 0

# — Oper Bot Ayarlamalari… (Botunuz Oper ise asagidaki ayarlamalari yapin.) —

# Baglantilarda arama yapilacakmi?(sunucuya baglanti oldugunda) (0 Off/ 1 On)
# (Botunuz oper olabiliyorsa 1 yapin)

set sockconnect 0

# Acik port oldugunda wallop uygulansin mi? (0 Off/ 1 On) ( $sockconnect = 1 ise calisir)

set socklwall 0

# Acik port oldugunda otomatik k-line uygulansin mi? (0 Off / 1 On) ($sockconnect = 1 ise calisir)

set akline 0

# O-line nickname ( “” yaparsaniz oper destegi olmaz)
# (ircd.conf dosyaniza onick & opass & hostu eklediginze emin olun)

set onick “”

# o-line password (“” yaparsaniz o-line destegi olmaz)

set opass “”

 

# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #
# !!!!!!!!!!!!!!!!!!!!!!!—– AYARLAMALAR BITTI —–!!!!!!!!!!!!!!!!!!!!!!!!!! #
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #

# Make sure no vars got deleted.

if {![info exists sockjoin]} { set sockjoin 1 }; if {![info exists sockchans]} { set sockchans “” }
if {![info exists bantime]} { set bantime 60 }; if {![info exists sockhost]} { set sockhost “” }
if {![info exists sockflags]} { set sockflags “f o m n” }; if {![info exists socklog]} { set socklog “socks.log” }
if {![info exists sockoper]} { set sockoper 1 }; if {![info exists sockconnect]} { set sockconnect 0 }
if {![info exists socklwall]} { set socklwall 0 }; if {![info exists akline]} { set akline 0 }
if {![info exists onick]} { set onick “” }; if {![info exists opass]} { set opass “” }
if {![info exists socknotice]} { set socknotice0 }; set isircop 0
if {[info exists timeout]} { unset timeout }; if {[info exists ohost]} { unset ohost }
if {[info exists nthing]} { unset nthing }
# Version info
set sockver “1.1”
# Very basic encryption.
if {$opass != “”} { set opass [encrypt $sockver $opass] }

# Help arrays

set sockshelp(socks) [list “o/oper” “.socks <host/nick> | /msg $botnick socks <host/nick> | !socks <host/nick>” “<host/nick> icin elle acik socket taramasi yapar. Yada \$opersock aciksa IrcOplar acik soket taramasi yapabilir.”]
set sockshelp(showsocks) [list “o” “.showsocks \[all/last #/arama kriteri\]” “Log dosyasindan belirlenen kriterlere gore arama yapar, eger kriter belirtilmezse butun log gosterilir:
[format %-18s “.showsocks \[n\]”] – En son kayit edilen n tane acik soket.
[format %-18s “.showsocks all”] – Tum kayitlari goster.
[format %-18s “.showsocks \[kriter\]”] – Girilen kritere gore goruntuler”]
set sockshelp(sockshelp) [list “all” “.sockshelp \[komut\]” “Komut hakkinda bilgi verir.”]
set sockshelp(viewset) [list “o” “.viewset \[ayar\]” “Tum ayarlari gosterir”]
set sockshelp(delsocks) [list “m” “.delsocks” “Log dosyasini temizler.”]
set sockshelp(sockset) [list “m” “.sockset <ayar> \[yeni ayar\]” “Yeni ayar yapmanizi yada var olani gormenizi saglar:
[format %-21s 26\[Komut\]26] 26Bilgi26
[format %-20s “akline <0/1>”] Otomatik k-line yapilmasini saglar.
[format %-20s “bantime \[zaman\]”] Ban zamanini ayarlamanizi saglar.
eger bir ban zamani girilmezse bu ozellik kaldirilir.
eger ban zamani 0 olursa ban asla kaldirilmaz.
[format %-20s “onick <o nick>”] Botun o-line nickini degistirir.
[format %-20s “opass <o sifre>”] Botun o-line sifresini degistirir.
[format %-20s “+sockchan <#kanal>”] Acik port taramasi yapilmayacak kanal girmenizi saglar.
[format %-20s “-sockchan <#kanal>”] Acik port taramasi yapilmayan kanali silmenizi saglar.
[format %-20s “sockconnect <0/1>”] Baglanitda acik port taramasini acip/kapatmanizi saglar.
[format %-20s “+sockhost <host>”] Tarama yapilamaycak host eklemenizi saglar.
[format %-20s “-sockhost <host>”] Tarama yapilmayan hostu silmenizi saglar.
[format %-20s “+sockflag <bayrak>”] Tarama yapilmayacak bayrak eklemeniz saglar.
[format %-20s “-sockflag <bayrak>”] Tarama yapilmayan bayragi kaldirmanizi saglar.
[format %-20s “sockjoin <0/1>”] Giriste tarama yapmayi acip/kapatmanizi saglar.
[format %-20s “socklog \[dosya\]”] Log dosyasinin adini degistirmenizi saglar.
[format %-20s “socklwall <0/1>”] Baglantida lwallopu acip/kapatmanizi saglar.
[format %-20s “socknotice <0/1>”] Giriste acik port bulunursa tum oplara mesaj gondermeyi acip/kapatmanizi saglar.
[format %-20s “sockoper <0/1>”] +O (IrcOp) bayragina sahip kullanicilarin port taramasi yapmasini saglar.

# See if person can handle script.
if {![info exists numversion] || ($numversion < 1032300)} {
if {[string range $version 0 2] != “1.3”} {
putlog “*** Can’t load anti-socks — At least Eggdrop v1.3.23 required”
return 0
}
}
if {(![info exists tcl_version] || $tcl_version < 8.0)} {
putlog “*** Can’t load anti-socks — Need at least tcl 8.0″
return 0
}

# Set settings needed if user is set to check socks on connection msgs.
if {$sockconnect} {
if {[info exists gaccess]} { catch {unbind raw – notice raw_notice} } ;# Support for GalaxyNet Auth.
bind raw – NOTICE raw_connect
if {($onick != “” && $opass != “”)} {
set init-server { sock-init }
}
}

# Listening port stuff for a socks4 connection request….

if {[info exists v4sock]} { catch {close $v4sock}; unset v4sock }; # Delete/close previous sock server
proc getconnect {sock addr port} { catch {close $sock} }; # Proc for a incoming sock4 check.
set v4port “2[rand 9][rand 9][rand 9]”; # set the incoming port to a random port between 2000-2999
# Setup a incoming server socket for sock4 scanning, if port is unavaliable try another.
set x 0
while {$x == 0} { if {![catch {set v4sock [socket -server getconnect $v4port]}]} { set x 1 } }

# Now a IrcOp.
bind raw – 381 raw_nowop

proc raw_nowop {from keyword arg} {
global akline botnick isircop server socklwall sockver version
if {[lindex $arg 0] == $botnick} {
set isircop 1
set end “”
if {$socklwall} { set end [append end “. Local Wallops sent on open socks”] }
if {$akline} { set end [append end “. Auto K-line set on open socks”] }
set cmsg “26Anti-Socks Connection Monitor v$sockver26 on Eggdrop[lindex $version 0] Is running on $server$end.”
putserv “LWALLOPS :$cmsg”
}
}

proc sock-init {} {
global akline botnick gaccess onick opass server sockconnect socklwall sockver version
if {$sockconnect} {
# See if bot is a oper.”
putserv “whois $botnick”
# Oper bot
putserv “oper $onick [decrypt $sockver $opass]”
# Support for GalaxyNet Auth.
if {[info exists gaccess]} {
catch {init-server}
}
}
}

# Join Checking Proc.
if {$sockjoin} {bind join – * join_sock}

proc join_sock {nick userhost handle channel} {
global sockchans sockflags sockhosts
# Exempt channel
if {[lsearch -glob $sockchans $channel] != -1} { return 0 }
set host [lindex [split $userhost @] 1]
# Exempt hosts
foreach pattern $sockhosts {
if {[string match $pattern $host]} { return 1 }
}
# Exempt flag
foreach exflag $sockflags {
if {[matchattr $handle $exflag]} { return 0 }
}
wingate $host join $channel $nick
}

# — DCC Procs —

# Dcc Help
bind dcc – sockshelp dcc_sockshelp
bind dcc – sockhelp dcc_sockshelp

proc dcc_sockshelp {hand idx arg} {
global sockshelp sockver version
set arg [lindex $arg 0]
putdcc $idx “—- 26Anti-Socks v$sockver on eggdrop[lindex $version 0]26 —-“
set list “delsocks socks sockshelp sockset showsocks viewset”
if {$arg == “”} {
foreach command $list {
putdcc $idx “[lindex $sockshelp($command) 1]”
}
putdcc $idx ” “
putdcc $idx “2602Daha fazla bilgi icin .sockshelp <komut> 00226″
} else {
if {[string index $arg 0] == “.”} {
set arg [lindex [split $arg .] 1]
}
set arg [string tolower $arg]
if {[catch {set test $sockshelp($arg)}]} {
putdcc $idx “$arg gecerli bir komut degil, yardim icin .sockhelp”
return 1
}
putdcc $idx “02Komut02: $arg”
putdcc $idx “02Flag02: [lindex $sockshelp($arg) 0]”
putdcc $idx “02Sozdizim02: [lindex $sockshelp($arg) 1]”
putdcc $idx “02Ozet02: [lindex $sockshelp($arg) 2].”
}
return 1
}

# Dcc command to show list of takeovers from logfile.
bind dcc o showsocks dcc_showsocks

proc dcc_showsocks {hand idx arg} {
global socklog
if {$socklog != “”} {
# See if user specified a number of socks to show from last
if {($arg != “” && $arg != “all”)} {
# See if they entered .showsocks #1, instead of .showsocks 1, if so weed out the leading #.
if {[string index $arg 0] == “#” && [regexp “^\[0-9\]+$” [string range $arg 1 end]]} {
set arg [string range $arg 1 end]
}
# If they entered a number, show last $arg socks recorded.
if {[regexp “^\[0-9\]+$” $arg]} {
set tail “”
putdcc $idx “En son $arg kayit edildi.”
catch {set tail [exec tail -n $arg $socklog]}
putdcc $idx “$tail”
} else {
# Scan logfile for the string
putdcc $idx “$arg icin Log dosyasi araniyor.”
set grep “”
catch {set grep [exec grep $arg $socklog]}
if {$grep != “”} {
putdcc $idx “$grep”
} else {
putdcc $idx “$arg Log dosyasinda bulunamadi. Daha fazla bilgi icin \”.sockshelp showsocks\” “
}
}
} else {
# If you did’nt enter any arg or was all, spit out the full socks log
putdcc $idx “Aranacak veriyi girmediniz, hepsi gosteriliyor.”
set fd [open $socklog]
set count -1
while {![eof $fd]} {
putdcc $idx [gets $fd]
set count [expr $count + 1]
}
close $fd
}
if {[info exists count]} {
putdcc $idx “$count tane kayit $socklog dosyasinda bulundu.”
}
} else {
putdcc $idx “Log dosyasi bulnamiyor.”
}
return 1
}

# Dcc command to clear the socks logfile.
bind dcc m delsocks dcc_delsocks

proc dcc_delsocks {hand idx arg} {
global socklog
if {[file exists $socklog]} {
set x [open $socklog w]
catch {close $x}
putdcc $idx “Log dosyasi silindi.”
} else {
putdcc $idx “Log dosyasi bulnamiyor.”
}
return 1
}

# Dcc to temp change settings till a rehash.
bind dcc m sockset dcc_sockset

proc dcc_sockset {hand idx arg} {
global akline bantime onick opass sockjoin sockchans sockconnect sockflags sockhosts socklwall socklog socknotice sockoper
set list “akline bantime onick opass sockconnect sockjoin socklog socklwall socknotice sockoper +sockchan -sockchan +sockflag -sockflag +sockhost -sockhost”
global botnick gaccess isircop sockver version
putdcc $idx “26Anti-Socks v$sockver on eggdrop[lindex $version 0] ini ayarlamalar.26″
if {$arg != “”} {
set arg [string tolower $arg]
set setting [lindex $arg 0]
set newset [lrange $arg 1 end]
if {[lsearch -exact [string tolower $list] ${setting}] != -1} {
# Can’t have -‘s in switch statement…..
if {(${setting} == “-sockchan” || ${setting} == “-sockflag” || ${setting} == “-sockhost”)} {
if {$setting == “-sockchan”} {
if {$newset != “”} {
if {[lsearch -exact [string tolower $sockchans] $newset] != -1} {
for {set loopvar 0} {$loopvar < [llength $sockchans]} {incr loopvar} {
if {$newset == [string tolower [lindex $sockchans $loopvar]]} {
set sockchans [lreplace $sockchans $loopvar $loopvar]
}
}
putdcc $idx “$newset taranmayacak kanallar listesinden cikarildi.”
} else {
putdcc $idx “$newset taranmayacak kanallar listesinde yok.”
}
} else {
putdcc $idx “02Sozdizimi02: .sockset -sockchan <#kanal>.”
}
} elseif {$setting == “-sockflag”} {
if {$newset != “”} {
if {[lsearch -exact [string tolower $sockflags] $newset] != -1} {
for {set loopvar 0} {$loopvar < [llength $sockflags]} {incr loopvar 1} {
if {$newset == [string tolower [lindex $sockflags $loopvar]]} {
set sockflags [lreplace $sockflags $loopvar $loopvar]
}
}
putdcc $idx “$newset taranmayacak kullanici bayraklari listesinden cikarildi.”
} else {
putdcc $idx “$newset taranmayacak kullanici bayraklari listesinde bulunamadi.”
}
} else {
putdcc $idx “02Sozdizimi02: .sockset -sockflag <bayrak>.”
}
} elseif {$setting == “-sockhost”} {
if {$newset != “”} {
if {[lsearch -exact [string tolower $sockhosts] $newset] != -1} {
for {set loopvar 0} {$loopvar < [llength $sockhosts]} {incr loopvar 1} {
if {$newset == [string tolower [lindex $sockhosts $loopvar]]} {
set sockhosts [lreplace $sockhosts $loopvar $loopvar]
}
}
if {$isircop} { putserv “LWALLOPS :$hand removed exempt host $newset.” }
putdcc $idx “$newset taranmayacak hostlar listesinden cikaridi.”
} else {
putdcc $idx “$newset taranmayacak hostlar listesinde bulunamadi.”
}
} else {
putdcc $idx “02Sozdizimi02: .sockset -sockhost <host> “
putdcc $idx “Left sockhosts on $sockhosts.”
}
}
return 1
}
# Setting is already set to that…
if {[string first + $setting] != 0 && $newset == [expr $$setting]} {
putdcc $idx “02Zaten ayarli02: $setting zaten $newset olarak ayarli.”
putdcc $idx “Yardim icin .sockhelp “
return 1
}
# Switch for rest of commands…..
switch ${setting} {
“akline” {
if {($newset == 0 || $newset == 1)} {
set akline $newset
putdcc $idx “Auto-Kline $akline olarak ayarlandi.”
if {$isircop} {putserv “LWALLOPS :Auto K-line changed to $akline by $hand”}
} else {
putdcc $idx “02Sozdizimi02: .sockset akline <0/1 “
}
}
“bantime” {
if {[regexp “^\[0-9\]+$” $newset]} {
set bantime $newset
if {$bantime == 0} {
putdcc $idx “Ban suresi kalici olarak ayarlandi.”
} elseif {$bantime == “”} {
putdcc $idx “Ban koyma kaldirildi.”
} else {
putdcc $idx “Ban suresi $bantime olarak ayarlandi.”
}
} elseif {$newset == “”} {
set bantime $newset
putdcc $idx “Ban koyma kaldirildi”
} else {
putdcc $idx “02Sozdizimi02: .sockset bantime <dakika cinsinden sure> “
}
}
“onick” {
if {$newset != “”} {
set onick $newset
if {$isircop} { putserv “LWALLOPS :$hand changed my O-Line Name to $onick.”}
putdcc $idx “onick $onick olarak ayarlandi.”
} else {
putdcc $idx “02Sozdizimi02: .sockset onick <o-line nick> “
}
}
“opass” {
if {$newset != “”} {
set opass [encrypt $sockver $newset]
if {$isircop} { putserv “LWALLOPS :$hand changed my O-Line Pass.” }
putdcc $idx “opass $opass olarak ayarlandi.”
} else {
putdcc $idx “02Sozdizimi02: .sockset opass <o-line pass>.”
}
}
“sockconnect” {
if {($newset == 0 || $newset == 1)} {
set sockconnect $newset
if {$newset == 0} {
if {$isircop} {
putserv “LWALLOPS :$hand turned off scanning on connect.”
putserv “MODE $botnick -o”
}
catch {unbind raw – NOTICE raw_connect}
if {[info exists gaccess]} { bind raw – notice raw_notice } ;# Support for GlxAuth
} else {
if {[info exists gaccess]} { catch {unbind raw – notice raw_notice } } ;# Glxauth Support
catch {bind raw – NOTICE raw_connect}
sock-init
if {$isircop} {putserv “LWALLOPS :$hand turned on sock scanning on connect.”}
}
putdcc $idx “Baglantida soket taramasi $sockconnect olarak ayarlandi.”
} else {
putdcc $idx “02Sozdizimi02: .sockset sockconnect <0/1> “
}
}
“sockjoin” {
if {($newset == 0 || $newset == 1)} {
if {$newset == 1 && $sockjoin == 0 } {
catch {bind join – * join_sock}
} elseif {$newset == 0 && $sockjoin == 1} {
catch {unbind join – * join_sock}
}
set sockjoin $newset
putdcc $idx “sockjoin $sockjoin olarak ayarlandi.”
} else {
putdcc $idx “02Sozdizimi02: .sockset sockjoin <0/1>. Left sock scanning on join on $sockjoin.”
}
}
“socklog” {
if {$newset == “”} {
set socklog $newset
putdcc $idx “sock loglama kapatildi.”
} else {
set socklog $newset
putdcc $idx “Log dosyasi $newset olarak ayarlandi.”
}
}
“socklwall” {
if {($newset == 0 || $newset == 1)} {
set socklwall $newset
putdcc $idx ” Sock Lwallop $socklwall olarak ayarlandi.”
if {$isircop} {putserv “LWALLOPS :$hand changed open sock lwalloping to $socklwall.”}
} else {
putdcc $idx “02Sozdizimi02: .sockset socklwall <0/1> ”
}
}
“socknotice” {
if {($newset == 0 || $newset == 1)} {
set socknotice $newset
putdcc $idx “Op Notice $socknotice olarak ayarlandi.”
} else {
putdcc $idx “02Sozdizimi02: .sockset socknotice <0/1> “
}
}
“sockoper” {
if {($newset == 0 || $newset == 1)} {
set sockoper $newset
putdcc $idx “IRCOPlarin soket taramasini kullanmalari $sockoper olarak ayarlandi.”
} else {
putdcc $idx “02Sozdizimi02: .sockset sockoper <0/1> “
}
}
“+sockchan” {
if {$newset != “”} {
if {[lsearch -exact [string tolower $sockchans] $newset] == -1} {
set sockchans [append sockchans ” $newset”]
putdcc $idx “$newset taranmayacak kanallar listesine eklendi.”
} else {
putdcc $idx “$newset zaten taranmayacak kanallar listesinde.”
}
} else {
putdcc $idx “02Sozdizimi02: .sockset +sockchan <#kanal>.”
}
}
“+sockflag” {
if {$newset != “”} {
if {[lsearch -exact [string tolower $sockflags] $newset] == -1} {
set sockflags [append sockflags ” $newset”]
putdcc $idx “$newset baglantilarda taranmayacak hostlar listesine eklendi.”
} else {
putdcc $idx “$newset zaten baglantilarda taranmayacak hostlar listesinde.”
}
} else {
putdcc $idx “02Sozdizimi02: .sockset +sockflag <bayrak>.”
}
}
“+sockhost” {
if {$newset != “”} {
if {[lsearch -exact [string tolower $sockhosts] $newset] == -1} {
set sockhosts [append sockhosts ” $newset”]
if {$isircop} { putserv “LWALLOPS :$hand exempted host $newset.” }
putdcc $idx “$newset taranmaycak hostlar listesine eklendi.”
} else {
putdcc $idx “$newset zaten taranmaycak hostlar listesinde.”
}
} else {
putdcc $idx “02Sozdizimi02: .sockset +sockhost <host>.”
}
}
}
} else {
putdcc $idx “Giris yapmadiniz: $list”
}
} else {
putdcc $idx “02Sozdizimi02: .sockset <arg> \[ayar\].”
putdcc $idx “Gecerli komutlar: $list.”
putdcc $idx “Daha fazla bilgi icin 26\”.sockshelp sockset\”26 “
}
return 1
}

# Dcc To show settings.
bind dcc o viewset dcc_viewset

proc dcc_viewset {hand idx arg} {
set list “akline bantime onick opass sockjoin sockchans sockconnect sockflags sockhosts socklwall socklog sockoper”
putdcc $idx “26——– Mevcut Ayarlar ——–26 “
putdcc $idx “02Ayar Deger02 “
if {$arg == “”} {
foreach setting $list {
global $setting
set value [expr $$setting]
if {$setting == “opass”} {
if {$value != “”} {
putdcc $idx “[format %-28s $setting] *BELiRLi*”
} else {
putdcc $idx “[format %-28s $setting] *BELiRLi DEGiL*”
}
continue
}
putdcc $idx “[format %-28s $setting] $value”
}
} else {
if {[lsearch -exact $list [string tolower $arg]] != -1} {
global $arg
if {$arg != “opass”} {
set value [expr $$arg]
putdcc $idx “[format %-28s $arg] $value”
} else {
putdcc $idx “O-Line Sifre Ayari gorunur degildir.”
}
} else {
putdcc $idx “Gecerli bir ayar degil.”
putdcc $idx “Gecerli ayarlar: $list.”
}
}
return 1
}

# Dcc sock checking.
bind dcc o socks dcc_socks
bind dcc o sock dcc_socks
bind dcc o wingate dcc_socks

proc dcc_socks {hand idx arg} {
global nthing
if {[info exists nidx]} { unset nidx }
set host [lindex $arg 0]
if {$host != “”} {
# Get users host.
if {[llength [split $arg .]] == 1} {
putserv “userhost [lindex $arg 0]”
set nthing $idx
return 1
}
# Format was a nick.
putdcc $idx “02TARANIYOR02: $host icin acik soket taramasi yapiliyor.”
wingate $host dcc $idx
} else {
putdcc $idx “02Sozdizimi02: .socks <host/nick>. Daha fazla bilgi icin \”.sockshelp socks\” “
}
return 1
}

# — Msg Procs —

# msg for wingate checking
bind msg – socks msg_socks
bind msg – sock msg_socks
bind msg – wingate msg_socks

proc msg_socks {nick userhost handle arg} {
global nthing ohost sockoper
if {[info exists ohost]} { unset ohost }
if {[info exists nthing]} { unset nthing }
if {[matchattr $handle o]} {
set host [lindex $arg 0]
if {$host != “”} {
# Get users host.
if {[llength [split $arg .]] == 1} {
putserv “userhost [lindex $arg 0]”
set nthing $nick
return 1
}
putserv “NOTICE $nick :02TARANIYOR02: $host icin acik soket taramasi yapiliyor.”
wingate $host msg $nick
} else {
putserv “NOTICE $nick :02Sozdizimi02: .socks <host/nick>.”
}
} elseif {$sockoper} {
set ohost [lindex $arg 0]
if {$ohost != “”} {
set ohost “msg $ohost”
putserv “WHOIS $nick”
} else {
putserv “NOTICE $nick :02Sozdizimi02: .socks <host/nick>.”
}
}
return 1
}

# A IrcOp msging bot who does not have access or bot seeing if it is a oper on rehash.
if {$sockoper} { bind raw – 313 raw_oper }

proc raw_oper {from keyword arg} {
global botnick isircop nthing ohost
# Ohost = type host [channel]
if {[info exists ohost]} {
if {[llength [split [lindex $ohost 1] .]] == 1} {
putserv “userhost [lindex $ohost 1]”
if {[lindex $ohost 0] == “pub”} {
set nthing [lindex $ohost 2]
} elseif {[lindex $ohost 0] == “msg” } { set nthing [lindex $arg 1] }
return 1
}
set msg “02TARANIYOR02: [lindex $ohost 1] icin acik soket taramasi yapiliyor.”
if {[lindex $ohost 0] == “msg”} {
putserv “NOTICE [lindex $arg 1] :$msg”
set whereto [lindex $arg 1]
} elseif {[lindex $ohost 0] == “pub”} {
putserv “PRIVMSG [lindex $ohost 2] :$msg”
set whereto [lindex $ohost 2]
}
wingate [lindex $ohost 1] [lindex $ohost 0] $whereto
unset ohost
} elseif {[lindex $arg 1] == $botnick} {
set isircop 1
}
}

# userhost reply from a user……
bind raw – 302 raw_isuser

proc raw_isuser {from keyword arg} {
global nthing
if {[info exists nthing]} {
set host [lindex [split [lindex [split [lindex $arg 1] =] 1] @] 1]
if {$host != “”} {
set msg “02TARANIYOR02: $host ([string trimright [string trimleft [lindex [split [lindex $arg 1] =] 0] :] *]) icin acik soket taramasi yapiliyor.”
} else {
set msg “02Online Degil02: Kullanici online degil.”
}
if {[regexp “^\[0-9\]+$” $nthing]} {
putdcc $nthing “$msg”
set type “dcc”
} elseif {[string first # $nthing] == 0} {
putserv “PRIVMSG $nthing :$msg”
set type “pub”
} else {
putserv “NOTICE $nthing :$msg”
set type “msg”
}
if {[lrange $msg 2 end] != “Kullanici online degil”} { wingate $host $type $nthing }
unset nthing
}
return 1
}

# Public command !socks <host>
bind pub – !socks pub_socks
bind pub – !sock pub_socks

proc pub_socks {nick userhost handle channel arg} {
global nthing ohost sockoper
if {[matchattr $handle o]} {
set host [lindex $arg 0]
if {$host != “”} {
# Get users host.
if {[llength [split $arg .]] == 1} {
putserv “userhost [lindex $arg 0]”
set nthing $channel
return 1
}
putserv “PRIVMSG $channel :02TARANIYOR02: $host icin acik port taramasi yapiliyor.”
wingate $host pub $channel
} else {
putserv “NOTICE $nick :02Sozdizimi02: !socks <host/nick>.”
}
} elseif {$sockoper} {
set ohost [lindex $arg 0]
if {$ohost != “”} {
set ohost “pub $ohost $channel”
putserv “WHOIS $nick”
} else {
putserv “NOTICE $nick :02Sozdizimi02: !socks <host/nick>.”
}
}
return 1
}

# Connection msgs

proc raw_connect {from keyword arg} {
global akline gaccess orawscript sockflags sockhosts
if {[lindex [split [string tolower $from] @] 1] == “” && [lrange $arg 4 5] == “Istemci baglaniyor:”} {
set userhost [split [string trimright [string trimleft [lindex $arg 7] (] )] @]
set user [lindex $userhost 0]; set host [lindex $userhost 1]
# Exempt hosts
foreach pattern $sockhosts {
if {[string match $pattern $host]} { return 1 }
}
# Exempt flag
set handle [finduser [lindex $arg 6]!$user@$host]
if {$handle != “*”} {
foreach exflag $sockflags {
if {[matchattr $handle $exflag]} { return 1 }
}
}
# Get the reply of wingate
wingate $host connect
}
if {[info exists gaccess]} { catch {raw_notice $from $keyword $arg} } ;# Support for GlxAuth
return 1
}

# Scanner.
proc wingate {host type args} {
global timeout
set args [join $args ” “]
# Not a valid host.
if {[catch {set sock [socket -async $host 1080]}]} {
if {$type == “dcc”} { putdcc [lindex $args 0] “02Gecerli Degil02: $host olarak belirtilen hosta baglanilamiyor.” }
if {$type == “msg”} { putserv “NOTICE [lindex $args 0] :02Gecerli Degil02: $host olarak belirtilen hosta baglanilamiyor.” }
if {$type == “pub”} { putserv “PRIVMSG [lindex $args 0] :02Gecerli Degil02: $host olarak belirtilen hosta baglanilamiyor.” }
return 0
}
fileevent $sock writable [list gotconnect $sock $host $type $args] ;# wait for connect.
fileevent $sock readable [list gotread $sock $host $type $args] ;#wait for responce.
# Timeout after 15seconds
set timeout($sock) “”
utimer 15 “sure asildi: $sock $host $type $args”
}

# Connection timed out.
proc timeout {sock host type args} {
global timeout
if {[info exists timeout($sock)]} {
unset timeout($sock)
fileevent $sock writable {} ;# remove previous handler
fileevent $sock readable {} ;# remove previous handler
close $sock ;# close the socket
if {$type == “dcc”} { putdcc [lindex $args 0] “02SURE DOLDU02: $host baglanti suresi doldu.” }
if {$type == “msg”} { putserv “NOTICE [lindex $args 0] :02SURE DOLDU02: $host baglanti suresi doldu.” }
if {$type == “pub”} { putserv “PRIVMSG [lindex $args 0] :02SURE DOLDU02: $host baglanti suresi doldu.” }
}
return 0
}

# Successfully connected, send data.
proc gotconnect {sock host type args} {
global botname timeout v4port
set args [join $args ” “]
# Send it request to connect, if its rejected (broken pipe) port 1080 is not open.
# 5 = SOCKS5/ 1 = I know 1 authentication methods/ 0 the one i know is ‘none’ as in completely open
fconfigure $sock -translation binary -buffering none -blocking 1 ;# configure the connection.
fileevent $sock writable {} ;# remove previous handler
# Send out the data, if can not send, no socks.
if {[lindex $args end] == “v4″} {
set data “[binary format “ccSI” 4 1 $v4port [myip]][exec whoami][binary format c 0]”
} else {
set data “[binary format ccc 5 1 0]”
}
if {[catch {puts $sock $data}]} {
if {$type == “dcc”} { putdcc [lindex $args 0] “02NO SOCKS02: $host bir socks hostu degil.” }
if {$type == “msg”} { putserv “NOTICE [lindex $args 0] :02NO SOCKS02: $host bir socks hostu degil.”
if {$type == “pub”} { putserv “PRIVMSG [lindex $args 0] :02NO SOCKS02: $host bir socks hostu degil.” }
if {[info exists timeout($sock)]} { unset timeout($sock) }
catch {close $sock}
}
}

# Got reply.
proc gotread {sock host type args} {
global akline bantime botnick socklog socklwall socknotice timeout
set args [join $args ” “]
if {[info exists timeout($sock)]} { unset timeout($sock) }
foreach timer [utimers] {
if {([lindex [lindex $timer 1] 0] == “timeout” && [lindex [lindex $timer 1] 1] == $sock)} { killutimer [lindex $timer 2] }
}
# Read in 2 bytes of data from reply. was hh
catch {binary scan [read $sock 2] cc reply reply2}
fileevent $sock readable {} ;# remove previous handler
catch {close $sock}
# Got 2bytes of reply
if {([info exists reply] && [info exists reply2])} {
if {$reply == 0} { set reply 4 }
# Is sock4 or sock5
if {$reply == 4 || $reply == 5} {
# Reply was is a socks4 w/ error msg, connect as socks4 and see if open.
if {$reply == 4 && $reply2 == 91} {
# If connection is still not granted after second attempt, give up…..
if {[lindex $args end] != “v4″} {
set lastv4time [unixtime]; set lastv4host $host
wingate $host $type $args v4
return 0
}
}
# no auth is required. (90 = sock4, 0 = sock5)
if {($reply == 4 && $reply2 == 90 || $reply == 5 && $reply2 == 0)} {
set msg “02ACIK02: $host icin v$reply bulundu.”
if {$type == “join”} {
putserv “kick [lindex $args 0] [lindex $args 1] :$host icin v$reply bulundu.”
if {$bantime != “”} { newban *!*@${host} $botnick “$host icin v$reply bulundu.” $bantime }
} elseif {$type == “connect”} {
if {$akline} {
append msg ” Host icin K-line Auto-aktif konuma getirildi.”
putserv “KLINE *@${host} :Open Socks v$reply.”
}
}
# Log wingates.
if {$socklog != “”} {
set x [open $socklog a+]
puts $x “[date] [time] – $host”
close $x
}
# Secure socks
} else {
set msg “02GUVENLI SOCKS02: $host icin v$reply bulundu ancak bu yetki alinmadan acik socket kullanilamiyor.”
}
# Unknown reply
} else {
set msg “02BILINMIYOR02: $host bilinmeyen bir yanit gonderdi.”
}
# No socks.
} else {
if {$type != “join” && $type != “connect”} { set msg “02NO SOCKS02: $host bir socks hostu degil.” }
}
# Send out warning messages.
if {![info exist msg]} { return 0 }
if {$type == “dcc”} {
putdcc [lindex $args 0] “$msg”
} elseif {$type == “msg”} {
putserv “NOTICE [lindex $args 0] :$msg”
} elseif {$type == “pub”} {
putserv “PRIVMSG [lindex $args 0] :$msg”
} elseif {$type == “connect” && $socklwall} {
putserv “LWALLOPS :$msg”
} elseif {$type == “join” && $socknotice} {
#Set max nicks at a time, and what amount up to, and list of nicks.
set numnicks 5; set oplist “”; set noticelist “”
foreach nick [chanlist [lindex $args 0]] {
# don’t notice who’s not op, the bot itself and other bots
if {([isop $nick [lindex $args 0]] && $nick != $botnick)} {
incr numnicks
# Add next op
lappend noticelist $nick
# List of nicks is full, output then go on to next set of nicks.
if {$numnicks == $maxnicks} {
# Add a comma between each nick for outputting.
regsub -all ” ” $noticelist “,” noticelist
puthelp “NOTICE $noticelist :$msg ([lindex $args 1])”
# Reset settings back for next group of nicks
set numnicks 0; set noticelist “”
}
}
}
# Leftover nicks
if {$noticelist != “”} {
regsub -all ” ” $noticelist “,” noticelist
putserv “NOTICE $noticelist :$msg ([lindex $args 1])”
}
}
}

putlog “02Anti-Socks v$sockver TCL02 by Cashflo <Cashflo@GalaxyNet.Org> Loaded. \”.sockshelp\” For Assistance”

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s