This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post . Click the X in the top right-corner of this box to dismiss this message.
Help for those learning Tcl or writing their own scripts.
Gulio
Halfop
Posts: 74 Joined: Sun Nov 01, 2020 11:53 am
Post
by Gulio » Sat Jul 31, 2021 12:20 pm
how can i get exp regex to get nick iden ip and via WEBIRC info
and nick iden ip continent country countrycode this info
On Connect to be 1 regex for all this 3 info notice
Code: Select all
if {[string match *!*@* $from] || ![string match -nocase "*client connecting*" $text] || ![string match -nocase "*is connecting from IP*" $text]} { return }
regexp {:\ ([^ ]+)\s\(([^@]+)@([^\)]+)\)\s\[([^\]]+)} $text - nick ident host ip secure reputation via WEBIRC continent country countrycode
Code: Select all
[18:09:46] -NOTICE- *** Client connecting: ENDRI (Mibbit@187.89.156.44) [187.89.156.44] [class: clients] [secure: TLSv1.3-TLS_CHACHA20_POLY1305_SHA256] [reputation: 36]
[18:51:55] *** irc.test.com sends: *** Nick: ENDRI Ident: Mibbit is connecting from IP: 187.89.156.44 via WEBIRC
[18:51:55] *** irc.test.com sends: *** Nick:ENDRI Ident: Mibbit is connecting from IP: 187.89.156.44 (Europe/IT) Italy
Gulio
Halfop
Posts: 74 Joined: Sun Nov 01, 2020 11:53 am
Post
by Gulio » Sun Aug 01, 2021 12:11 am
is give me 1 error her e how to fix this ?
Code: Select all
[06:04:31] Tcl error [massconnectflood]: can't read "host": no such variable
Code: Select all
set mhrp(flood) 10:30
set mhrp(nicks) {}
set mhrp(on) 0
set mhrp(exclude) {"*secure*" "*.irccloud.com" "*.mibbit.com"}
set mhrp(chanmode) "#test #test1 #test2 #test3"
set chanrep "#services"
bind raw - NOTICE massconnectflood
proc massconnectflood {from key text} {
if { $::mhrp(on) == 1 } { return }
if {[string match *!*@* $from] || (![string match "*Client connecting*" $text] && ![string match "*is connecting from IP*" $text])} { return }
regexp {:\ ([^ ]+)\s\(([^@]+)@([^\)]+)\)\s\[([^\]]+)} $text - nick ident host ip
foreach exclude $::mhrp(exclude) {
if {[string match -nocase $exclude $host] } { return }
}
if {[string match *secure* $text]} { return }
if {[string match *WEBIRC* $text]} { return }
raw notiice
Code: Select all
[06:28:28] [@] irc.test.com1 NOTICE X :*** Client connecting: Aldoo (Mibbit@185.174.109.88) [185.174.109.88] [reputation: 1760]
[06:28:28] [@] irc.test.com2 NOTICE X :*** Nick: Aldoo Ident: Mibbit is connecting from IP: 185.174.109.88 via WEBIRC
[06:28:28] [@] irc.test.com3 NOTICE X :*** Nick: Aldoo Ident: Mibbit is connecting from IP: 185.174.109.88 (Europe/IT) Italy
Last edited by
Gulio on Mon Aug 02, 2021 8:25 am, edited 1 time in total.
CrazyCat
Revered One
Posts: 1296 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Mon Aug 02, 2021 6:31 am
You can't use only one regex to parse 3 different strings.
your regexp works for the normal connection notice, the two other don't have the hostmask.
The question you have to ask yourself is why do you want to parse the 3 strings as you're checking a connexion flood, so only the first one is important ?
Gulio
Halfop
Posts: 74 Joined: Sun Nov 01, 2020 11:53 am
Post
by Gulio » Mon Aug 02, 2021 8:16 am
CrazyCat cozz 1 website dont have tls secure connection only the notice info input of connected via WEBIRC,
also on connection is not trigger when blacklist match them first is trigger only when is find 10 user from the website without secure for that i added that second string to match via webirc so cant trigger on mass connection
The bot need to trigger only when 10 connection for 30 seconds dont have secure connection and dont have connected via webirc. Is work in 1 network with 1 server but on other network with 5 servers linked hub is not work is trigger from 3 5 connection of website without tls secure.
Code: Select all
[14:15:52] -NOTICE- *** Client connecting: Aurelia (aurelia@174.77.111.196) [174.77.111.196] [class: clients] [reputation: 1290]
[14:15:52] -NOTICE- *** Client connecting: Aileen (aileen@198.8.94.170) [198.8.94.170] [class: clients] [reputation: 633]
[14:15:52] -NOTICE- *** Client connecting: Diana (diana@98.178.72.8) [98.178.72.8] [class: clients] [reputation: 766]
[14:15:52] -NOTICE- *** Client connecting: Karen (karen@98.162.96.41) [98.162.96.41] [class: clients] [reputation: 421]
[14:15:52] -NOTICE- *** Client connecting: Clemmy (clemmy@wsip-98-185-83-121.ri.ri.cox.net) [98.185.83.121] [class: clients] [reputation: 770]
[14:15:52] -NOTICE- *** Client connecting: Dinny (dinny@72.206.181.105) [72.206.181.105] [class: clients] [reputation: 58]
[14:15:52] -NOTICE- *** Client connecting: Calli (calli@70.185.68.155) [70.185.68.155] [class: clients] [reputation: 731]
[14:15:52] -NOTICE- *** Client connecting: Sibylla (sibylla@72.223.168.73) [72.223.168.73] [class: clients] [reputation: 1225]
[14:15:52] -NOTICE- *** Client connecting: Oneida (oneida@72.221.196.145) [72.221.196.145] [class: clients] [reputation: 2294]
[14:15:53] -NOTICE- *** Client connecting: Beverly (beverly@184.181.217.210) [184.181.217.210] [class: clients] [reputation: 784]
[14:15:53] *** Returning because MASSCONNFLUD is not currently enabled
Code: Select all
set mhrp(flood) 10:30
set mhrp(nicks) {}
set mhrp(on) 0
set mhrp(exclude) {"*secure*" "*.irccloud.com" "*.mibbit.com"}
set mhrp(chanmode) "#test #test1 #test2 #test3"
set chanrep "#test"
bind raw - NOTICE massconnectflood
proc massconnectflood {from key text} {
putlog "*** Executing \{[info level 0]\}"
if { $::mhrp(on) == 1 } { putlog "*** Returning because MASSCONNFLUD is not currently enabled" ; return }
if {[string match *!*@* $from] || (![string match "*Client connecting*" $text] && ![string match "*is connecting from IP*" $text])} { return }
regexp {:\ ([^ ]+)\s\(([^@]+)@([^\)]+)\)\s\[([^\]]+)} $text - nick ident host ip
if {![info exists host]} { return }
foreach exclude $::mhrp(exclude) {
if {[string match -nocase $exclude $host] } { return }
}
if {[string match *secure* $text]} { return }
if {[string match *WEBIRC* $text]} { return }
set target [split $::mhrp(flood) :]
set max [lindex $target 0]
set seconds [lindex $target 1]
lappend ::mhrp(nicks) $nick
# we append $mhrp(nicks) with the new connection
utimer $seconds [list remnick $nick]
# we will remove this entry in $seconds (5)
if {[llength $::mhrp(nicks)] >= $max} {
#putlog "*** MASSCONNFLUD triggered"
# comparing size of mhrp(nicks) and target
puthelp "PRIVMSG $::chanrep :!gline on"
set ::mhrp(on) 1
set ::mhrp(nicks) {}
utimer 60 [list massconnectunflood]
#putlog "utimer 60 [list massconnectunflood]"
foreach chan $::mhrp(chanmode) {
putserv "SAMODE $chan +W"
#putlog "Setting +W on $chan"
}
}
}
proc massconnectunflood {} {
#putlog "*** Executing \{[info level 0]\}"
puthelp "PRIVMSG $::chanrep :!gline off"
set ::mhrp(on) 0
#putlog "$::mhrp(on) 0"
foreach chan $::mhrp(chanmode) {
putserv "SAMODE $chan -W"
}
}
proc remnick {nick} {
#putlog "*** Executing \{[info level 0]\}"
set ::mhrp(nicks) [lreplace $::mhrp(nicks) [lsearch $::mhrp(nicks) $nick] [lsearch $::mhrp(nicks) $nick]]
}
CrazyCat
Revered One
Posts: 1296 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Mon Aug 02, 2021 8:39 am
Ok, so as alway, you didn't give all the informations and your examples are incomplete.
As I said, you have to use 2 regexp:
Code: Select all
if {[string match *!*@* $from] || (![string match "*Client connecting*" $text] && ![string match "*is connecting from IP*" $text])} { return }
if {[string match "*Client connecting*" $text]} {
regexp {:\ ([^ ]+)\s\(([^@]+)@([^\)]+)\)\s\[([^\]]+)} $text - nick ident host ip
} else {
regexp {Nick:\ ([^\ ]+).+Ident:\ ([^\ ]+).+IP:\ ([0-9\.]+).+$} $text - nick ident ip
set host $ip
}
Note that in case of mibbit user, the ident will alway be "Mibbit" (if your examples are right) and the host will be the IP.
Gulio
Halfop
Posts: 74 Joined: Sun Nov 01, 2020 11:53 am
Post
by Gulio » Mon Aug 02, 2021 9:02 am
Crazycat thx but can be to match as secure: the text via WEBIRC to not trigger so i can use as exclude via WEBIRC same as secure and host ?
the host can be reverse or ip depend from users provider host is other and the ip is other but on this notice is nick iden ip connected via WEBIRC
clonex and proxy can set iden MIbbit but they are not via WEBIRC for that when is match via WEBIRC to not send msg when the 10 conn are connectedt without via WEBIRC the bot need to trigger also without secure tsl connection same.
Code: Select all
[06:28:28] [@] irc.test.com2 NOTICE X :*** Nick: Aldoo Ident: Mibbit is connecting from IP: 185.174.109.88 via WEBIRC
CrazyCat
Revered One
Posts: 1296 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Mon Aug 02, 2021 9:18 am
Gulio wrote: Crazycat thx but can be to match as secure: the text via WEBIRC to not trigger so i can use as exclude via WEBIRC same as secure and host ?
Code: Select all
[06:28:28] [@] irc.test.com2 NOTICE X :*** Nick: Aldoo Ident: Mibbit is connecting from IP: 185.174.109.88 via WEBIRC
Sorry but:
1. this is not your initial demand
2. I don't understand what you want
3. your example lack of explanation
Gulio
Halfop
Posts: 74 Joined: Sun Nov 01, 2020 11:53 am
Post
by Gulio » Mon Aug 02, 2021 9:53 am
I want to get this nick - iden - ip - via WEBIRC
with rEgex u did to read and via WEBIRC so i can exclude the 10 connection in 30 seconds with via WEBIRC who are from website
and bot to triger only when 10 connection are without "secure" && "via WEBIRC"
Code: Select all
regexp {Nick:\ ([^\ ]+).+Ident:\ ([^\ ]+).+IP:\ ([0-9\.]+).+$} $text - nick ident ip via WEBIRC
to be excluded as here
Code: Select all
if {[string match *secure* $text]} { return }
if {[string match *WEBIRC* $text]} { return }
Gulio
Halfop
Posts: 74 Joined: Sun Nov 01, 2020 11:53 am
Post
by Gulio » Mon Aug 02, 2021 10:13 am
Here i mean to exclude connection with "via webirc" same how is for "secure "connection
Code: Select all
regexp {Nick:\ ([^\ ]+).+Ident:\ ([^\ ]+).+IP:\ ([0-9\.]+).+$} via WEBIRC} $text - nick ident ip via WEBIRC
Code: Select all
set mhrp(flood) 10:30
set mhrp(nicks) {}
set mhrp(on) 0
set mhrp(exclude) {"*.irccloud.com" "*.mibbit.com"}
set mhrp(chanmode) "#test #test1 #test2 #test3"
set chanrep "#services"
bind raw - NOTICE massconnectflood
proc massconnectflood {from key text} {
if { $::mhrp(on) == 1 } { return }
if {[string match *!*@* $from] || (![string match "*Client connecting*" $text] && ![string match "*is connecting from IP*" $text])} { return }
if {[string match "*Client connecting*" $text]} {
regexp {:\ ([^ ]+)\s\(([^@]+)@([^\)]+)\)\s\[([^\]]+)} $text - nick ident host ip
} else {
regexp {Nick:\ ([^\ ]+).+Ident:\ ([^\ ]+).+IP:\ ([0-9\.]+).+$} $text - nick ident ip
set host $ip
}
foreach exclude $::mhrp(exclude) {
if {[string match -nocase $exclude $host] } { return }
}
if {[string match *secure* $text]} { return }
if {[string match *WEBIRC* $text]} { return }
set target [split $::mhrp(flood) :]
set max [lindex $target 0]
set seconds [lindex $target 1]
lappend ::mhrp(nicks) $nick
# we append $mhrp(nicks) with the new connection
utimer $seconds [list remnick $nick]
# we will remove this entry in $seconds (5)
if {[llength $::mhrp(nicks)] >= $max} {
# comparing size of mhrp(nicks) and target
puthelp "PRIVMSG $::chanrep :!gline on"
set ::mhrp(on) 1
set ::mhrp(nicks) {}
utimer 60 [list massconnectunflood]
foreach chan $::mhrp(chanmode) {
putserv "SAMODE $chan +W"
}
}
}
proc massconnectunflood {} {
puthelp "PRIVMSG $::chanrep :!gline off"
set ::mhrp(on) 0
foreach chan $::mhrp(chanmode) {
putserv "SAMODE $chan -W"
}
}
proc remnick {nick} {
set ::mhrp(nicks) [lreplace $::mhrp(nicks) [lsearch $::mhrp(nicks) $nick] [lsearch $::mhrp(nicks) $nick]]
}
Last edited by
Gulio on Mon Aug 02, 2021 10:56 am, edited 1 time in total.
Gulio
Halfop
Posts: 74 Joined: Sun Nov 01, 2020 11:53 am
Post
by Gulio » Mon Aug 02, 2021 10:44 am
CrazyCat in my test network works is match 10 connection but in real network with 5 server hub link is not match read 10 mass connection maybe script read only local not remote ?
now is set mode and send msg 2 min after mass connection and repeating send msg why ?
need only 1 time to send msg !gline on not every 1 min after is send !gline off
Code: Select all
[17:41:46] *** irc.test.com sends: *** G-Line added for *@82.64.183.22 on Mon Aug 2 14:41:48 2021 GMT
[17:41:46] *** irc.test.com sends: *** G-Line added for *@70.185.68.155 on Mon Aug 2 14:41:48 2021 GMT
[17:41:46] *** irc.test.com sends: *** G-Line added for *@98.162.96.41 on Mon Aug 2 14:41:48 2021 GMT
[17:41:46] *** irc.test.com sends: *** G-Line added for *@72.206.181.105 on Mon Aug 2 14:41:48 2021 GMT
[17:41:46] *** irc.test.com sends: *** G-Line added for *@98.185.83.121 on Mon Aug 2 14:41:48 2021 GMT
[17:41:46] *** irc.test.com sends: *** G-Line added for *@69.61.200.104 on Mon Aug 2 14:41:48 2021 GMT
[17:41:46] *** irc.test.com sends: *** G-Line added for *@184.178.172.25 on Mon Aug 2 14:41:48 2021 GMT
[17:41:46] *** irc.test.com sends: *** G-Line added for *@184.178.172.14 on Mon Aug 2 14:41:48 2021 GMT
[17:41:46] *** irc.test.com sends: *** G-Line added for *@72.223.168.73 on Mon Aug 2 14:41:48 2021 GMT
[17:41:46] *** irc.test.com sends: *** G-Line added for *@174.77.111.196 on Mon Aug 2 14:41:48 2021 GM
[17:43:45] <X> !gline on
[17:44:46] <X> !gline off
[17:45:54] <X> !gline on
[17:46:54] <X> !gline off
[17:48:38] <X> !gline on
[17:43:45] * irc.test.com sets mode: +W
[17:44:46] * irc.test.com sets mode: -W
[17:45:54] * irc.test.com sets mode: +W
[17:46:54] * irc.test.com sets mode: -W
[17:48:38] * irc.test.com sets mode: +W
putlog
Code: Select all
[18:33:40] <~X> !gline on
[17:33:40] 10 30
[17:33:40] 10
[17:33:40] 30
[17:33:40] 1
[17:34:40] ::mhrp(on) 0
[18:34:40] <~X> !gline off