View Single Post
Old 04-16-2004, 09:35 AM  
toki
Senior Member
 
Join Date: Oct 2003
Posts: 221
Default [TCL] dnslookup for irccheck script

hi,

i started to do my own script wich parses nicknames on a channel and writes infos about them into a txt file (eggdrop part) and then itlc script for io checking this file if user has flag e.g. to permit or deny login. (ioitclpart)

my prob is that i have only getchanhost for ident@host and in tcl docu there is a dnslookup proc but without working example. finally i want a txt file with:

user ident dns ip

anyone a short idea how the dnslookup should look like? i tested several tcl scripts for dnslookup from egghelp.org but they didnt work and the dnslookup is there but always says smt about wrong # of argument etc.

thx in advance toki

code atm is about:

Code:
### This Script prevents user from login if they are not on an IRC channel! ###

### !CONFIGURATION!
set controlchan     "#channelname"
set exemptusers     "toki"
#set exemptgroups    "admins"
set alloweduserfile "E:/User/ioFTPD/scripts/ioIRCCHECK/allowed.txt"

### CONFIGURATION END HERE!

bind time - "* * * * *" createlist:time

proc createlist:time { min hour day month year } {
    createlist
}

proc createlist { } {
    global controlchan exemptusers alloweduserfile
    set file [open $alloweduserfile w]
    set userlist [chanlist $controlchan]
    foreach username $userlist {
        set chanhost [getchanhost $username $controlchan]
        set splitchanhost [split $chanhost \@]
        set ident [lindex $splitchanhost 0]
        set host [lindex $splitchanhost 1]
        set outline ""
        set resip ""
#        [dnslookup $host do_dnslookup $resip]
                if { [matchattr [nick2hand $username $controlchan] |+F $controlchan] } {
            set outline "[nick2hand $username $controlchan] $ident $host"
            puts $file $outline
        }
    }
    close $file
}

proc do_dnslookup { ip hostname status resip } {
    global resip
    set resip $ip
}

putlog "*** ioirccheck.tcl for ioFTPD by toki <toki76@web.de> loaded!"
and tcl docu says:
Code:
dnslookup <ip-address/hostname> <proc> [[arg1] [arg2] ... [argN]]
    Description: This issues an asynchronous dns lookup request. The
      command will block if dns module is not loaded; otherwise it will
      either return immediately or immediately call the specified proc
      (e.g. if the lookup is already cached).

      As soon as the request completes, the specified proc will be called
      as follows:

       <proc> <ipaddress> <hostname> <status> [[arg1] [arg2] ... [argN]]

      status is 1 if the lookup was successful and 0 if it wasn't. All
      additional parameters (called arg1, arg2 and argN above) get
      appended to the proc's other parameters.
    Returns: nothing
    Module: core
toki is offline