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.

Request whois reply

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
User avatar
play4free2
Voice
Posts: 34
Joined: Sat Nov 23, 2013 1:42 am
Contact:

Request whois reply

Post by play4free2 »

Hi,

I found this code with Google:

Code: Select all

bind raw - "NOTICE" findwhois
proc findwhois {nick junk arg} {
  if {![string match "*did a /whois*" $arg]} {
    return 0
  }
  putlog "Hey! [lrange $arg 4 end]"
  return 0
}
But what I am looking for is one that instead of doing putlog it notices the nick that did the whois on the bot instead. The bot is an oper running on Unreal with Anope Services.

Thanks in advance for any help
Image
420-HIGHTIMES IRC Network
User avatar
Get_A_Fix
Master
Posts: 206
Joined: Sat May 07, 2005 6:11 pm
Location: New Zealand

Post by Get_A_Fix »

Most easiest way I guess would be

Code: Select all

set noticesend "This would be what's sent to the user"
set noticesend2 "This could be a second line, or just remove it."

bind raw - "NOTICE" findwhois
proc findwhois {from keyword arg} {
  global noticesend noticesend2
  if {[string match "*did a /whois*" $arg]} {
      set nick [lindex [split $arg] 2]
      if {![isbotnick $nick]} {
      putquick "NOTICE $nick :$noticesend"
      putquick "NOTICE $nick :$noticesend2"
    }
  }
}
You can make it say anything, or remove whatever you want.
Last edited by Get_A_Fix on Fri Dec 13, 2013 6:23 pm, edited 2 times in total.
We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals.
User avatar
play4free2
Voice
Posts: 34
Joined: Sat Nov 23, 2013 1:42 am
Contact:

Post by play4free2 »

Thanks Get_A_Fix,

Just what I was looking for!

Eventually I want to get one that replays like mine does:

UserNick I have been whois'd 245 times. Your hostmask is: (ident@127.0.0.1) Your whois on: 420-HIGHTIMES Network this: Tuesday 10/12/2013 at: 13:27:09 has been logged and identifed for security purposes.

/me needs to learn more .tcl

Thanks again
Image
420-HIGHTIMES IRC Network
User avatar
Get_A_Fix
Master
Posts: 206
Joined: Sat May 07, 2005 6:11 pm
Location: New Zealand

Post by Get_A_Fix »

Really?

I have mine like this, since making the code. I'll probably leave it running, since it directs users to the appropriate places.

Code: Select all

-
OperHelp is OperHelp@IRCSpeed.assistant * IRCSpeed Oper Assistant
OperHelp is a registered nick
OperHelp on @#vHost 
OperHelp using *.ircspeed.org IRCSpeed Client Server
OperHelp is a Bot on IRCSpeed
OperHelp has been idle 17secs, signed on Tue Dec 03 00:05:28
OperHelp End of /WHOIS list.
-
-OperHelp- For General Help please join #Help - Or for direct IRCSpeed Staff assistance, join #OperHelp
That's what anyone see's on a /whois - but that is specific to the bot and its purpose I guess. OperHelp is a tool.
Last edited by Get_A_Fix on Tue Dec 17, 2013 10:25 pm, edited 1 time in total.
We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

