egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

get info of user on connect with bind raw notice

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
simo
Master


Joined: 22 Mar 2015
Posts: 316

PostPosted: Sat Mar 02, 2019 6:55 pm    Post subject: get info of user on connect with bind raw notice Reply with quote

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:


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
Back to top
View user's profile Send private message
heartbroken
Halfop


Joined: 23 Jun 2011
Posts: 90
Location: somewhere out there

PostPosted: Sat Mar 02, 2019 9:56 pm    Post subject: Reply with quote

Code:
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
Back to top
View user's profile Send private message
simo
Master


Joined: 22 Mar 2015
Posts: 316

PostPosted: Sun Mar 03, 2019 12:01 pm    Post subject: Reply with quote

working nicely thanx heartbroken apreciated
Back to top
View user's profile Send private message
simo
Master


Joined: 22 Mar 2015
Posts: 316

PostPosted: Sun Mar 03, 2019 6:10 pm    Post subject: Reply with quote

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

Quote:

puthelp "PRIVMSG #test :$nick $ident $host $ip $client $ssl"

Back to top
View user's profile Send private message
heartbroken
Halfop


Joined: 23 Jun 2011
Posts: 90
Location: somewhere out there

PostPosted: Sun Mar 03, 2019 8:58 pm    Post subject: Reply with quote

Code:
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
}

_________________
Life iS Just a dReaM oN tHE wAy to DeaTh


Last edited by heartbroken on Sun Mar 03, 2019 9:52 pm; edited 1 time in total
Back to top
View user's profile Send private message
simo
Master


Joined: 22 Mar 2015
Posts: 316

PostPosted: Sun Mar 03, 2019 9:31 pm    Post subject: Reply with quote

tried it and both ssl and non ssl users seem to output first one without the client and ssl
Back to top
View user's profile Send private message
heartbroken
Halfop


Joined: 23 Jun 2011
Posts: 90
Location: somewhere out there

PostPosted: Sun Mar 03, 2019 9:57 pm    Post subject: Reply with quote

my bad! code edited.
_________________
Life iS Just a dReaM oN tHE wAy to DeaTh
Back to top
View user's profile Send private message
simo
Master


Joined: 22 Mar 2015
Posts: 316

PostPosted: Sun Mar 03, 2019 10:01 pm    Post subject: Reply with quote

hm same result i dont see any {} tho in the code since its used by {clients}
in:

Quote:

*** Client connecting: nick (ident@host) [ip] {clients} [secure ECDHE-RSA-AES256-SHA]
Back to top
View user's profile Send private message
heartbroken
Halfop


Joined: 23 Jun 2011
Posts: 90
Location: somewhere out there

PostPosted: Sun Mar 03, 2019 10:37 pm    Post subject: Reply with quote



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
Back to top
View user's profile Send private message
simo
Master


Joined: 22 Mar 2015
Posts: 316

PostPosted: Sun Mar 03, 2019 10:50 pm    Post subject: Reply with quote

hm ok

all i get as output for both sll and non ssl is

Quote:

nick ident host ip
Back to top
View user's profile Send private message
simo
Master


Joined: 22 Mar 2015
Posts: 316

PostPosted: Sun Mar 03, 2019 10:53 pm    Post subject: Reply with quote

the [lindex [split $text :] 1] part was off i changed to [lindex [split $text :] 2]

then it worked

excellent thank u very much apreciated
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber