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.

vHost bot Help Needed Plz!!!

Old posts that have not been replied to for several years.
Locked
m
magog
Voice
Posts: 2
Joined: Fri Mar 04, 2005 10:27 pm

vHost bot Help Needed Plz!!!

Post by magog »

hello everyone I'm a noobe to tcl scripting and I'm tring to make a vhost channel for my networt and the script i got from here I'm having troble getting it to set the host with hostserv.
It identifys with nickserv and opers up but its not sending the cmd to set the host on the trigger and since I'm new to tcl I don't know if this script is corect or not. Can someone help by telling me if this script is right or needs some adjustments or a script that will work on my network would be a great help.
My network is running Unreal 3.2 and freeBSD any help would be appreciated
Thank you all for your help and support

Code: Select all

#set this to channel
set scan(chan) "#VHOST"
# Set this to the bot's O-Line username #
set oper(username) "*****"
# Set this to the bots O-Line password #
set oper(password) "*******"
# Set here the words that are not alowed in the vhost #
set dvb_badvhost {
   "*admin*"
   "*bitch*"
   "*[censored]*"
   "*operator*"
   "*ircop*"
   "*[censored]*"
   "*asshole*"
   "*pussy*"
   "*slut*"
   "*mother fuker*"
   "*cock *"
}



## dont change below unless your know what your doing ##

bind msg O oper oper-up
bind join - "$scan(chan) *" dvb:join
bind raw - 307 dvb:ident
bind pub -|- !vhost dvb:vhost
bind evnt - init-server oper:connect

proc oper:connect init-server {
putserv "OPER $::oper(username) $::oper(password)"
}

proc oper-up {nick host chan text} {
  global operid operpass owner2
  putserv "OPER $::oper(username) $::oper(password)"
  putserv "NOTICE $nick : I Opered up"
}

proc dvb:join {nick host hand chan} {
 global dvb_nick dvb_ident
  set dvb_ident "1"
  set dvb_nick $nick  
  putserv "WHOIS $nick"
  utimer 3 dvb:not:ident
}

proc dvb:vhost {nick host hand chan vhost} {
 global dvb_nick dvb_ident dvb_vhost scan(chan)
     if {$chan != "#VHOST"} {
      putserv "NOTICE $dvb_nick : You can use 4!VHOST to setup a vhost."
      putserv "NOTICE $dvb_nick : This command only works in #VHOST"
      return 0
   }
 if {$vhost == ""} {
 if {$chan == "#VHOST"} {
   putserv "NOTICE $dvb_nick : You can use 4!VHOST to set a vhost."
   putserv "NOTICE $dvb_nick : This will hide your real host from normal users."
   putserv "NOTICE $dvb_nick : For Example 4!VHOST this.is.my.vhost.com ."
   putserv "NOTICE $dvb_nick : You must have two periods in your host."
   putserv "NOTICE $dvb_nick : You must have a registed nick and be identified to use this command.."
   putserv "NOTICE $dvb_nick : For more information type 4/NICKSERV HELP."
   return 0
   }
      putserv "NOTICE $dvb_nick : You can use 4!VHOST to set a vhost."
      putserv "NOTICE $dvb_nick : This Command is only available in #VHOST"
      return 0
   }

  set dvb_ident "2"
  set dvb_vhost [lindex $vhost 0]
  set dvb_nick $nick  
  putserv "WHOIS $nick"
  utimer 3 dvb:not:ident
}

