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 

Request whois reply

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


Joined: 23 Nov 2013
Posts: 33

PostPosted: Tue Dec 10, 2013 3:35 am    Post subject: Request whois reply Reply with quote

Hi,

I found this code with Google:

Code:

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
_________________

420-HIGHTIMES IRC Network
Back to top
View user's profile Send private message Visit poster's website
Get_A_Fix
Master


Joined: 07 May 2005
Posts: 206
Location: New Zealand

PostPosted: Tue Dec 10, 2013 2:05 pm    Post subject: Reply with quote

Most easiest way I guess would be

Code:

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.
_________________
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.


Last edited by Get_A_Fix on Fri Dec 13, 2013 6:23 pm; edited 2 times in total
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
play4free2
Voice


Joined: 23 Nov 2013
Posts: 33

PostPosted: Tue Dec 10, 2013 5:34 pm    Post subject: Reply with quote

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
_________________

420-HIGHTIMES IRC Network
Back to top
View user's profile Send private message Visit poster's website
Get_A_Fix
Master


Joined: 07 May 2005
Posts: 206
Location: New Zealand

PostPosted: Thu Dec 12, 2013 10:08 am    Post subject: Reply with quote

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:

-
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.
_________________
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.


Last edited by Get_A_Fix on Tue Dec 17, 2013 10:25 pm; edited 1 time in total
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Thu Dec 12, 2013 11:13 am    Post subject: Reply with quote

Quote:

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.
Back to top
View user's profile Send private message
play4free2
Voice


Joined: 23 Nov 2013
Posts: 33

PostPosted: Thu Dec 12, 2013 8:04 pm    Post subject: Reply with quote

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:
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:
Quote:
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?
_________________

420-HIGHTIMES IRC Network
Back to top
View user's profile Send private message Visit poster's website
heartbroken
Op


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

PostPosted: Thu Dec 12, 2013 8:57 pm    Post subject: Reply with quote

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


Joined: 23 Nov 2013
Posts: 33

PostPosted: Fri Dec 13, 2013 12:19 am    Post subject: Reply with quote

Thanks for the help with the time date part heartbroken

Here is what I came up with:

Code:
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 Smile
_________________

420-HIGHTIMES IRC Network
Back to top
View user's profile Send private message Visit poster's website
Get_A_Fix
Master


Joined: 07 May 2005
Posts: 206
Location: New Zealand

PostPosted: Fri Dec 13, 2013 4:52 pm    Post subject: Reply with quote

caesar wrote:
Quote:

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 Smile


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.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
riham
Voice


Joined: 29 Nov 2014
Posts: 1

PostPosted: Sat Nov 29, 2014 3:17 am    Post subject: Reply with quote

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


Joined: 07 May 2005
Posts: 206
Location: New Zealand

PostPosted: Sun Dec 07, 2014 4:38 am    Post subject: Reply with quote

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:

# 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:

# 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.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
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