if {[string tolower $arg] != [string tolower $botnick]} {
Really? Why do you have to reinvent the wheel and not stick with using isbotnick function instead?
Once the game is over, the king and the pawn go back in the same box.
User avatar
play4free2
Voice
Posts: 34
Joined: Sat Nov 23, 2013 1:42 am
Contact:

Post by play4free2 »

Get_A_Fix

This is what I have come up with so far out of the one I had and the one you wrote.

Code: Select all

set adminchan "#channel"

bind raw - "NOTICE" findwhois
proc findwhois {from keyword arg} {
  global botnick adminchan network
  if {[string match "*did a /whois*" $arg]} {
    if {[string tolower $arg] != [string tolower $botnick]} {
      set nick [lindex [split $arg] 2]
      set hostmask [lindex [split $arg] 3]
      putquick "NOTICE $nick :\00308,1Hey! $nick, \00307Your hostmask is: \00315$hostmask \00304Your whois on: \00315$network Network \00304has been logged and identifed for security purposes.\003"
      putserv "PRIVMSG $adminchan :Hey! $nick $hostmask did a /whois on me."
      return 0
    }
  }
}
I still need to figure out how to add the day, date and time like this "Tuesday 10/12/2013 at: 13:27:09" to the reply the user that did the whois gets.

@caesar
I am new to writing .tcl is there something I missed here:
if {[string tolower $arg] != [string tolower $botnick]} {

Really? Why do you have to reinvent the wheel and not stick with using isbotnick function instead?

As in a different way to write it?
Image
420-HIGHTIMES IRC Network
User avatar
heartbroken
Op
Posts: 110
Joined: Thu Jun 23, 2011 11:15 pm
Location: somewhere out there

Post by heartbroken »

Code: Select all

I still need to figure out how to add the day, date and time like this "Tuesday 10/12/2013 at: 13:27:09" to the reply the user that did the whois gets. 
 

->> http://www.tcl.tk/man/tcl8.6/TclCmd/clock.htm

Code: Select all

puts [clock format [clock scan "0 day" -base [clock seconds]] -format "%Y-%B-%d %A %H:%M:%S"]

> 2013-December-13 Friday 02:53:10
Life iS Just a dReaM oN tHE wAy to DeaTh
User avatar
play4free2
Voice
Posts: 34
Joined: Sat Nov 23, 2013 1:42 am
Contact:

Post by play4free2 »

Thanks for the help with the time date part heartbroken

Here is what I came up with:

Code: Select all

set adminchan "#channel"

bind raw - "NOTICE" findwhois
proc findwhois {from keyword arg} {
  global adminchan network
  if {[string match "*did a /whois*" $arg]} {
    set nick [lindex [split $arg] 2]
    set hostmask [lindex [split $arg] 3]
    putquick "NOTICE $nick :\00315,1Hey! $nick, \00304Your hostmask is: \00315$hostmask \00304Your whois on: \00315$network IRC Network \00304this: \00315[clock format [clock scan "0 day" -base [clock seconds]] -format "%A %b. %d, %Y \00304at: \00315%H:%M:%S"] \00304has been logged and identifed for security purposes.\003"
    putserv "PRIVMSG $adminchan :Hey! $nick $hostmask did a /whois on me."
    return 0
  }
}
I have tested this and don't get any errors on: eggdrop v1.6.21

Thanks to everyone for their input and help :)
Image
420-HIGHTIMES IRC Network
User avatar
Get_A_Fix
Master
Posts: 206
Joined: Sat May 07, 2005 6:11 pm
Location: New Zealand

Post by Get_A_Fix »

caesar wrote:
if {[string tolower $arg] != [string tolower $botnick]} {
Really? Why do you have to reinvent the wheel and not stick with using isbotnick function instead?
Original Code Amended.
I have used string tolower for a long time, it's just out of habit and the way I taught myself to code. The isbotnick function came out later, but is a more efficient method to use.
play4free2 wrote: Thanks to everyone for their input and help :)
As long as you're happy. Like I said, I've even started using this script on my Operbot, but I've added protection against the command being flooded. This is done by simply adding an ignore for the unknown user, for 5sec or 10sec, even 60sec.
We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals.
r
riham
Voice
Posts: 1
Joined: Sat Nov 29, 2014 3:13 am

Post by riham »

I have tested the Get_A_Fix's tcl but is not possible to set a ban time , the kick message and the the % of join & quit, but only the seconds before the quit.
The first tcl allprotections is really complicated to disable all is not simple, I try with #test# for disable some functions, but on rehash the bot give me error.
I'm not expert on modify the tcl script, but is possible in some tcl write for the join/part flood, change the part with the quit for to work it?

Thanks and salute
Our Actual Exams and pass4sure.co.uk exam provide you 100% pass guarantee. You can get access to N10-005
User avatar
Get_A_Fix
Master
Posts: 206
Joined: Sat May 07, 2005 6:11 pm
Location: New Zealand

Post by Get_A_Fix »

riham wrote:I have tested the Get_A_Fix's tcl but is not possible to set a ban time , the kick message and the the % of join & quit, but only the seconds before the quit.
The first tcl allprotections is really complicated to disable all is not simple, I try with #test# for disable some functions, but on rehash the bot give me error.
I'm not expert on modify the tcl script, but is possible in some tcl write for the join/part flood, change the part with the quit for to work it?

Thanks and salute
Firstly, riham, I think you've posted in the wrong thread. This thread is for a /whois script on an operbot. Secondly, because I'm not a moderator and am unable to move your question to the appropriate place, I'll just answer it here.
There are a couple of things you could use. For example, this script below will allow you to manage join/part and join/quit.

Code: Select all

# Commands: (these are available to Global OPs and Channel Master's and above)
# ---------
# !joinpart on|off
# !joinquit on|off
# /msg yourbot joinpart #channel on|off
# /msg yourbot joinquit #channel on|off

# Set global trigger to be used
set mytrig "!"

# Set time in seconds, for how long someone should have stayed joined, before they part or quit.
set jointime "10"

# ----- CODE BLOCK -----
proc getTrig {} {
  global mytrig
  return $mytrig
}

setudef flag joinpart
setudef flag joinquit

bind part - * join:part
bind sign - * join:quit
bind pub - ${pubtrig}joinpart joinpart:pub
bind pub - ${pubtrig}joinquit joinquit:pub
bind msg - joinpart joinpart:msg
bind msg - joinquit joinquit:msg

proc joinpart:pub {nick uhost hand chan arg} {
  global botnick
  if {[matchattr [nick2hand $nick] o|m $chan]} {
    if {[lindex [split $arg] 0] == ""} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getTrig]joinpart on|off"; return}

    if {[lindex [split $arg] 0] == "on"} {
      if {[channel get $chan joinpart]} {putquick "PRIVMSG $chan :\037ERROR\037: This setting is already enabled."; return}
      channel set $chan +joinpart
      puthelp "PRIVMSG $chan :Enabled JoinPart Protection for $chan"
      return
    }

    if {[lindex [split $arg] 0] == "off"} {
      if {![channel get $chan joinpart]} {putquick "PRIVMSG $chan :\037ERROR\037: This setting is already disabled."; return}
      channel set $chan -joinpart
      puthelp "PRIVMSG $chan :Disabled JoinPart Protection for $chan"
      return
    }
  }
}

