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.

on connect bad realname

Help for those learning Tcl or writing their own scripts.
Post Reply
P
PeLL
Voice
Posts: 28
Joined: Fri Mar 04, 2011 10:59 am
Location: spain
Contact:

on connect bad realname

Post by PeLL »

Hello everyone .
I don't know where to put this code and that's why I created a new post.
I leave this code found in this same forum but edited by me that I can't get to work.

If it is possible to make it work...

Code: Select all

set akillname {
  "????"
  "?????"
  "???"
}

bind raw - NOTICE client:connect

proc client:connect {from keyword text} {
  global akillname
  set text [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]
  if {![regexp -nocase { CONNECT: Client connecting on port (\d+) \(class (\S+)\): ([^!]+)!([^@]+)@(\S+) \(([0-9a-f.:]+)\) \[(.*)\]} $text -> port class nick ident host ip realname]} { return 1 } {
    if {[lsearch -regexp $nick] ne -1} { return }
	if {[lsearch -regexp $realname] ne -1} { return }
    foreach realname [string tolower $akillname] {
      if {[string match -nocase *$realname* $text]} {
        # your akill thing here
		putserv "privmsg #tester hi $nick e $realname"
putserv "GLINE *@$ip flood clon"
		break  
		}
    }
  }
}
Thank you very much for the time and help.
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

this seems to work for me :

works for both remote and local server.

Code: Select all


bind raw - NOTICE On-Connect:Drone-Check
 
proc On-Connect:Drone-Check {from keyword text} {
 
  set text [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]
   if {[string match *!*@* $from]} { return 0; # not a server notice }

  if {[regexp -nocase { REMOTECONNECT: Client connecting at (\S+\:) ([^!]+)!([^@]+)@(\S+) \(([0-9a-f.:]+)\) \[(.*)\]} $text ->  server nick ident host ip realname] } {
       set realnameX1 [string map {" " ""} $realname]
       set realnameX [string length [stripcodes * $realnameX1]]
      if {($realnameX > 2 ) && ($realnameX < 6 ) } {  putserv "GLINE *@$ip 1h :flood clon" }
}

  if {[regexp -nocase { CONNECT: Client connecting on port (\d+) \(class (\S+)\): ([^!]+)!([^@]+)@(\S+) \(([0-9a-f.:]+)\) \[(.*)\]} $text -> port class nick ident host  ip realname]} {
       set realnameX1 [string map {" " ""} $realname]
       set realnameX [string length [stripcodes * $realnameX1]]
      if {($realnameX > 2 ) && ($realnameX < 6 ) } {  putserv "GLINE *@$ip 1h :flood clon" }
 }
   return 0
}

P
PeLL
Voice
Posts: 28
Joined: Fri Mar 04, 2011 10:59 am
Location: spain
Contact:

Post by PeLL »

Simo: Thank you very much for your script and time, it works very well.
Thank you so much :D
User avatar
CrazyCat
Revered One
Posts: 1304
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

It could probably be simplest:

Code: Select all

if {[regexp -nocase { REMOTECONNECT: Client connecting at (\S+\:) ([^!]+)!([^@]+)@(\S+) \(([0-9a-f.:]+)\) \[(.*)\]} $text ->  server nick ident host ip realname] }
can become:

Code: Select all

if {[regexp -nocase { REMOTECONNECT: Client connecting at (\S+\:) ([^!]+)!([^@]+)@(\S+) \(([0-9a-f.:]+)\) \[([a-z]{2,6})\]} $text ->  server nick ident host ip realname] }
If the regexp doesnt't match, it means that realname is less than 2 chars or more than 6.

Same for the second regexp.
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

thanks CC but isnt:

Code: Select all

  \[([a-z]{2,6})\]  
restricted to only a-z characters used as he didnt specify wich characters to check for i assumed all characters and not just a-z
P
PeLL
Voice
Posts: 28
Joined: Fri Mar 04, 2011 10:59 am
Location: spain
Contact:

Post by PeLL »

Okay, simplify the thesis CrazyCat , is good .
For my taste it would be better to add a set with words or characters that you want to use.
example : set badreal {"???" "fu*k*you"} <-- example
(this is a pleasure of mine)
But I repeat that it works very well.
P
PeLL
Voice
Posts: 28
Joined: Fri Mar 04, 2011 10:59 am
Location: spain
Contact:

Post by PeLL »

Simo :

That thing you put in after updating doesn't work well.
The other previous one that you posted does work very well. (I've realized now).
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

PeLL wrote:Simo :

That thing you put in after updating doesn't work well.
The other previous one that you posted does work very well. (I've realized now).
both work fine for me
Post Reply