<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/88" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2001-10-05T20:15:00-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/88</id>

		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2001-10-05T20:15:00-04:00</updated>

		<published>2001-10-05T20:15:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=314#p314</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=314#p314"/>
		<title type="html"><![CDATA[Need help advise with modifying a custom tcl script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=314#p314"><![CDATA[
The following is a Script we use for obtaining IP's on a mode +x IRCD<br>Having had a few problems with some users misusing the IP's posted to channel. We was looking to modify it to work on say. wfc&lt;nick&gt; &lt;&lt;--&lt;nick&gt;being the nick of the other player.And it would be via notice And also a notice to Chanops, so they can ensure<br>the IP has resolved correctly.<br>Any ideas help in this would be most appreciated. <br><br># wfc is a means by which non-technical users can advertise their host and IP<br># addresses in channel.  This script generates the same output as the original<br># wfc used by #ScrabbleOn and its siblings.  However, this script will reveal<br># information for +x users, which the original version could not do.<br>#<br># Note that this version will run slightly slower than the original, as it<br># waits for a /whois reply before processing the nslookup.<br>#<br># Requirements for the bot running this script:<br># * A shell with nslookup available (this was an existing requirement).<br># * At least local IRCOp privileges (to reveal information on +x users).<br># * A network running the Unreal ircd (see the notes on RAW 378).<br>###############################################################################<br><br>bind pubm -|- "% wfc" do_wfc<br>bind raw - 378 wfc:whois_reply<br>bind raw - 318 wfc:whois_reply<br><br>###############################################################################<br># This procedure is triggered by a user's request to reveal his or her<br># information.  If the user is -x his/her address is already available, but<br># without reading their flags we don't know if it's legitimate or masked.<br># So, we always issue a /whois to see what response we get.<br>#<br># We save the user's channel and (supposed) host address to global arrays<br># keyed off of the user's nick, so we can retrieve them in the /whois<br># handler.  Since they're global (and therefore "sticky") and not cleared<br># here, we set timers to unset them in case the /whois doesn't go through;<br># this prevents us from generating useless variables that don't expire.<br>#<br># Note that, since the nick becomes part of a variable name, we have to<br># strip out any special characters before creating the variable.  This will<br># only cause a problem if two people whose nicks resolve to the same result<br># (e.g., Me[away] and Me{away}) both did a wfc at approximately the same time.<br>###############################################################################<br><br>proc do_wfc {ni uh ha ch text} {<br><br>global chan host<br><br>  regsub -all {|} $ni "" nick<br>  regsub -all {[|]} $nick "" nick<br>  regsub -all {\} $nick "" nick<br>  set chan($nick) $ch<br>  set host($nick) $uh<br>  utimer 30 "unset chan($nick)"<br>  utimer 30 "unset host($nick)"<br>  putserv "WHOIS $ni"<br>}<br><br>###############################################################################<br># This procedure handles raw numerics 378 and 318 returned from a /whois.<br>#<br># * 318 is a standard "End of /whois" message.  <br># * 378 includes the full unmasked host address of the target.<br>#<br># (Note that a 378 is only sent if the target is +x AND the bot is an IRCOp. <br># Note also that a 378 and its format are specific to the Unreal ircd; for<br># example, PTLink uses a differently-formatted raw 616 for this function.)<br>#<br># If a 378 is received, parse out the user's host address and store it over<br># top of the one that was originally retrieved (since the latter is now<br># known to be masked).<br>#<br># When a 318 is received, grab the user's host address and pass it to<br># nslookup, then process the results and display them in channel.<br>#<br># Note that the array "addr" is set global only so that data stored in it<br># will be "sticky" and be retained from the 378 to the 318... in other words,<br># the equivalent of C's "static."<br>###############################################################################<br><br>proc wfc:whois_reply {from keyword args} {<br><br>global chan host addr<br><br>  regsub -all {|} $args "" nick<br>  regsub -all {[|]} $nick "" nick<br>  regsub -all {\} $nick "" nick<br>  set nick [lindex [split $nick] 1]<br><br>  if {![info exists chan($nick)]} { <br>    return 0 <br>  }<br><br>  if {$keyword == 378} {<br>    set addr($nick) [string trimright [lindex [split $args "@"] 1] }]<br>    utimer 30 "unset addr($nick)"<br>  }<br>  if {$keyword == 318} {<br>    if {![info exists addr($nick)]} { <br>      set addr($nick) [lindex [split $host($nick) "@"] 1]<br>    }<br><br>    set address $addr($nick)<br>    catch {exec nslookup $address} dns<br>    set dns [lrange $dns 5 end]<br>    set ip [lindex $dns [expr [lsearch $dns "Address:"] + 1]]<br><br>    set ni [lindex [split $args] 1]<br>    regsub -all {\\} $ni "/" ni<br>    regsub -all {\} $ni "" ni<br>    regsub -all "/" $ni {\} ni<br><br>    putserv "PRIVMSG $chan($nick) :$ni's u@h is $addr($nick)"<br>    putserv "PRIVMSG $chan($nick) :$ni's IP address is $ip"<br>    unset addr($nick)<br>    unset host($nick)<br>    unset chan($nick)<br>  }<br>  return 0<br>}<br><br><br><p>Statistics: Posted by Guest — Fri Oct 05, 2001 8:15 pm</p><hr />
]]></content>
	</entry>
	</feed>
