### Qauth Autohost v0.1 script by CyBex, lastupdate 22.9.2004 # # This scripts add and remove autmatic hostmask to a handle # # Commands: (only Partyline supportet) # qauth [*whois*|auth|perm|temp] : show details about user, default is whois and it work .qauth # qwhois : is alternative command, if you dont extend the whois partyline command # -qauth : remove auth from user # +qauth : add auth to user # addqauth : do the same like +qauth # -phost : remove permanent hostmask from user # +phost : add permanent hostmask to user # addphost : do the same like +phost # -thost : remove temporary hostmask from user # +thost : add temporary hostmask to user # deloldhost : remove hostmask from user, that not added by this script except telnet # delallhost : remove all hostmask from user except telnet - everything gets refreshed # qhelp : this text # # This script include two procs from thommeys example script with small changes # and the maskhost-fix is included and a litte changed for non idented users # # To download the patch visit http://sonys.de/thommey/eggdrop.html # # Created on 17.09.2004 # Release 19.09.2004 # Lastupdate 22.09.2004 if {[info command getchanlogin]==""} { putlog "WARNING, cant find thommeys quakenet eggdrop patch" return } if {![info exist use-354]} { putlog "variable use-354 dont exists, created!"; set use-354 1 } elseif {${use-354}!=1} { putlog "variable use-354 is 0, set to 1!"; set use-354 1 } namespace eval {::qauthautohost::} { ### config ### variable logaddremove 1 ; # 0 = off // 1 = on = show public how to add/remove hosts to user variable extendwhois 1 ; # 0 = off // 1 = on = extend the partyline .whois command variable removeperm 604800 ; # remove unused perm hosts after X seconds (minimum 1000 required) (default 604800 / 1 week) variable removetemp 86400 ; # remove unused perm hosts after X seconds (minimum 1000 required) (default 86400 / 1 day) ### end of config ## bind dcc t|m qauth {::qauthautohost::cybex:dcccmd qnet} bind dcc t|m qhelp {::qauthautohost::cybex:dcccmd qhelp} bind dcc t|m qwhois {::qauthautohost::cybex:dcccmd whois} bind dcc t|m qwho {::qauthautohost::cybex:dcccmd who} bind dcc t|m +qauth {::qauthautohost::cybex:dcccmd qauth:add} bind dcc t|m -qauth {::qauthautohost::cybex:dcccmd qauth:remove} bind dcc t|m +phost {::qauthautohost::cybex:dcccmd perm:add} bind dcc t|m -phost {::qauthautohost::cybex:dcccmd perm:remove} bind dcc t|m +thost {::qauthautohost::cybex:dcccmd temp:add} bind dcc t|m -thost {::qauthautohost::cybex:dcccmd temp:remove} bind dcc t|m addqauth {::qauthautohost::cybex:dcccmd qauth:add} bind dcc t|m addphost {::qauthautohost::cybex:dcccmd perm:add} bind dcc t|m deloldhost {::qauthautohost::cybex:dcccmd host:remove} bind dcc t|m remoldhost {::qauthautohost::cybex:dcccmd host:remove} bind dcc t|m delallhost {::qauthautohost::cybex:dcccmd host:remove:all} bind dcc t|m remallhost {::qauthautohost::cybex:dcccmd host:remove:all} ## comment the next line, if you want to use the lol-toolz .whois if {$extendwhois} {bind dcc -|- whois {::qauthautohost::cybex:dcccmd whois}} {bind dcc -|- whois *dcc:whois} bind raw - 354 ::qauthautohost::cybex:raw354 #bind time - "00 *" ::qauthautohost::cybex:checktime #bind time - "15 *" ::qauthautohost::cybex:checktime #bind time - "30 *" ::qauthautohost::cybex:checktime #bind time - "45 *" ::qauthautohost::cybex:checktime #unbind time - * ::qauthautohost::cybex:checktime #unbind time - "00 *" ::qauthautohost::cybex:checktime #unbind time - "15 *" ::qauthautohost::cybex:checktime #unbind time - "30 *" ::qauthautohost::cybex:checktime #unbind time - "45 *" ::qauthautohost::cybex:checktime bind time - * ::qauthautohost::cybex:checktime bind time - * ::qauthautohost::thommey:refresh_time if {$username=="b0rkBerlin"} { variable removeperm 259200 ; # 3days variable removeperm 43200 ; # 12hours variable removetemp 21600 ; # 6hours } if {$removeperm<1000} {set removeperm 1000} if {$removetemp<1000} {set removetemp 1000} proc cybex:dcccmd {what from idx text} { set arg0 [lindex [split $text] 0] set arg1 [lindex [split $text] 1] switch -exact -- $what { who { putlog "WHO $arg0" puthelp "WHO $arg0 n%hnua" } whois { *dcc:whois $from $idx $text if [validuser $arg0] { set hand $arg0 if {$hand!="*" || $arg0=="whois"} { set hlist [list] set qauths [getuser $hand xtra qauths] set thosts [getuser $hand hosts] set tphosts [getuser $hand xtra permhosts] set tttthosts [getuser $hand xtra] if {$qauths!=[list]} { putdcc $idx " \002$hand\002 has this qauths \002[join $qauths ", "]\002" } { putdcc $idx " \002$hand\002 has \002no\002 qauths" } set i 0; set list [list] foreach {host time} $tphosts { set txt "" if {$i==0} {set txt " Inactive perm host: "} {set txt " "} if {[lsearch [string tolower $thosts] [text2pattern [string tolower $host]]]!=-1} {lappend hlist $host; set akttxt "(X)"} { incr i set akttxt "" append txt "$akttxt $host, [clock format $time -format "%H:%M %d.%m.%Y"] (not seen since [duration [expr {[unixtime]-$time}]])" lappend list $txt } } if {$list!=[list]} {putdcc $idx "[join $list "\n"]"} set i 0; set list [list] foreach ttthosts $tttthosts { if {[string match -nocase temp*hosts* $ttthosts]} { set txt "" foreach {thname tthosts} $ttthosts { foreach {host time ctime} $tthosts { if {$i==0} {set txt " Inactive temp host: "} {set txt " "} if {[lsearch [string tolower $thosts] [text2pattern [string tolower $host]]]!=-1} {lappend hlist $host; set akttxt "(X)"} { incr i set akttxt "" append txt "$akttxt $host, [clock format $time -format "%H:%M %d.%m.%Y"] (not seen since [duration [expr {[unixtime]-$time}]]), created: [clock format $ctime -format "%H:%M %d.%m.%Y"] (since [duration [expr {[unixtime]-$ctime}]])" lappend list $txt } } } } } if {$list!=[list]} {putdcc $idx "[join $list "\n"]"} set i 0; set list [list] foreach host $thosts { set txt "" if {$i==0} {set txt " HOST: "} {set txt " "} if {[lsearch [string tolower $hlist] [text2pattern [string tolower $host]]]!=-1} {set akttxt "(X)"} { if {[string match -nocase "-telnet!*@*" $host]} {set akttxt "(-)"} { incr i set akttxt "(!)" append txt "$akttxt $host" lappend list $txt } } } if {$list!=[list]} {putdcc $idx "[join $list "\n"]"} } } } qhelp { putdcc $idx "This scripts add and remove autmatic hostmask to a handle" putdcc $idx " " putdcc $idx "Commands: (only Partyline supportet)" putdcc $idx "qauth \[\002whois\002|auth|perm|temp] : show details about user, default is whois and it work .qauth " putdcc $idx "qwhois : is alternative command, if you dont extend the whois partyline command" putdcc $idx "-qauth : remove auth from user" putdcc $idx "+qauth : add auth to user" putdcc $idx "addqauth : do the same like +qauth" putdcc $idx "-phost : remove permanent hostmask from user" putdcc $idx "+phost : add permanent hostmask to user" putdcc $idx "addphost : do the same like +phost" putdcc $idx "-thost : remove temporary hostmask from user" putdcc $idx "+thost : add temporary hostmask to user" putdcc $idx "deloldhost : remove hostmask from user, that not added by this script except telnet" putdcc $idx "delallhost : remove all hostmask from user except telnet - everything gets refreshed" } qnet { if {$arg0==""} {putdcc $idx "Usage: qauth \[\002whois\002|auth|perm|temp] "; return 0} set hand "*" if {[validuser $arg1] && $hand=="*"} {set hand $arg1} if {[validuser $arg0] && $hand=="*"} {set hand $arg0} if {$hand=="*"} {putdcc $idx "can't find a valid user in $text!"; return 0} switch -exact -- $arg0 { auth { set qauths [getuser $hand xtra qauths] if {$qauths!=[list]} { putdcc $idx "\002$hand\002 has this qauths \002[join $qauths ", "]\002" } { putdcc $idx "\002$hand\002 has \002no\002 qauths" } } perm { set qauths [getuser $hand xtra qauths] set tphosts [getuser $hand xtra permhosts] if {$qauths!=[list]} { putdcc $idx "\002$hand\002 has this qauths \002[join $qauths ", "]\002" } { putdcc $idx "\002$hand\002 has \002no\002 qauths" } set i 0; set list [list] foreach {host time} $tphosts { incr i; set txt "" if {$i==1} {set txt "PERM: "} {set txt " "} append txt "$host, [clock format $time -format "%H:%M %d.%m.%Y"] (not seen since [duration [expr {[unixtime]-$time}]])" lappend list $txt } if {$list!=[list]} {putdcc $idx "[join $list "\n"]"} } temp { set qauths [getuser $hand xtra qauths] set tttthosts [getuser $hand xtra] if {$qauths!=[list]} { putdcc $idx "\002$hand\002 has this qauths \002[join $qauths ", "]\002" } { putdcc $idx "\002$hand\002 has \002no\002 qauths" } set i 0; set list [list] foreach ttthosts $tttthosts { if {[string match -nocase temp*hosts* $ttthosts]} { incr i; set txt "" foreach {thname tthosts} $ttthosts { foreach {host time ctime} $tthosts { if {$i==1} {set txt "TEMP: "} {set txt " "} append txt "$host, [clock format $time -format "%H:%M %d.%m.%Y"] (not seen since [duration [expr {[unixtime]-$time}]]), created: [clock format $ctime -format "%H:%M %d.%m.%Y"] (since [duration [expr {[unixtime]-$ctime}]])" lappend list $txt } } } } if {$list!=[list]} {putdcc $idx "[join $list "\n"]"} } default { if {$hand!="*" || $arg0=="whois"} { set hlist [list] set qauths [getuser $hand xtra qauths] set thosts [getuser $hand hosts] set tphosts [getuser $hand xtra permhosts] set tttthosts [getuser $hand xtra] if {$qauths!=[list]} { putdcc $idx "\002$hand\002 has this qauths \002[join $qauths ", "]\002" } { putdcc $idx "\002$hand\002 has \002no\002 qauths" } set i 0; set list [list] foreach {host time} $tphosts { incr i; set txt "" if {$i==1} {set txt "PERM: "} {set txt " "} if {[lsearch [string tolower $thosts] [text2pattern [string tolower $host]]]!=-1} {lappend hlist $host; set akttxt "(X)"} {set akttxt " - "} append txt "$akttxt $host, [clock format $time -format "%H:%M %d.%m.%Y"] (not seen since [duration [expr {[unixtime]-$time}]])" lappend list $txt } if {$list!=[list]} {putdcc $idx "[join $list "\n"]"} set i 0; set list [list] foreach ttthosts $tttthosts { if {[string match -nocase temp*hosts* $ttthosts]} { incr i; set txt "" foreach {thname tthosts} $ttthosts { foreach {host time ctime} $tthosts { if {$i==1} {set txt "TEMP: "} {set txt " "} if {[lsearch [string tolower $thosts] [text2pattern [string tolower $host]]]!=-1} {lappend hlist $host; set akttxt "(X)"} {set akttxt " - "} append txt "$akttxt $host, [clock format $time -format "%H:%M %d.%m.%Y"] (not seen since [duration [expr {[unixtime]-$time}]]), created: [clock format $ctime -format "%H:%M %d.%m.%Y"] (since [duration [expr {[unixtime]-$ctime}]])" lappend list $txt } } } } if {$list!=[list]} {putdcc $idx "[join $list "\n"]"} set i 0; set list [list] foreach host $thosts { incr i; set txt "" if {$i==1} {set txt "HOST: "} {set txt " "} if {[lsearch [string tolower $hlist] [text2pattern [string tolower $host]]]!=-1} {set akttxt "(X)"} { if {[string match -nocase "-telnet!*@*" $host]} {set akttxt "(-)"} {set akttxt "(!)"} } append txt "$akttxt $host" lappend list $txt } if {$list!=[list]} {putdcc $idx "[join $list "\n"]"} } { putdcc $idx "can't find a valid user in $text!"; return 0 } ; # hand != * } } ; # switch } # qnet qauth:add { if {$arg1==""} {putdcc $idx "Usage: +qauth "; return 0} if {![validuser $arg0]} {putdcc $idx "$arg0 is not a valid user!"; return 0} set qauths [getuser $arg0 xtra qauths] if {[lsearch [string tolower $qauths] [text2pattern [string tolower $arg1]]]!=-1} {putdcc $idx "$arg1 has allready added to $arg0"} {lappend qauths $arg1; setuser $arg0 xtra qauths $qauths; putdcc $idx "added $arg1 qauth to $arg0"} } qauth:remove { if {$arg1==""} {putdcc $idx "Usage: -qauth "; return 0} if {![validuser $arg0]} {putdcc $idx "$arg0 is not a valid user!"; return 0} set qauths [getuser $arg0 xtra qauths] if {[set pos [lsearch [string tolower $qauths] [text2pattern [string tolower $arg1]]]]!=-1} {set qauths [lreplace $qauths $pos $pos]; setuser $arg0 xtra qauths $qauths; putdcc $idx "removed $arg1 qauth from $arg0"} {putdcc $idx "$arg1 not found from $arg0"} } perm:add { if {$arg1==""} {putdcc $idx "Usage: +phost "; return 0} if {![validuser $arg0]} {putdcc $idx "$arg0 is not a valid user!"; return 0} if {![string match *!*@* $arg1]} {putdcc $idx "$arg1 is not a valid hostmask!"; return 0} set permhosts [getuser $arg0 xtra permhosts] if {[lsearch [string tolower $permhosts] [text2pattern [string tolower $arg1]]]!=-1} {putdcc $idx "$arg1 has allready added to $arg0"} {lappend permhosts $arg1 [clock second]; setuser $arg0 xtra permhosts $permhosts; addhost $arg0 $arg1; putdcc $idx "added $arg1 permhost to $arg0"} } perm:remove { if {$arg1==""} {putdcc $idx "Usage: -phost "; return 0} if {![validuser $arg0]} {putdcc $idx "$arg0 is not a valid user!"; return 0} if {![string match *!*@* $arg1]} {putdcc $idx "$arg1 is not a valid hostmask!"; return 0} set permhosts [getuser $arg0 xtra permhosts] if {[set pos [lsearch [string tolower $permhosts] [text2pattern [string tolower $arg1*]]]]!=-1} {set permhosts [lreplace $permhosts $pos [expr {1+$pos}]]; setuser $arg0 xtra permhosts $permhosts; delhost $arg0 $arg1; putdcc $idx "removed $arg1 permhost from $arg0"} {putdcc $idx "$arg1 not found from $arg0"} } temp:add { if {$arg1==""} {putdcc $idx "Usage: +thost "; return 0} if {![validuser $arg0]} {putdcc $idx "$arg0 is not a valid user!"; return 0} if {![string match *!*@* $arg1]} {putdcc $idx "$arg1 is not a valid hostmask!"; return 0} set i 0; set done 0; set free 0 for {set i 0} {$i<9999 && !$done} {incr i} { if {[getuser $arg0 xtra temp${i}hosts]!=[list]} { set host [lindex [getuser $arg0 xtra temp${i}hosts] 0]; if {[string match -nocase $arg1 $host] || [string match -nocase [text2pattern $host] $arg1] || [string equal $host $arg1]} {set done 1} } {if {$free==0} {set free $i}} } if {$done==1} { putdcc $idx "$arg1 has allready added to $arg0" } { set temphosts [list $arg1 [clock second] [clock second]] setuser $arg0 xtra temp${free}hosts $temphosts; addhost $arg0 $arg1; putdcc $idx "added $arg1 temphost to $arg0 ($free)" } #set qauths [getuser $arg0 xtra qauths] #if {[lsearch [string tolower $qauths] [text2pattern [string tolower $arg1]]]!=-1} {putdcc $idx "$arg1 has allready added to $arg0"} {lappend qauths $arg1; setuser $arg0 xtra qauths $qauths; putdcc $idx "added $arg1 qauth to $arg0"} } temp:remove { if {$arg1==""} {putdcc $idx "Usage: -thost "; return 0} if {![validuser $arg0]} {putdcc $idx "$arg0 is not a valid user!"; return 0} #set qauths [getuser $arg0 xtra qauths] #if {[set pos [lsearch [string tolower $qauths] [text2pattern [string tolower $arg1]]]]!=-1} {set qauths [lreplace $qauths $pos $pos]; setuser $arg0 xtra qauths $qauths; putdcc $idx "removed $arg1 qauth from $arg0"} {putdcc $idx "$arg1 not found from $arg0"} set i 0; set done 0; set free 0 for {set i 0} {$i<9999 && !$done} {incr i} { if {[getuser $arg0 xtra temp${i}hosts]!=[list]} { set host [lindex [getuser $arg0 xtra temp${i}hosts] 0]; if {[string match -nocase $arg1 $host] || [string match -nocase [text2pattern $host] $arg1] || [string equal $host $arg1]} {set done 1; if {$free==0} {set free $i}} } } if {$done==1} { #set temphosts [list $arg1 [clock second] [clock second]] putdcc $idx "removed $arg1 temphost from $arg0 ($free)" setuser $arg0 xtra temp${free}hosts "" delhost $arg0 $arg1; } { putdcc $idx "$arg1 not found from $arg0" } } host:remove:all { if {$arg0==""} {putdcc $idx "Usage: delallhost "; return 0} if {![validuser $arg0]} {putdcc $idx "$arg0 is not a valid user!"; return 0} set thosts [getuser $arg0 hosts] if {[set pos [lsearch [string tolower $thosts] *-telnet*]]!=-1} {set telnet [lindex $thosts $pos]} {set telnet ""} setuser $arg0 hosts; if {$telnet!=""} {addhost $arg0 $telnet; cybex:dcccmd perm:add $from $idx "$arg0 $telnet"} } host:remove { if {$arg0==""} {putdcc $idx "Usage: deloldhost "; return 0} if {![validuser $arg0]} {putdcc $idx "$arg0 is not a valid user!"; return 0} set hand $arg0 if {$hand!="*" || $arg0=="whois"} { set hlist [list]; set qauths [getuser $hand xtra qauths]; set thosts [getuser $hand hosts]; set tphosts [getuser $hand xtra permhosts]; set tttthosts [getuser $hand xtra] foreach {host time} $tphosts {if {[lsearch [string tolower $thosts] [text2pattern [string tolower $host]]]!=-1} {lappend hlist $host}} foreach ttthosts $tttthosts { if {[string match -nocase temp*hosts* $ttthosts]} { foreach {thname tthosts} $ttthosts { foreach {host time ctime} $tthosts {if {[lsearch [string tolower $thosts] [text2pattern [string tolower $host]]]!=-1} {lappend hlist $host}} } } } set i 0; set list [list] foreach host $thosts { incr i; set txt "" if {$i==1} {set txt "HOST: "} {set txt " "} if {[lsearch [string tolower $hlist] [text2pattern [string tolower $host]]]==-1} {if {![string match -nocase "-telnet!*@*" $host]} {delhost $arg0 $host}} } if {$list!=[list]} {putdcc $idx "[join $list "\n"]"} } } default {putdcc $idx "Unknown DCC-CMD $what, from $from"} return 1 } if {[validuser $arg0] && [set n [hand2nick $arg0]]!="" && $n!="*"} {puthelp "WHO $n n%hnua"} return 1 } proc cybex:checkusr {nick uhost hand auth} { set found 0; set thost [list] #if {[string match -nocase *ber* $uhost]} {putcmdlog "finduser $hand ($nick!$uhost) \[$auth]"} foreach usr [userlist ] { set getauth "" if {[set getauth [getuser $usr xtra qauths]]!="" && [lsearch -exact [string tolower $getauth] [string tolower $auth]]!="-1"} { incr found 1; if {$found==1} {set fauth $getauth; set fusr $usr} if {[lsearch $thost [text2pattern $usr]]==-1} {lappend thost $usr} } } set tfound 0; set ttfound 0; if {$found>1} { set ttfound 0 foreach usr [userlist ] { set tfound 0 if {[set getauth [getuser $usr xtra qauths]]!="" && [lsearch -exact [string tolower $getauth] [string tolower $auth]]!="-1"} { foreach thosts [getuser $usr hosts] { if {[string match -nocase [text2pattern $thosts] $nick!$uhost]} {incr tfound; incr ttfound; set fauth $getauth; set fusr $usr} } } } } if {$found!=1 && $ttfound==1} {set found 1} if {$found==1} { set hfound 0 foreach host [getuser $fusr hosts] { #putcmdlog "string match -nocase p:[text2pattern $host] hm:$nick!$uhost ($hand) == [string match -nocase [text2pattern $host] $nick!$uhost]" if {[string match -nocase [text2pattern $host] $nick!$uhost]} {set hfound 1} } if {$hfound=="0"} { foreach {host lastseen} [getuser $fusr xtra permhosts] { if {[string match -nocase [text2pattern $host] $nick!$uhost]} { variable logaddremove if {$logaddremove=="1"} {putlog "add permhost $host to user $fusr // n:$nick uh:$uhost h:$hand a:$auth"} addhost $fusr $host set hfound 1 } } if {$hfound=="0" && [string match -nocase *!*@*.users.quakenet.org $nick!$uhost]} { set addhost [maskhost $nick!$uhost] set permhosts [getuser $fusr xtra permhosts] if {[lsearch [string tolower $permhosts] [text2pattern [string tolower $addhost]]]==-1} { lappend permhosts $addhost [clock second] variable logaddremove if {$logaddremove=="1"} {putlog "append permhosts with $addhost and add host $addhost to user $fusr // n:$nick uh:$uhost h:$hand a:$auth"} setuser $fusr xtra permhosts $permhosts addhost $fusr $addhost } set hfound 1 } if {$hfound=="0"} { set addhost [maskhost $nick!$uhost] set i 0; set done 0 for {set i 0} {$i<9999 && !$done} {incr i} { if {[getuser $fusr xtra temp${i}hosts]!=[list]} { set host [lindex [getuser $fusr xtra temp${i}hosts] 0]; if {[string match -nocase [text2pattern $addhost] $host] || [string match -nocase [text2pattern $host] $addhost] || [string equal $host $addhost]} { variable logaddremove if {$logaddremove=="1"} {putlog "remove lastseen ${i} // n:$nick uh:$uhost h:$hand a:$auth"} setuser $fusr xtra temp${i}hosts } } } } if {$hfound=="0"} { set addhost [maskhost $nick!$uhost] set i 0; set done 0 for {set i 0} {$i<9999 && !$done} {incr i} { if {[getuser $fusr xtra temp${i}hosts]==[list]} { variable logaddremove if {$logaddremove=="1"} { putlog "addhost $fusr $addhost - temp${i}hosts is free // n:$nick uh:$uhost h:$hand a:$auth" } setuser $fusr xtra temp${i}hosts [list $addhost [clock second] [clock second]] addhost $fusr $addhost set done 1 }; # if getuser }; # for } } { set found 0 # if $found==0 foreach {host lastseen} [getuser $fusr xtra permhosts] { if $found continue if {[string match -nocase [text2pattern $host] $nick!$uhost]} { set phosts [getuser $fusr xtra permhosts] set num [lsearch -exact [string tolower $phosts] [string tolower $host]] if {$num!=-1} { set found 1 set inc [expr 1+$num] set phosts [lreplace $phosts $inc $inc [clock second]] #variable logaddremove #if {$logaddremove=="1"} {putlog "usr: update lastseen $fusr perm $host // n:$nick uh:$uhost h:$hand a:$auth"} setuser $fusr xtra permhosts $phosts } } } if {$found==0} {foreach temp [getuser $fusr xtra] { foreach {thost tval} $temp { if {[string match -nocase temp*hosts $thost]} { foreach {hostmask lastseen created} $tval { if $found continue if {[string match -nocase [text2pattern $hostmask] $nick!$uhost]} { set found 1 #variable logaddremove #if {$logaddremove=="1"} {putlog "usr: update lastseen $fusr temp $hostmask // n:$nick uh:$uhost h:$hand a:$auth"} set tval [lreplace $tval 1 1 [clock second]] setuser $fusr xtra $thost $tval } } ; # foreach host } ; # if } ; # foreach thost } } ; # foreach temp / if }; # if $hfound==0 } { # else if $found #if {$found==0} {putcmdlog "no user found for $nick!$uhost ($hand/\002$auth\002)"} if {$found>=2} { if {[set lastwarn [getuser $fusr xtra lastqawarn]]=="" || ![string is integer $lastwarn]} {putcmdlog "init lastwarn for $fusr"; set lastwarn [expr [clock second]-10080]; setuser $fusr xtra lastqawarn $lastwarn} if {[expr [clock second]-$lastwarn]>=10080} { putlog "more then one user ([join $thost ", "]) found with this qauth ($auth), need manual host adjust $nick!$uhost ($hand/$fusr)" setuser $fusr xtra lastqawarn [clock second] } } } ; # if $found } proc cybex:checktime args { foreach ch [channels] {if [botonchan $ch] {puthelp "WHO $ch"}} foreach usr [userlist] { set chkhosts [list] set permhosts [list] set temphosts [list] set oldhosts [list] set usrhosts [getuser $usr hosts] set found 0 foreach {host lastseen} [set phosts [getuser $usr xtra permhosts]] { if {[lsearch [string tolower $usrhosts] [text2pattern [string tolower $host]]]!=-1} { set tnick [hand2nick $usr] if {$tnick!="" && $tnick!="*"} { set tuhost [getchanhost $tnick] #update timestamp if {[string match -nocase [text2pattern $host] $tnick!$tuhost] && $found==0} { #set found 1 #set pos [lsearch [string tolower $phosts] [string tolower $host*]]; set inc [expr {1+$pos}] #variable logaddremove #if {$logaddremove=="1"} {putlog "time perm: update lastseen $usr perm $host"} #setuser $usr xtra permhosts [lreplace $phosts $inc $inc [clock sec]] } #remove old variable removeperm if {[clock seconds]-$lastseen>$removeperm && ![string match *-telnet*!*@* $host]} { variable logaddremove if {$logaddremove=="1"} {putlog "$usr to old perm $host $lastseen [duration [expr [clock sec]-$lastseen]] // n:$tnick"} delhost $usr $host lappend oldhosts $host } } } } set found 0 foreach temp [getuser $usr xtra] { foreach {thost tval} $temp { if {[string match -nocase temp*hosts $thost]} { foreach {hostmask lastseen created} $tval { #update timestamp if {[lsearch [string tolower $usrhosts] [text2pattern [string tolower $hostmask]]]!=-1} { #variable logaddremove #if {$logaddremove=="1"} {putlog "time temp: update lastseen $usr temp $hostmask // lsearch l:[string tolower $usrhosts] p:[text2pattern [string tolower $hostmask]] == [lsearch [string tolower $usrhosts] [text2pattern [string tolower $hostmask]]]"} #set found 1 #setuser $usr xtra $thost [list $hostmask [clock second] $created] } { variable logaddremove if {$logaddremove=="1"} {putlog "$usr has inactive temp $hostmask [duration [expr [clock sec]-$lastseen]] ($thost) // n:$tnick"} setuser $usr xtra $thost lappend oldhosts $hostmask } #remove old variable removetemp #putcmdlog "[expr [clock seconds]-$lastseen]>$removetemp && ![string match *-telnet*!*@* $hostmask] $usr $hostmask" if {[clock seconds]-$lastseen>$removetemp && ![string match *-telnet*!*@* $hostmask]} { variable logaddremove if {$logaddremove=="1"} {putlog "$usr to old temp $hostmask [duration [expr [clock sec]-$lastseen]] ($thost) // n:$tnick"} delhost $usr $hostmask setuser $usr xtra $thost lappend oldhosts $hostmask } } } } } } } proc cybex:raw354 {from key text} { set list [split $text] set ident [lindex $list 1] set host [lindex $list 2] set nick [lindex $list 3] set auth [lindex $list 4] if {$auth!="0"} {cybex:checkusr $nick $ident@$host [finduser *!$ident@$host] $auth} return 0 } proc thommey:refresh_time {{args ""}} { variable blocked if {[info exists blocked] && $blocked==1} {putcmdlog "blocked exists, there must be a problem in the script"; return 0} set blocked 1 thommey:refresh utimer 5 [list unset ::qauthautohost::blocked] } proc thommey:refresh {{chan ""}} { set toask [list] if {$chan == ""} { foreach chn [channels] { foreach nick [chanlist $chn] { set auth 0 if {[set auth [getchanlogin $nick $chn]] == "0"} { lappend toask $nick } { set uhost [getchanhost $nick $chn]; set hand * if {[set hand [finduser *!$uhost]]=="*"} {cybex:checkusr $nick $uhost $hand $auth} } } } if {[llength $toask]} { set toask [lsort -unique $toask] set toask2 [list] foreach n $toask { lappend toask2 $n if {[string length [join $toask2]] > 400} { puthelp "WHO [join $toask2 ","] n%hnua" set toask2 [list] } } if {[llength $toask2]} { puthelp "WHO [join $toask2 ","] n%hnua" } } } { puthelp "WHO $chan c%hnua" } return 0 } proc text2pattern {text} { regsub -all -- {\\} $text {\\\\} text regsub -all -- {\}} $text {\}} text regsub -all -- {\{} $text {\{} text regsub -all -- {\]} $text {\]} text regsub -all -- {\[} $text {\[} text return $text } } # Maskhost-Fix # written by thommey # Lets maskhost (used by most scripts to select banmask/usermask) # return *!*@HOST if the thing you set here matches the host # Usable most likely on Quakenet and Undernet # to handle *!*@*.users.network.org masks correctly # Set here now the masks (ex: "*.users.undernet.org"). # One line per mask. It is matched against nick!ident@host. set ::fakehostmasks { *.users.quakenet.org *.users.undernet.org } if {[info commands maskhost_r] != "maskhost_r"} { rename maskhost maskhost_r } proc maskhost {host} { global fakehostmasks foreach fmask [split $fakehostmasks \n] { set fmask [string trim $fmask] if {$fmask == ""} { continue } regsub -all {\\} $fmask {\\\\} fmask regsub -all {\[} $fmask {\\\[} fmask regsub -all {\]} $fmask {\\\]} fmask if {[string match -nocase $fmask $host]} { return *!*@[lindex [split $host @] end] } } if {[string match -nocase *!~* $host]} { return *![string map [list ~ \?] [lindex [split $host !] end]] } return [maskhost_r $host] } putlog "Maskhost-Fix by thommey and C*Bex Qauth-autohost loaded" return "load \"[info script]\" ,8,1\nready\nrun"