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.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
simo
Revered One
Posts: 1108 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Sat Mar 02, 2019 6:55 pm
greetings we have an opered bot on an unrealircd 4 server and wanted to get the nick ident host ip from this server notice
-some.irc.server- : *** Client connecting: Nick (ident@host) [IP] {clients}
we where using this for another ircd type (not unrealircd) i was wondering if someone famliar with regexp to alter it to get the mentioned info fields out of the regex would be apreciated
we wanted to get: NICK IDENT HOST IP
output on channel with
puthelp "PRIVMSG #test :$nick $ident $host $ip
Code: Select all
bind raw - NOTICE serv:connectnick
proc serv:connectnick {from keyword text} {
global outputchan
if {[string match -nocase "*client connecting*" $text]} {
set nick [lindex [split $text] 3]
set ident [lindex [split $text] 4]
set host [lindex [split $text] 5]
set ip [lindex [split $text] 6]
putquick "PRIVMSG #test : $nick $ident $host $ip"
return 0
}
}
Last edited by
simo on Sun Mar 03, 2019 1:46 pm, edited 4 times in total.
heartbroken
Op
Posts: 110 Joined: Thu Jun 23, 2011 11:15 pm
Location: somewhere out there
Post
by heartbroken » Sat Mar 02, 2019 9:56 pm
Code: Select all
bind raw - NOTICE serv:connectnick
proc serv:connectnick {from key text} {
if {[string match *!*@* $from] || ![string match -nocase "*Client connecting*" $text]} { return }
if {[scan [lindex [split $text :] 2] {%[^(](%[^@]@%[^)]) [%[^]]} Nick ident host IP] == 4} {
puthelp "PRIVMSG #test :$Nick $ident $host $IP"
}
return 0
}
Life iS Just a dReaM oN tHE wAy to DeaTh
simo
Revered One
Posts: 1108 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Sun Mar 03, 2019 12:01 pm
working nicely thanx heartbroken apreciated
simo
Revered One
Posts: 1108 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Sun Mar 03, 2019 6:10 pm
i forgot to ask about ssl as well as some clients connect with ssl
and that changes the output i fiddled with it somewhat but couldnt get it to proper output
*** Client connecting: nick (ident@host) [ip] {clients} [secure ECDHE-RSA-AES256-SHA]
to output
puthelp "PRIVMSG #test :$nick $ident $host $ip $client $ssl"
heartbroken
Op
Posts: 110 Joined: Thu Jun 23, 2011 11:15 pm
Location: somewhere out there
Post
by heartbroken » Sun Mar 03, 2019 8:58 pm
Code: Select all
bind raw - NOTICE serv:connectnick
proc serv:connectnick {from key text} {
if {[string match *!*@* $from] || ![string match -nocase "*Client connecting*" $text]} { return }
if {[scan [lindex [split $text :] 1] {%[^(](%[^@]@%[^)]) [%[^]]]%[^[][%[^]]} Nick ident host IP client ssl] == 6} {
puthelp "PRIVMSG #test :$Nick $ident $host $IP $client $ssl"
} else {
scan [lindex [split $text :] 2] {%[^(](%[^@]@%[^)]) [%[^]]} Nick ident host IP
puthelp "PRIVMSG #test :$Nick $ident $host $IP"
}
return 0
}
Last edited by
heartbroken on Sun Mar 03, 2019 9:52 pm, edited 1 time in total.
Life iS Just a dReaM oN tHE wAy to DeaTh
simo
Revered One
Posts: 1108 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Sun Mar 03, 2019 9:31 pm
tried it and both ssl and non ssl users seem to output first one without the client and ssl
heartbroken
Op
Posts: 110 Joined: Thu Jun 23, 2011 11:15 pm
Location: somewhere out there
Post
by heartbroken » Sun Mar 03, 2019 9:57 pm
my bad! code edited.
Life iS Just a dReaM oN tHE wAy to DeaTh
simo
Revered One
Posts: 1108 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Sun Mar 03, 2019 10:01 pm
hm same result i dont see any {} tho in the code since its used by {clients}
in:
*** Client connecting: nick (ident@host) [ip] {clients} [secure ECDHE-RSA-AES256-SHA]
heartbroken
Op
Posts: 110 Joined: Thu Jun 23, 2011 11:15 pm
Location: somewhere out there
Post
by heartbroken » Sun Mar 03, 2019 10:37 pm
it works on tclsh and should work with eggdrop too.
if you don't want to see {} around "clients" : [regsub -all {\{|\}} $client {}]
Life iS Just a dReaM oN tHE wAy to DeaTh
simo
Revered One
Posts: 1108 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Sun Mar 03, 2019 10:50 pm
hm ok
all i get as output for both sll and non ssl is
nick ident host ip
simo
Revered One
Posts: 1108 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Sun Mar 03, 2019 10:53 pm
the [lindex [split $text :] 1] part was off i changed to [lindex [split $text :] 2]
then it worked
excellent thank u very much apreciated
simo
Revered One
Posts: 1108 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Tue Jun 09, 2020 7:50 pm
i tried this in unreal5 and it didnt seem to work no more
these are the 2 example server notices for ssl and non ssl
ssl
non ssl
using this:
Code: Select all
bind raw - NOTICE serv:connectnick
proc serv:connectnick {from key text} {
if {[string match *!*@* $from] || ![string match -nocase "*Client connecting*" $text]} { return }
if {[scan [lindex [split $text :] 2] {%[^(](%[^@]@%[^)]) [%[^]]]%[^[][%[^]]} Nick ident host IP client ssl] == 6} {
puthelp "PRIVMSG #test :$Nick $ident $host $IP $client $ssl"
} else {
scan [lindex [split $text :] 2] {%[^(](%[^@]@%[^)]) [%[^]]} Nick ident host IP
puthelp "PRIVMSG #test :$Nick $ident $host $IP"
}
return 0
}
when using both ssl and non ssl i get this output:
RandomONE uid304591 id-304591.tooting.irccloud.com 2001
simo
Revered One
Posts: 1108 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Wed Jun 10, 2020 8:16 am
i tested again and it seems to work for ipv4 only for ipv6 it doesnt seem to get all the info
Arnold_X-P
Master
Posts: 226 Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:
Post
by Arnold_X-P » Sat Dec 11, 2021 10:46 pm
apparently the code only works in unrealircd but does not work in inspircd it is possible to use regex to work in both unreal and inspircd versions
Code: Select all
bind raw - NOTICE serv:connectnick
proc serv:connectnick {from key text} {
if {[string match *!*@* $from] || ![string match -nocase "*Client connecting*" $text]} { return }
if {[scan [lindex [split $text :] 2] {%[^(](%[^@]@%[^)]) [%[^]]]%[^[][%[^]]} Nick ident host IP client ssl] == 6} {
puthelp "PRIVMSG #test :$Nick $ident $host $IP $client $ssl"
} else {
scan [lindex [split $text :] 2] {%[^(](%[^@]@%[^)]) [%[^]]} Nick ident host IP
puthelp "PRIVMSG #test :$Nick $ident $host $IP"
}
return 0
}
example variant regex (compatibility for both unreal and inspircd)
Code: Select all
{[regexp {CONNECT: Client connecting[.A-Za-z0-9 ]*: ([^ ]+) \\(([^@]+)@([^\\)]+)\\) \\[([0-9\\.]+)\\].*} $arg }
but the variant does not work someone who can help please.
simo
Revered One
Posts: 1108 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Sun Dec 12, 2021 12:16 pm
each ircd has its own server notice for connections and disconnections
so u cant have 1 to work for both its either one or the other
this is for inspircd
Code: Select all
bind raw - NOTICE serv:connectnick
proc serv:connectnick {from key text} {
if {[string match *!*@* $from]} { return }
if {![regexp -nocase { CONNECT: Client connecting on port (\d+) \(class (\S+)\): ([^!]+)!([^@]+)@(\S+) \(([0-9a-f.:]+)\) \[(.*)\]} $text -> port class nick ident host ip realname]} { return }
puthelp "PRIVMSG #test :$nick $ident $host $ip"
return 0
}