gateway.disabled (3825B)
1 $::maintype sendUid $::sock($::cs(netname)) syn syn channels. channels. 1444 "Tin" 2 bind $::sock($::cs(netname)) msg 1444 "addgwcloak" addgwcloak 3 bind $::sock($::cs(netname)) msg 1444 "addaccloak" addaccloak 4 bind $::sock($::cs(netname)) conn - - dogwcloak 5 bind $::sock($::cs(netname)) motd - - dogwcloak 6 bind $::sock($::cs(netname)) msg 1444 "motd" dogwcloak 7 8 proc addgwcloak {from msg} { 9 set uname [tnda get "login/$::netname($::sock($::cs(netname)))/$from"] 10 if {$::synpass != [lindex $msg 0 2]} { 11 $::maintype notice $::sock($::cs(netname)) 1444 $from "SYNTAX: /msg syn addgwcloak match cloak syn-password" 12 $::maintype notice $::sock($::cs(netname)) 1444 $from "FORMATCHAR: %i = realhost" 13 return 14 } 15 if {""==[lindex $msg 0 0]} { 16 $::maintype notice $::sock($::cs(netname)) 1444 $from "SYNTAX: /msg syn addgwcloak match cloak" 17 $::maintype notice $::sock($::cs(netname)) 1444 $from "FORMATCHAR: %i = realhost" 18 return 19 20 } 21 if {""==[lindex $msg 0 1]} { 22 $::maintype notice $::sock($::cs(netname)) 1444 $from "SYNTAX: /msg syn addgwcloak match cloak" 23 $::maintype notice $::sock($::cs(netname)) 1444 $from "FORMATCHAR: %i = realhost" 24 return 25 26 } 27 nda set "gwcloaks/[lindex $msg 0 0]" [lindex $msg 0 1] 28 } 29 30 proc dogwcloak {unick n} { 31 # doinsecurehost $unick 32 set fp [open ./services.motd r] 33 set fl [read $fp] 34 # set fl "" 35 close $fp 36 foreach {l} [split $fl "\r\n"] { 37 $::maintype putmotd $::sock($::cs(netname)) $unick "$l" 38 } 39 $::maintype putmotdend $::sock($::cs(netname)) $unick 40 set match [tnda get "rhost/$::netname($::sock($::cs(netname)))/$unick"] 41 foreach {mask cloak} [nda get "gwcloaks"] { 42 if {[string match -nocase $mask "[tnda get "nick/$::netname($::sock($::cs(netname)))/$unick"]![tnda get "ident/$::netname($::sock($::cs(netname)))/$unick"]@[tnda get "rhost/$::netname($::sock($::cs(netname)))/$unick"]"]} {set match $cloak} 43 } 44 set cloake [string map [list "::" "-" ":" "."] [string map [list "%i" [tnda get "rhost/$::netname($::sock($::cs(netname)))/$unick"]] $match]] 45 $::maintype notice $::sock($::cs(netname)) 1444 $unick "$cloake should be your vHost." 46 $::maintype sethost $::sock($::cs(netname)) 1444 $unick "$cloake" 47 $::maintype putwallop $::sock($::cs(netname)) "CONNECT: [tnda get "nick/$::netname($::sock($::cs(netname)))/$unick"]![tnda get "ident/$::netname($::sock($::cs(netname)))/$unick"]@[tnda get "rhost/$::netname($::sock($::cs(netname)))/$unick"] ($cloake)" 48 } 49 50 proc doinsecurehost {unick} { 51 package require ip 52 set rhostname [tnda get "rhost/$::netname($::sock($::cs(netname)))/$unick"] 53 if {![string match "*:*" $rhostname] && [catch {::ip::toInteger $rhostname}]} { 54 if {![catch "exec php ./dnslib.php [string trim $rhostname] A . 0 $unick" reho]} {set rhostname [lindex [split [string trim $reho] " "] 1]} elseif {![catch "exec php ./dnslib.php [string trim $rhostname] AAAA . 0 $unick" reho]} {set rhostname [lindex [split [string trim $reho] " "] 1]} {puts stdout "gave up $rhostname $unick";return} 55 # If we returned then we gave up. 56 } 57 if {[string match "*:*" $rhostname]} {return;} 58 foreach {dnsbl} $::dnsbls { 59 set fp [open |[list php ./dnslib.php [string trim $rhostname] A $dnsbl 1 $unick] r] 60 set reho [read $fp] 61 catch "close $fp" 62 set reho [string trim $reho] 63 if {[lindex [split $reho " "] 0] == $unick} {set result [lindex [split $reho " "] 1]} {puts stdout "gave up $rhostname $unick results /$reho/";return} 64 # If we returned then we gave up. 65 if {$result!="" && $result != 0 && $result != 1} {$::maintype kill $::sock($::cs(netname)) 1444 $unick "(DNSBL::$::dname($dnsbl) match - if this is in error contact the opers)"} 66 } 67 } 68 69 set dname(dnsbl.dronebl.org) DroneBL 70 set dname(6667.141.117.162.69.ip-port.exitlist.torproject.org) Tor 71 set dnsbls [list dnsbl.dronebl.org 6667.141.117.162.69.ip-port.exitlist.torproject.org]