proc joinquit:pub {nick uhost hand chan arg} {
  global botnick
  if {[matchattr [nick2hand $nick] o|m $chan]} {
    if {[lindex [split $arg] 0] == ""} {putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [getTrig]joinquit on|off"; return}

    if {[lindex [split $arg] 0] == "on"} {
      if {[channel get $chan joinquit]} {putquick "PRIVMSG $chan :\037ERROR\037: This setting is already enabled."; return}
      channel set $chan +joinquit
      puthelp "PRIVMSG $chan :Enabled JoinQuit Protection for $chan"
      return
    }

    if {[lindex [split $arg] 0] == "off"} {
      if {![channel get $chan joinquit]} {putquick "PRIVMSG $chan :\037ERROR\037: This setting is already disabled."; return}
      channel set $chan -joinquit
      puthelp "PRIVMSG $chan :Disabled JoinQuit Protection for $chan"
      return
    }
  }
}

proc joinpart:msg {nick uhost hand arg} {
  global botnick
  set chan [strlwr [lindex $arg 0]]
  if {[matchattr [nick2hand $nick] o|m $chan]} {
    if {[lindex [split $arg] 0] == ""} {putquick "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $botnick joinpart #channel on|off"; return}
    if {[lindex [split $arg] 1] == ""} {putquick "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $botnick joinpart $chan on|off"; return}

    if {[lindex [split $arg] 1] == "on"} {
      if {[channel get $chan joinpart]} {putquick "NOTICE $nick :\037ERROR\037: This setting is already enabled."; return}
      channel set $chan +joinpart
      putquick "NOTICE $nick :Enabled JoinPart Protection for $chan"
      return
    }

    if {[lindex [split $arg] 1] == "off"} {
      if {![channel get $chan joinpart]} {putquick "NOTICE $nick :\037ERROR\037: This setting is already disabled."; return}
      channel set $chan -joinpart
      putquick "NOTICE $nick :Disabled JoinPart Protection for $chan"
      return
    }
  }
}

proc joinquit:msg {nick uhost hand arg} {
  global botnick
  set chan [strlwr [lindex $arg 0]]
  if {[matchattr [nick2hand $nick] o|m $chan]} {
    if {[lindex [split $arg] 0] == ""} {putquick "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $botnick joinquit #channel on|off"; return}
    if {[lindex [split $arg] 1] == ""} {putquick "NOTICE $nick :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: /msg $botnick joinquit $chan on|off"; return}

    if {[lindex [split $arg] 1] == "on"} {
      if {[channel get $chan joinquit]} {putquick "NOTICE $nick :\037ERROR\037: This setting is already enabled."; return}
      channel set $chan +joinquit
      putquick "NOTICE $nick :Enabled JoinQuit Protection for $chan"
      return
    }

    if {[lindex [split $arg] 1] == "off"} {
      if {![channel get $chan joinquit]} {putquick "NOTICE $nick :\037ERROR\037: This setting is already disabled."; return}
      channel set $chan -joinquit
      putquick "NOTICE $nick :Disabled JoinQuit Protection for $chan"
      return
    }
  }
}

proc join:part {nick uhost hand chan {msg ""}} {
  global jointime
  if {[channel get $chan joinpart]} {
    set mask *!*@[lindex [split [getchanhost $nick $chan] @] 1]
    set join [getchanjoin $nick $chan]
    set part [unixtime]
    set joinpart [expr $part - $join]
    if {$joinpart <= $jointime} {
      if {[botisop $chan] && ![validuser [nick2hand $nick]]} {
        pushmode $chan +b $mask
      }
    }
  }
}

proc join:quit {nick uhost hand chan reason} {
  global jointime
  if {[channel get $chan joinquit]} {
    set mask *!*@[lindex [split [getchanhost $nick $chan] @] 1]
    set join [getchanjoin $nick $chan]
    set quit [unixtime]
    set joinquit [expr $quit - $join]
    if {$joinquit <= $jointime} {
      if {[botisop $chan] && ![validuser [nick2hand $nick]]} {
        pushmode $chan +b $mask
      }
    }
  }
}

putlog ".:LOADED:. - JoinPart & JoinQuit - istok @ IRCSpeed"
Or, you could also use a method like this:

Code: Select all

# Command set via DCC/Telnet Partyline
# .chanset #channel flood-join joins:seconds (example: .chanset #IRCSpeed flood-join 4:2 - setting 4 joins in 2 seconds)

## Set the Lock Modes 
# Bot will change channel mode to the modes you will specify below in case the bot will detect join flood
# To Disable Mode change set it to "" 
set joinlockmodes "mR"

## Set the time in seconds to Unlock Modes (needed even if joinlockmodes are "")
# The Bot will Unlock the channel after the specified time you will set below
set unlocktime "45"

## Set the time in minutes to Unban (needed even if joinlockmodes are "")
# The Bot will Unban the user after the specified time you will set below
set unbantime "60"

# Set the Kick Message you would like, if the user(s) are still on Channel.
set kickmsg "\037J\037\002oin\002 \037F\037\002lood\002 \037D\037\002etected\002"

# BAN Types are given below;
# 1 - *!*@some.domain.com 
# 2 - *!*@*.domain.com
# 3 - *!*ident@some.domain.com
# 4 - *!*ident@*.domain.com
# 5 - *!*ident*@some.domain.com
# 6 - *nick*!*@*.domain.com
# 7 - *nick*!*@some.domain.com
# 8 - nick!ident@some.domain.com
# 9 - nick!ident@*.host.com
set bantype 1

###########################
# CONFIGURATION ENDS HERE #
###########################
bind flud - join joinflood
proc joinflood {nick uhost hand type chan} {
  global joinlockmodes unbantime unlocktime kickmsg
  if {![botisop $chan] && [validuser [nick2hand $nick]] && [isop $nick $chan] && [isvoice $nick $chan]} {return}
   set banmask [make:banmask $uhost $nick]
   putquick "MODE $chan +$joinlockmodes"
   pushmode $chan +b $banmask
   putquick "KICK $chan $nick :$kickmsg."
   utimer $unlocktime [list putquick "MODE $chan -$joinlockmodes"]
   timer $unbantime [list pushmode $chan -b $banmask]
}

proc make:banmask {uhost nick} {
 global bantype
  switch -- $bantype {
   1 { set banmask "*!*@[lindex [split $uhost @] 1]" }
   2 { set banmask "*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
   3 { set banmask "*!*$uhost" }
   4 { set banmask "*!*[lindex [split [maskhost $uhost] "!"] 1]" }
   5 { set banmask "*!*[lindex [split $uhost "@"] 0]*@[lindex [split $uhost "@"] 1]" }
   6 { set banmask "*$nick*!*@[lindex [split [maskhost $uhost] "@"] 1]" }
   7 { set banmask "*$nick*!*@[lindex [split $uhost "@"] 1]" }
   8 { set banmask "$nick![lindex [split $uhost "@"] 0]@[lindex [split $uhost @] 1]" }
   9 { set banmask "$nick![lindex [split $uhost "@"] 0]@[lindex [split [maskhost $uhost] "@"] 1]" }
   default { set banmask "*!*@[lindex [split $uhost @] 1]" }
   return $banmask
  }
}

putlog ".:LOADED:. JoinFlood.Check - istok @ IRCSpeed"
Allprotection.tcl is a huge script. It is rather bloated, but still gets the job done. I prefer to load specific scripts for specific events, and sometimes that can mean it reacts or triggers faster than bigger scripts like Allprotection.

You can use the top script, the bottom script, or all of it. It's up to you, and you may want to test which works best and stick with that.
We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals.
Post Reply