proc dvb:ident {from key args} {
 global dvb_ident dvb_nick dvb_vhost
  set args [join $args]
  set nick [string tolower [lindex $args 1]]
  set regist [strlwr [lindex [lrange [split $args ":"] 1 end] 0]]
  if {$dvb_ident == "1" && $regist == "is a registered nick"} {
    foreach j [utimers] {
        if {[lindex $j 1] == "dvb:not:ident"} { killutimer [lindex $j 2] }
      }
   putserv "PRIVMSG #VHOST :$nick is: registered and can use the command: !vhost <vhost>"
   }
  if {$dvb_ident == "2" && $regist == "is a registered nick"} {
    foreach j [utimers] {
        if {[lindex $j 1] == "dvb:not:ident"} { killutimer [lindex $j 2] }
   }

global dvb_badvhost
set temp 0
foreach i [string tolower $dvb_badvhost] {
if {[string match $i [string tolower $dvb_vhost]]} {
set temp 1
  putserv "NOTICE $dvb_nick : Your Vhost has not been changed to 3$dvb_vhost3 as it is an invalid/disallowed host."
  return 0
}
}


  putserv "PRIVMSG hostserv : set $dvb_nick $dvb_vhost"
  putserv "PRIVMSG hostserv : set $dvb_nick $dvb_vhost"
  putserv "chghost $dvb_nick $dvb_vhost"
  putserv "NOTICE $dvb_nick : Your New Host is: $dvb_vhost"
  putserv "NOTICE $dvb_nick : You must use msg hostserv on to activate it on connect from now on."
  }
  return 0
}

proc dvb:not:ident {} {
 global dvb_nick
 putserv "PRIVMSG #VHOST :$dvb_nick is: not currently registered or identified."
 putserv "PRIVMSG #VHOST :Type: 4/MSG NICKSERV HELP for help on registering a nick and how to identify."
}

User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

