En iyi Webmaster forumlari.
iyilerin buluşma noktasi.

Proxy Guard

Başlatan Administrator, Tem 26, 2025, 11:44 ÖS

« önceki - sonraki »

Administrator

# proxy_guard.tcl - IRC Proxy Koruma
set proxy_file "data/proxy.txt"
set log_file "data/security.log"
set admins {admin1 admin2}

# Kullanıcı bağlantısında tetiklenir
bind evnt - init-server check_proxy_connect
bind join - * check_proxy_join
bind pub - !proxyekle add_proxy_ip
bind pub - !proxykaldir del_proxy_ip
bind pub - !proxykontrol check_proxy_cmd

# Proxy kontrolü
proc check_proxy_join {nick uhost hand chan} {
    set ip [get_ip_from_uhost $uhost]
    if {[is_proxy_ip $ip]} {
        putquick "KILL $nick :Proxy bağlantılar yasaktır"
        putserv "PRIVMSG OperServ :AKILL ADD $ip 30m Proxy Engeli"
        write_log "PROXY BLOCK: $nick / $ip"
    }
}

# Proxy.txt içindeki IP'yi kontrol et
proc is_proxy_ip {ip} {
    global proxy_file
    if {![file exists $proxy_file]} { return 0 }
    set list [split [readfile $proxy_file] "\n"]
    foreach line $list {
        if {[string trim $line] eq $ip} {
            return 1
        }
    }
    return 0
}

# Komut: !proxyekle <ip>
proc add_proxy_ip {nick uhost hand chan text} {
    global admins proxy_file
    if {[lsearch -exact $admins $hand] == -1} return
    if {$text eq ""} { putquick "PRIVMSG $chan :Kullanım: !proxyekle <ip>"; return }
    set fp [open $proxy_file a]
    puts $fp $text
    close $fp
    putquick "PRIVMSG $chan :$text eklendi."
    write_log "ADMIN $hand -> proxyekle $text"
}

# Komut: !proxykaldir <ip>
proc del_proxy_ip {nick uhost hand chan text} {
    global admins proxy_file
    if {[lsearch -exact $admins $hand] == -1} return
    if {$text eq ""} { putquick "PRIVMSG $chan :Kullanım: !proxykaldir <ip>"; return }
    if {![file exists $proxy_file]} return
    set list [split [readfile $proxy_file] "\n"]
    set newlist [list]
    foreach line $list {
        if {[string trim $line] ne $text} {
            lappend newlist $line
        }
    }
    set fp [open $proxy_file w]
    foreach ip $newlist { puts $fp $ip }
    close $fp
    putquick "PRIVMSG $chan :$text silindi."
    write_log "ADMIN $hand -> proxykaldir $text"
}

# Komut: !proxykontrol <ip>
proc check_proxy_cmd {nick uhost hand chan text} {
    if {$text eq ""} { putquick "PRIVMSG $chan :Kullanım: !proxykontrol <ip>"; return }
    if {[is_proxy_ip $text]} {
        putquick "PRIVMSG $chan :$text listede bulunuyor (proxy)."
    } else {
        putquick "PRIVMSG $chan :$text temiz görünüyor."
    }
}

# IP alma
proc get_ip_from_uhost {uhost} {
    set ip [lindex [split $uhost @] 1]
    return $ip
}

# Log yazma
proc write_log {text} {
    global log_file
    set ts [clock format [clock seconds] -format "%Y-%m-%d %H:%M"]
    set fp [open $log_file a]
    puts $fp "$ts - $text"
    close $fp
}

# Dosya okuma
proc readfile {filename} {
    set f [open $filename r]
    set content [read $f]
    close $f
    return $content
}
Webmasterforumlari.com yorumlarınız değerlidir..