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.

debug on connect

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
P
PeLL
Voice
Posts: 28
Joined: Fri Mar 04, 2011 10:59 am
Location: spain
Contact:

debug on connect

Post by PeLL »

Hello,
I want to ask for help on this simple script that I use for debug .
If possible remove parentheses ( ) and brackets [ ] .

Code: Select all

set outputchan "#debug"
bind raw - NOTICE server:notices
 
proc server:notices {from keyword text} {
     global outputchan
         if {[string match -nocase "*client connecting on port 66??*" $text]} {
		 set port [lindex [split $text] 7]
          set nick [lindex [split $text] 10]
	set IP [lindex [split $text] 11]
           set hostmask [lindex [split $text] 12]
    set real [lindex [split $text] 13]
    set name [lindex [split $text] 14]
    set long [lindex [split $text] 15]
    set very [lindex [split $text] 16]
    set loong [lindex [split $text] 17]
    set final [lindex [split $text] 18]

          set connectport [lindex [split $text] 7]
          putquick "PRIVMSG $outputchan 25server\002:\003 $nick \0021IP-real\002: $IP \0021RN\002 $hostmask $real $name $long $very $loong $final \0021Port:\002 $port \002"
           return 0
        }
 
 }


Each connection connects from :

dbug-server server: Ruler-!jmch@47.134.120.128 IP-real (47.134.120.128) RN [I3wjfCN8LzIwMjIvMTAvMDYvNjMzZTIwZDg4NWRkZl9sYXJnZS5qcGc=] Puerto: 6667
dbug-server server: Fujio!cdo@97.118.203.89 IP-real (97.118.203.89) RN [I3wjfCN8LzIwMjIvMTAvMDYvNjMzZTIwZDg4NWRkZl9sYXJnZS5qcGc=] Puerto: 6667
I would like to remove the parentheses from : ip-real and the brackets from realname

Thank you very much for your time .
User avatar
CrazyCat
Revered One
Posts: 1236
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

I think the way you parse the string could be change using a regexp.
I don't know exactly how is the text you get, so I can't write it. Could you provide 2 complete connect string to let me help you ?

The alternative should be to change the way you set IP and realname:

Code: Select all

set outputchan "#debug"
bind raw - NOTICE server:notices
 
proc server:notices {from keyword text} {
   global outputchan
   if {[string match -nocase "*client connecting on port 66??*" $text]} {
      set port [lindex [split $text] 7]
      set nick [lindex [split $text] 10]
      set IP [string range [lindex [split $text] 11] 1 end-1]
      set hostmask [lindex [split $text] 12]
      set realname [string range [join [lrange [split text] 13 18]] 1 end-1]
      set connectport [lindex [split $text] 7]
      putquick "PRIVMSG $outputchan 25server\002:\003 $nick \0021IP-real\002: $IP \0021RN\002 $hostmask $realname \0021Port:\002 $port \002"
      return 0
   }
}
P
PeLL
Voice
Posts: 28
Joined: Fri Mar 04, 2011 10:59 am
Location: spain
Contact:

Post by PeLL »

Hello , CrazyCat ;

I'll post some proxy connections about inspircd :
[23:22] -irc.server.net- *** CONNECT: Client connecting on port 6667 (class irc): mlel0d_b0b!nogc@187.208.208.17 (187.208.208.17) [onoq]
[23:22] -irc.server.net- *** CONNECT: Client connecting on port 6667 (class irc): CiSimca__!lbvd@187.147.53.21 (187.147.53.21) [khlvu]
[23:22] -irc.server.net- *** CONNECT: Client connecting on port 6667 (class irc): SePettern!kjop@187.213.249.32 (187.213.249.32) [lpw]
[23:22] -irc.server.net- *** CONNECT: Client connecting on port 6667 (class irc): CiKibbo!uix@187.232.48.93 (187.232.48.93) [euk]

I post some examples of connection to the server.
Right now the real ip does not show the brackets ( )
But the realname does appear in square brackets [ ] .

