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.
Old posts that have not been replied to for several years.
n
noid
Post
by noid » Sun Oct 31, 2004 11:58 am
Hello,
im searching of a way to accept connections for a telnet port only from a given ip adress. How is this possible? My tcl code bellow, now i want that only from a specified ip that connection could be established or drop it imediate if is not from that ip.
listen 12345 script conngrab
proc conngrab {newidx} {
control $newidx connmsg
}
proc connmsg {idx msg} {
putlog "idx: $idx, msg: $msg"
return 0
}
thanx, noid
spock
Master
Posts: 319 Joined: Thu Dec 12, 2002 8:40 pm
Post
by spock » Sun Oct 31, 2004 1:58 pm
i suppose you could do something like this
Code: Select all
listen 12345 script conngrab
proc conngrab {newidx} {
utimer [expr ${::ident-timeout} + 5] [list control $newidx connmsg]
}
proc connmsg {idx msg} {
if {[lindex [split [lindex [lindex [dcclist script] 0] 2] @] 1] == "ip"} {
putlog "idx: $idx, msg: $msg"
}
killdcc $idx
}
photon?
greenbear
Owner
Posts: 733 Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway
Post
by greenbear » Sun Oct 31, 2004 2:00 pm
Here's a proc to find the host matching a idx, it should help you on the way.
Code: Select all
proc findidxhost {idx} {
foreach c [dcclist script] {
if {[lindex $c 0] == $idx} {
return "[lindex $c 2]"
}
}
return 0
}