make sure the bot is given proper services priviledges (check service's documentation)
HostServ [9:47:26pm] -HostServ- Syntax: SET <nick> <hostmask>.
HostServ [9:47:26pm] -HostServ- Sets the vhost for the given nick to that of the given
HostServ [9:47:27pm] -HostServ- hostmask. If your IRCD supports vIdents, then using
HostServ [9:47:27pm] -HostServ- SET <nick> <ident>@<hostmask> set idents for users as
HostServ [9:47:27pm] -HostServ- well as vhosts.
HostServ [9:47:27pm] -HostServ- Limited to Host Setters.
if the bot has proper "rights" as a services operator (Host Setter) and the script doesn't work, attempt contacting the script's coder
m
magog
Voice
Posts: 2
Joined: Fri Mar 04, 2005 10:27 pm

Post by magog »

dragonlord thank you for the reply however i think you missed a part of my topic where it said
It identifys with nickserv and opers up but its not sending the cmd to set the host on the trigger

now even if the oline wasn't in, (which it is) it would attempt to send the cmd on the trigger , (and its not ) that is the problem at the moment.
as far as the script's coder part of this code was in dutch from a script thats from here.
http://www.egghelp.org/cgi-bin/tcl_arch ... ad&id=1041
now after translating it to english and combining it with another part of script that i also got from here.
http://forum.egghelp.org/viewtopic.php? ... ight=vhost
i guess that the coder would be me.
And as i said in my topic i'm a noobe to tcl scripting so this would be my first attempt at making a tcl script so thats why i asked for some help so that i can learn from what ever mistakes i have made as i'm just a noobe to tcl scripting as in my topic. this is not the same as irc scripting but i'm a fast study.
Continued help would be appreciated
Thank you all for your help and support

also if it's needed to be known the services are anope
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

When the bot identifies to nickserv say on connect, bind to notc (on nick identification), check if target is botnick, check if nick is nickserv... then go ahead use putserv, putquick and send your command to hostserv to change the bot's vhost.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

he wants the bot to use hostserv to set vhosts for other users (as an oper)
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Well, I don't know the exact command for changing other people's hosts especially on anope, because I also use anope but unfortunately bahamut, (the IRCd on my network) doesn't support vhosting.

If the bot is opered, anope generally recognizes you, if you've added in services operators or the administrator nick, after the nick has been identified.

If you wan't to check if the bot's nick is identifed or opered up, bind to the correct raw numbers for your ircd (for whois replies). You will have to make the bot /whois itself to check this, because /who is very limited. There are many methods, but this is the one I currently know.

Since you pasted the usage above, so here it is:

Code: Select all

#Usage:
./msg <botnick> !vhost <nickname> <vhost@here>

#Assuming your bot is opered up, has identified it's nick to nickserv
#and has the correct priveledges... then only this will work or HostServ
#would give a reply of "Access denied" or "Permission denied".

bind msg n "!vhost" change:user:vhosts

proc change:user:vhosts {nick uhost hand text} { 
 if {([lindex $text 0] != "") && ([lindex $text 1] != "")} {
 putserv "PRIVMSG HostServ :SET [lindex $text 0] [lindex $text 1]"
 }
}
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

since he wants a script that only sets vhosts for registered users...
there has to be a method of validating this,

"bind notc - "*not found in the nickserv db." proc"
would help in this as part of the "hostserv set" routine, as it is returned for unregistered nicks

I'm having trouble getting a subroutine to set a variable in a decent way. Perhaps using a array for this would be the way to go, not sure yet.

(I got curious, and I'm a bit bored)
Y
Yoinx
Voice
Posts: 13
Joined: Thu Jan 01, 2004 5:44 pm

Post by Yoinx »

Well this is what i have worked out for him. Im new to tcl (as is obvious) if anyone sees any problems or a better way to optimize this script please tell me. BTW, This DOES work, Im just not sure if it can be cleaned up any. This also needs to be used in a room that only allows registered users since the script doesnt check that they are registered.

Code: Select all

set channel "#vhost"
set operid "*******"
set operpass "*******"
 
bind evnt - init-server oper
bind pub -|- !vhost vhost
bind join -|- * joinnotice

proc oper init-server { putserv "OPER $::operid $::operpass" }
proc joinnotice {noticenick noticehost noticehandle noticechan } {
 if { $noticechan == $::channel } {
   putserv "NOTICE $noticenick To change your host type !vhost <thehost.you.want> and you'll recieve a msg "
  }
}
proc vhost {vhostnick vhosthost vhosthand vhostchan vhosttext} {
 if { $vhostchan == $::channel } {
   checkvhost $vhostnick $vhosttext
 }
}
set badwords { *<censored>* *admin* *[censored]* *fag* *dick* *suck* *[censored]* *asshole* *zub* *bitch* *cock* *[censored]* *whore* *slut* *fartknocker* *ass* *bastard* *nigger* *pussy* *dickhead* *nigga* *piss* *maricon* *shithead* *prick* *sucks* *dicks* *pricks* *.htm* *www.* *#* *channel* *sex* *ass* *trick* *fuk* *azz* *hail* *hitler* *gov* *mil* *cyberarmy* *cia* *fbi* *nsa* *dod* }
proc checkvhost { checknick vhostcheck } {
 if {[string match "*.*.*" [string tolower $vhostcheck]]} {
  set temp 0
  set results 0
   while {$temp<=46} {
     foreach x [string tolower $::badwords] {
     if {[string match $x [string tolower $vhostcheck]]} {
     incr results
     }
    }
    incr temp
   }
   unset temp
   if { $results > 0 } {
   putserv "NOTICE $checknick Your Vhost has not been changed to $vhostcheck as it is an invalid/disallowed host."
   } else {
   putserv "GLOBOPS $checknick has changed their vhost to '$vhostcheck'"
   putserv "chghost $checknick $vhostcheck"
   putserv "NOTICE $checknick Your vhost has been changed to '$vhostcheck'"
   putserv "PRIVMSG hostserv set $checknick $vhostcheck"
   putserv "NOTICE $checknick To make the server set your vhost whenver you connect type '/msg hostserv on now'"
   }
  } else {
  putserv "NOTICE $checknick You muse use two '.'s in your vhost"
  }
}
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

yes, that would "work"

getting the script to stop working on an unregistered nick that's getting me
Y
Yoinx
Voice
Posts: 13
Joined: Thu Jan 01, 2004 5:44 pm

Post by Yoinx »

yeah like I said the room in on unreal with +R set so its not a big deal. I was just wondering if there's a more clean way to do it.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

To check if a nick is registered and identified, you have to check if that nick has umode +r. Now I don't think there is a way through which I know you can check more +r for a user even if you are an IRC Operator (well on bahamut there isn't).

The most easiest thing is to, /whois and bind raw and check for this.
awyeah is awyeah@awyeah.org * Yêã ßåbý! yéåh!@&#$
awyeah on @#arrogant @#drugs @#porn @#eleet @#sport @#eggdrops @#root @#bnc @#shells @#psybnc @#shell
awyeah using mesra.kl.my.dal.net Jaring DALnet Client Server
awyeah has identified for this nick
awyeah has been idle 4mins 29secs, signed on Sun Mar 06 01:50:36
awyeah End of /WHOIS list.
And as for the raw number on bahamut:

Code: Select all

    /* 307 RPL_WHOISREGNICK */	":%s 307 %s %s :has identified for this nick.",
For unreal you have to check it yourself. :)
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

I don't get that response on my Unreal ircd, hence my issue with it.
Sending a /msg nickserv info $nick will get a notice back saying "Nick $nick isn't registered." for unregistered nick.

I'm not in a huge hurry to get this done, Yoinx gave one that works with channels set to +R for magog to use.

I'm trying to make a script that will not depend on ircd type.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Either way, sometimes most networks don't have nick management services like NickServ, plus their replies could be different as you can change the language replies depending upon your needs, I know mine is.

Nevertheless, if you want to do it by checking nickserv infos' I suggest you just bind to notc and string match "*Nick * isn't registered*" and if [lindex $text 1] == string.you.supplied (just to confirm). Then if all is well the nick being: [lindex $text 1]

Code: Select all

 putserv "PRIVMSG HostServ :SET [lindex $text 1] vhost.here"
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Y
Yoinx
Voice
Posts: 13
Joined: Thu Jan 01, 2004 5:44 pm

Post by Yoinx »

Sorry for the late reply, I dont relaly need to check if the nick is registered, since its on Unreal and it has channel mode +R which only allows registered nicks to join the chan. What I was wondering moreso was how would I make it so my list of bad words would automatically be counted so that i wouldnt have to specify the number of words in the list in my while loop.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Automatically be counted? Do you mean you want to count the number of entries in your badword list?

You wouldn't have to specify the number of words in the list while you need? You don't have to.

Just make a list, and use a foreach loop, that's it I guess. If you want it to be faster, you can use lsearch (list search with -exact switch) in that case.

This is the code if you want to count the number of elements in a list:

Code: Select all

set badwords {
"word1"
"word2"
"wordl3"
}

set no_of_badwords [llength $badwords]
Here is what you can use:

Code: Select all

proc checkvhost {checknick vhostcheck} {
 if {[string match "*.*.*" [string tolower $vhostcheck]]} {
  set results 0
   foreach x $::badwords {
    if {[string match -nocase *$x* $vhostcheck]} {
     incr results
     }
   }
   if {$results > 0} {
   putserv "NOTICE $checknick Your Vhost has not been changed to $vhostcheck as it is an invalid/disallowed host."
   } else {
   putserv "GLOBOPS $checknick has changed their vhost to '$vhostcheck'"
   putserv "chghost $checknick $vhostcheck"
   putserv "NOTICE $checknick Your vhost has been changed to '$vhostcheck'"
   putserv "PRIVMSG hostserv set $checknick $vhostcheck"
   putserv "NOTICE $checknick To make the server set your vhost whenver you connect type '/msg hostserv on now'"
   }
  } 
  else {
  putserv "NOTICE $checknick You muse use two '.'s in your vhost"
  }
}
Also you should check your list, we can't use characters like <, [, ], {, }, \, /, ?, >, ~ etc in vhosts:
*<censored>* *[censored]*
Also you can use your own code, just need to modify it a bit. Just replace:

Code: Select all

while {$temp <= 46} {
with:

Code: Select all

while {$temp <= [llength $::badwords]} {
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Locked