23:45:31 pell server: S05-kx8551951!Ircap@ip72-195-34-60.oc.oc.cox.net IP-real: 72.195.34.60 RN [I3wjfCN8LzIwMjIvMTAvMDYvNjMzZTIwZDg4NWRkZl9sYXJnZS5qcGc=] Port: 6667
23:45:32 pell server: S05-kv2798442!Ircap@142.54.232.6 IP-real: 142.54.232.6 RN [I3wjfCN8LzIwMjIvMTAvMDYvNjMzZTIwZDg4NWRkZl9sYXJnZS5qcGc=] Port: 6667
23:45:32 pell server: S05-zq56519805!Ircap@221.10.151.38 IP-real: 221.10.151.38 RN [I3wjfCN8LzIwMjIvMTAvMDYvNjMzZTIwZDg4NWRkZl9sYXJnZS5qcGc=] Port: 6667
23:45:35 pell server: S05-vy7659207!Ircap@ip72-195-34-58.oc.oc.cox.net IP-real: 72.195.34.58 RN [I3wjfCN8LzIwMjIvMTAvMDYvNjMzZTIwZDg4NWRkZl9sYXJnZS5qcGc=] Port: 6667

23:47:58 pell server: S05-xy36904851!Ircap@184.181.217.206 IP-real: 184.181.217.206 RN [ircap;IRcap[8.7] Port: 6667
23:47:58 pell server: S05-kv76419113!Ircap@107.181.168.145 IP-real: 107.181.168.145 RN [xchat;failscripts] Port: 6667
23:48:00 pell server: S05-lm43617252!Ircap@223.112.53.2 IP-real: 223.112.53.2 RN [xscript;script Port: 6667
23:48:02 pell server: S05-yx14603099!Ircap@115.127.85.221 IP-real: 115.127.85.221 RN [debian;tuX Port: 6667
Thank you very much for your help and time.
s
simo
Revered One
Posts: 1078
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

Try this if it works as expected.

Code: Select all


set outputchan "#debug"
bind raw - NOTICE server:notices
 
proc server:notices {from keyword text} {
  global outputchan
  set text [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]

  if {[regexp -nocase { REMOTECONNECT: Client connecting at (\S+\:) ([^!]+)!([^@]+)@(\S+) \(([0-9a-f.:]+)\) \[(.*)\]} $text ->  server nick ident host ip realname] } {  putquick "PRIVMSG $outputchan :\002\00312,00 Server\: [string trimright $server ":"] \00307 Nick\:  $nick  \00310 IP\: $ip \00302 Host\: $host \00310 RealName\: $realname \002\017" }


  if {![regexp -nocase { CONNECT: Client connecting on port (\d+) \(class (\S+)\): ([^!]+)!([^@]+)@(\S+) \(([0-9a-f.:]+)\) \[(.*)\]} $text -> port class nick ident host  ip realname]} { return 0 }
  putquick "PRIVMSG $outputchan :\002\00312,00 Nick\: $nick \00310 IP\: $ip \00302 Host\: $host \00310 ReaLName\: $realname \00306  Port\: $port \002\017"

   return 0

}


Ive tested it and it seems to work.
Last edited by simo on Sat Sep 02, 2023 9:27 am, edited 1 time in total.
s
simo
Revered One
Posts: 1078
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

Btw there is a module in inspircd chanlog that does output to a channel as well like connect disconnect nickchange filters and so on
P
PeLL
Voice
Posts: 28
Joined: Fri Mar 04, 2011 10:59 am
Location: spain
Contact:

Post by PeLL »

CrazyCat, thank you very much for your work and time.
Looking at the code with another previous one that you helped me, I did not think that I could put almost the same ...
Again, thank you very much .
P
PeLL
Voice
Posts: 28
Joined: Fri Mar 04, 2011 10:59 am
Location: spain
Contact:

Post by PeLL »

Ohh Simo, I haven't seen your code until now...
Anope services is too log.
With this I only see what enters the chat to act on certain occasions.
Thank you very much, I'm going to test.

PD: where do I find the list of colors to play with colors?
s
simo
Revered One
Posts: 1078
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

check this thread for the use of colors :

http://forum.egghelp.org/viewtopic.php?p=104917
Post Reply