Go Back   FlashFXP Forums > >

Programming Need help with C/C++/Delphi? Ask here and make us all laugh.

Closed Thread
 
Thread Tools Rate Thread Display Modes
Old 04-16-2004, 09:35 AM   #1
toki
Senior Member
ioFTPD Foundation User
 
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  
Old 04-16-2004, 11:37 AM   #2
Mouton
Posse Member
Ultimate Scripter
ioFTPD Administrator
 
Join Date: Dec 2002
Posts: 1,956
Default

What error do u get exactly ?

U don't need or should pass resip to your do_dnslookup proc, since you use global on it.

U're missing a global on resip in your createlist proc.

Once you got it working, u'll need to use a wait just after calling dnslookup to wait until the resip variable is changed to continue and be able to write it in your file.
Mouton is offline  
Old 04-16-2004, 12:34 PM   #3
toki
Senior Member
ioFTPD Foundation User
 
Join Date: Oct 2003
Posts: 221
Default

ok works now thx mouton!!!

final is:
Code:
set resip [dnslookup $host do_dnslookup]
in createlist proc and do_dnslookup is
Code:
proc do_dnslookup { ip hostname status } {
    global resip
    set resip $ip
}
leaving do_dnslookup emty proc OR not doing "set resip [dnslookup $host do_dnslookup]" but only "[dnslookup $host do_dnslookup]" didnt work...

thx again greez toki

PS: if anyone is interested in something like that... tell me and ill share the script when it is complete. (and fits to all my needs)
toki is offline  
Old 04-16-2004, 12:42 PM   #4
toki
Senior Member
ioFTPD Foundation User
 
Join Date: Oct 2003
Posts: 221
Default

Quote:
Originally posted by Mouton
Once you got it working, u'll need to use a wait just after calling dnslookup to wait until the resip variable is changed to continue and be able to write it in your file.
just wait certain seconds? or really check until resip has changed?
toki is offline  
Old 04-16-2004, 12:55 PM   #5
Mouton
Posse Member
Ultimate Scripter
ioFTPD Administrator
 
Join Date: Dec 2002
Posts: 1,956
Default

until resip has changed.
there's a tcl function for exactly that...
wait or vwait... don't remember.
Mouton is offline  
Old 04-20-2004, 02:46 AM   #6
toki
Senior Member
ioFTPD Foundation User
 
Join Date: Oct 2003
Posts: 221
Default

hmms
Code:
vwait resip
either in the do_dnslookup proc or right after the set line in the main proc causes the windrop not to repond to any further request... seems its waitung forever.

without vwait i get ips for several dns lookups but not for all.

im just trying
Code:
after 200 { set resip ... }
vwait resip
any further ideas?
toki is offline  
Old 04-26-2004, 07:57 PM   #7
darkone
Disabled
FlashFXP Registered User
ioFTPD Administrator
 
darkone's Avatar
 
Join Date: Dec 2001
Posts: 2,230
Default

Howabout setting up timer, which checks change of variable?
darkone is offline  
Closed Thread

Tags
$controlchan], dnslookup, proc, resip, set

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Download grinding to a halt bruceh General Discussion 6 09-07-2004 08:29 AM


All times are GMT -5. The time now is 02:00 PM.

Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)