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.

Nickserv - General question

Old posts that have not been replied to for several years.
Locked
M
MarkReaktor7

Nickserv - General question

Post by MarkReaktor7 »

Hey all,

In an attempt to secure my op-bot while still being able have the advanced customisations of perosnally built script, i have come up with the best way to enforce my policies. However i dont know if its possible lol.

What i need is for my bot to see if someone is registered with nickserv, moreover, if they are identified..

Is such a thing possible? i searched on the forums but everyone wants to know how to get their bot to ident to nickserv itself.

I could most probably get ircop status for the bot if necessary etc. as we run our own ircd, but the easier it is the better ;)
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

this is possible if your ircd includes an extra info line in WHOIS reply saying that nick has identified to NickServ (most ircds which implement some kind of interface with nick services do this)

your bot needs to run a script which binds raw to the server numeric identifying that additional info line, and then issue the WHOIS command
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Basically yes. Almost all IRCd's having network services such as ChanServ, NickServ employ this feature. After you have identified your nick you are set +r.

So there is a raw number I am sure, you have to look it up either in your ircd numerics, or general raw numerics for ircd's over the web. Whois that nick, bind on that particular raw number, if it exists:

-
awyeah has identified for this nick
-

You can then go ahead and do your stuff, if that line doesn't show upon whois meaning that nick hasn't been identified for. Also another method is /nickserv info <nick>

You can do some sort of string match maybe because when a nick is identified to nickserv and is in use it shows:

-
Nickserv info for nick: blabla /whois blabla
-

However when it is not in use, meaning not identified it just shows

-
Nickserv info for nick: ident@ip.com
-

There may be variations but there is a little bit of difference. Depends upon your IRCd and network services they use. I am mainly suggesting these from DALnet.
·­awyeah·

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

Post by MarkReaktor7 »

Ok i found i have the << ONLINE >> thing

One thing i need to know (sorry if im asking too much, but im highly puzzled as to this): How do i get info from the Notice that that server will send back to me?

Ie i will msg the server (from eggdrop of course) and it will send me back a Notice thing saying the << ONLINE >> prompt

How would one extract say the first line of this notice and then make it a variable (ie $isident) so i could do a string match on it.
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Post by YooHoo »

MarkReaktor7 wrote:How do i get info from the Notice that that server will send back to me?
Ie i will msg the server (from eggdrop of course) and it will send me back a Notice thing saying the << ONLINE >> prompt
Bind NOTC
MarkReaktor7 wrote:How would one extract say the first line of this notice and then make it a variable (ie $isident) so i could do a string match on it.
I would imagine you would greatly benefit from reading the Tcl Reference Manual, as well as tcl-commands.doc, located in the ~/eggdrop/doc section of your bot :mrgreen: hope this helps
M
MarkReaktor7

Post by MarkReaktor7 »

YooHoo, they were useful resources but i am still lost.

This is what my script does (in the hope people will understand what i want)
Our IRC channel utilises an eggdrop and the standard chanserv/nickserv. The problem we were finding was that we are a startup gaming communtiy which in the first month has gotten 2000+ members. The problem however, is we have a group of volunteers who are automatically granted certain irc permissions regarding their position on a database.

This database is all well and good, and i have managed to interface with a databse and auto-op these users as is now, HOWEVER, as well as this system might work it doesnt prevent someone from joining with the name of one of our volunteers and getting op access to the channel.

The way i thought of doing this was by using the nickserv to my advantage. I know chanserv can do what i want to, but we have a low amount of high level admins in the irc channel, therefore they cant set up the access for all the volunteers all the time.
Now, when i first made this script i had been into tcl for 12 hours (considering i slept for 8 of those 12 i think im doing kind of good) but yer, this has me miffed. I could make a new process that runs on the NOTC thing i presume. but wont that parse the nickservers info and not the user i want opped?

I will provide my code that i have made so far, and if anyone is kind enough to make it so that it will only continue if the user has << ONLINE >> in their /msg nickserv info line i would be very appreciative.

Code: Select all

set forumopid 7
set gameopid 22
set netopid 6
set staffid 0
set irc_chan "#testing"
set namefield "field7"
set autofield "field6"

#### DO NOT CHANGE BELOW THIS LINE ####
bind join - * autoaction
bind pub "-" !voice add_voice
bind pub "-" !halfop add_halfop
bind pub "-" !op add_op
bind pub "-" !devoice del_voice
bind pub "-" !dehalfop del_halfop
bind pub "-" !deop del_op
bind msg "-" !deluser deact
bind msg "-" !adduser react
bind NOTC - * testing

proc autoaction {nick host handle chan {text ""}} {
	global db_handle irc_chan forumopid staffid gameopid netopid namefield
	
	# this is where if would go yes?
	
	set irc_sql "select * from userfield where $namefield = '$nick'"
	
	set irc_result [mysqlquery $db_handle $irc_sql]
		
	if {[set row [mysqlnext $irc_result]] != ""} {
		set id [lindex $row 0]
		set autoact [lindex $row 7]
		set sql "select usergroupid from user where userid = '$id'"
		set result [mysqlsel $db_handle $sql -list]
		
		if {$autoact == "Yes"} {
			if {$result == $forumopid} { 
				pushmode $irc_chan +v $nick 
			} elseif {$result == $gameopid} { 
				pushmode $irc_chan +h $nick 
			} elseif {$result == $staffid || $result == $netopid} { 
				pushmode $irc_chan +o $nick 
			}	
		}
	}
}
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

YooHoo wrote:
MarkReaktor7 wrote:How do i get info from the Notice that that server will send back to me?
Ie i will msg the server (from eggdrop of course) and it will send me back a Notice thing saying the << ONLINE >> prompt
Bind NOTC
wrong

server notices don't trigger NOTC bind, he needs to bind raw NOTICE
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

@MarkReaktor7:

a couple of serious issues with your script:
  • you query a sql database on join - this is a no-no, since you might get join-flooded (unless your channels are sort of unavailable to general public - invite only or keyed) and given that mysql queries through tcl are blocking, your bot would become pretty unresponsive
  • you give ops relying on user's nick - also a no-no, this is begging for channel takeover
  • your [pushmode] won't enforce the mode until [flushmode] is called (or the script finishes)
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

well, maybe not a complete takeover since it's +h not +o, but still, a harm could be done
M
MarkReaktor7

Post by MarkReaktor7 »

Hence why we i want the nickserv thing lol.

i have already thought of takeovers, hence why i have a built in blocking script (which you dont see) and the nick needs to be activated via the db.

As for the mysql, its on a local db (ie they share the same server) and they are dual 2.8g xeons. i have some tricks up my sleeve, but any input (as to making a better/improved) system would be greatly appreciated.

I dont like the on join thing either, but they want it automatic. the less the ops have to do when joining the channels the better.

THanks guys for your help so far tho, its been great for the day or so i have been wokring on this project. ;)
Locked