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.

Users Host Mask

Old posts that have not been replied to for several years.
Locked
B
BassTeQ

Post by BassTeQ »

Im looking for a script that will show me a users host mask upon a public trigger
eg. !Host Nickname
I did find one but it will only show you your own host mask. The reason I need this is that it makes it easier to ban a host
*!*@*.122-domain.com
Could anyone maybe provide me with a link or some code to achieve this please?

Thank You
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

This depends where you want to get the hostmasks from. The userfile, or IRC.

If you want the host masks from the bots userfile, then this should do.

Code: Select all

bind pub - !host pub:gethost
proc pub:gethost {nick uh hand chan arg} {
  if {![validuser $hand]} { return }
  set proc $hand
  if {([set nnick [lindex [split $arg] 0]] != "") && ([matchattr $hand "o|o" $chan])} {
    set proc $nnick
  }
  if {![validuser $proc]} {
    puthelp "PRIVMSG $chan :$nick - there is no such user "${proc}""
  }
  puthelp "PRIVMSG $chan :HOSTS for $proc : [string trimright [join [getuser $proc HOSTS] ", "] ", "]"
}
To get the info from irc.

Code: Select all

bind pub - !host pub:gethost
proc pub:gethost {nick uh hand chan arg} {
  set proc $nick
  if {([set nnick [lindex [split $arg] 0]] != "") && ([matchattr $hand "o|o" $chan])} {
    set proc $nnick
  }
  if {![onchan $proc $chan]} {
    puthelp "PRIVMSG $chan :I can't get info on "${proc}" - he isn;t on channel"
    return
  }
  puthelp "PRIVMSG $chan :The the hostmask for "${proc}" is [maskhost [getchanhost $proc $chan]]"
}
Note: This will only work if the user is on the channel. If the user is not the channel, or not known by the bot, then somthing more complex is required, to send a whois, and take the returned data, process it and make sure it reaches the correct destination.
B
BassTeQ

Post by BassTeQ »

Cheers mate, Ill try it out tonight.
Greatly appreciated!

BassTeQ
B
BassTeQ

Post by BassTeQ »

Worked great, how could I bind the 2nd example to the /msg command?

Cheers
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

WIth some fiddleing, this should work.

It required that a channel name be passed to the script as well, as previously, the user was on the channel, so that channel could be used.

It now output to the user via PM.

Code: Select all

bind msg - !host pub:gethost
proc priv:gethost {nick uh hand arg} {
  if {[set chan [lindex [split $arg] 1]] == ""} {
    puthelp "PRIVMSG $nick :You need to state a channel "!host <nick> <channel>""
    return
  }
  if {![validchan $chan]} {
    puthelp "PRIVMSG $nick :I am not on that channel, try another"
    return
  }
  set proc $nick
  if {([set nnick [lindex [split $arg] 0]] != "") && ([matchattr $hand "o|o" $chan])} {
    set proc $nnick
  }
  if {![onchan $proc $chan]} {
    puthelp "PRIVMSG $nick :I can't get info on "${proc}" - he isn;t on channel"
    return
  }
  puthelp "PRIVMSG $nick :The the hostmask for "${proc}" is [maskhost [getchanhost $proc $chan]]"
}
B
BassTeQ

Post by BassTeQ »

I get this error msg on the new code you did.

Also the bot only sits on one channel, and id only want the host names of people on my channel.

Any ideas?
Thanks.

[20:21] TCL error [pub:gethost]: no value given for parameter "arg" to "pub:gethost"


<font size=-1>[ This Message was edited by: BassTeQ on 2001-10-26 08:18 ]</font>
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

/me wonders if he was on crack while writing the update!

Code: Select all

bind msg - !host priv:gethost
proc priv:gethost {nick uh hand arg} {
  if {[set chan [lindex [split $arg] 1]] == ""} {
    puthelp "PRIVMSG $nick :You need to state a channel "!host <nick> <channel>""
    return
  }
  if {![validchan $chan]} {
    puthelp "PRIVMSG $nick :I am not on that channel, try another"
    return
  }
  set proc $nick
  if {([set nnick [lindex [split $arg] 0]] != "") && ([matchattr $hand "o|o" $chan])} {
    set proc $nnick
  }
  if {![onchan $proc $chan]} {
    puthelp "PRIVMSG $nick :I can't get info on "${proc}" - he isn;t on channel"
    return
  }
  puthelp "PRIVMSG $nick :The the hostmask for "${proc}" is [maskhost [getchanhost $proc $chan]]"
}
B
BassTeQ

Post by BassTeQ »

Works great thanks,
just one small change, it retuns the hostmask as
The the hostmask for "bassteq" is *!BassTeQ@*.mydomain.net.au

How could I get it to show the FULL mask after the @ ?
Thanks mate.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Be more specific of your needs next time, as this is very space consuming to keep pasting updates all the time.

Code: Select all

bind msg - !host priv:gethost
proc priv:gethost {nick uh hand arg} {
  if {[set chan [lindex [split $arg] 1]] == ""} {
    puthelp "PRIVMSG $nick :You need to state a channel "!host <nick> <channel>""
    return
  }
  if {![validchan $chan]} {
    puthelp "PRIVMSG $nick :I am not on that channel, try another"
    return
  }
  set proc $nick
  if {([set nnick [lindex [split $arg] 0]] != "") && ([matchattr $hand "o|o" $chan])} {
    set proc $nnick
  }
  if {![onchan $proc $chan]} {
    puthelp "PRIVMSG $nick :I can't get info on "${proc}" - he isn;t on channel"
    return
  }
  puthelp "PRIVMSG $nick :The the hostmask for "${proc}" is [getchanhost $proc $chan]"
}
B
BassTeQ

Post by BassTeQ »

Sorry about that, and thanks for your help!

Ive just added your change and it says

--> I am not on that channel, try another

Thanks

<font size=-1>[ This Message was edited by: BassTeQ on 2001-11-04 00:45 ]</font>
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

According to my tests, it works fine.

Read the bottom of the first reply to the thread.
P
PiraYa-

Post by PiraYa- »

Must I put this code in the config file?
Locked