egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

PortChek !portCheck

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
RoKiTo
Voice


Joined: 22 Jul 2021
Posts: 2

PostPosted: Thu Jul 22, 2021 3:22 pm    Post subject: PortChek !portCheck Reply with quote

Sorry for the translation, but I can't find this type of tcl anywhere, except for one that is manual, but the join does that job of looking for it, as I'm not an expert in this, I hope TCL gods help me
Code:

9:03:58<Slup23>!portcheck 200.33.188.15
9:03:58<remote>wait...
9:04:01<remote>Found [IP: 200.33.188.15 /Ports Open: 21(ftp) - 80(http)]
Back to top
View user's profile Send private message
CrazyCat
Owner


Joined: 13 Jan 2002
Posts: 849
Location: France

PostPosted: Thu Jul 22, 2021 6:07 pm    Post subject: Reply with quote

Without source code, we cannot help you
_________________
https://www.eggdrop.fr
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
RoKiTo
Voice


Joined: 22 Jul 2021
Posts: 2

PostPosted: Fri Jul 23, 2021 12:02 am    Post subject: Reply with quote

It's like this ... but of course it doesn't have the rest. but it does it in join and it is automatic .. but not manual. what good to contribute in this case, I can not ask for miracles. thanks for your help. Embarassed






Code:

set portcheck_setting(flag) "-|-"
set portcheck_setting(cmd_pub) ".port"
set portcheck_setting(cmd_dcc) "portcheck"
set portcheck_setting(read) 1
set portcheck_setting(onjoin) 0
set portcheck_setting(ports) "1080 21 23"
set portcheck_setting(exemptflag) "+E"
set portcheck_setting(autoban_svr) 0
set portcheck_setting(autoban_list) 0
set portcheck_setting(global) 0
set portcheck_setting(bantime) 5
set portcheck_setting(onotice) 1
set portcheck_setting(bold) 1
set portcheck_setting(PORTCHECK:) 1
bind pub $portcheck_setting(flag) $portcheck_setting(cmd_pub) portcheck_scan_pub
bind dcc $portcheck_setting(flag) $portcheck_setting(cmd_dcc) portcheck_scan_dcc
bind join - * portcheck_onjoin_scan
setudef flag portcheck
 
proc portcheck_dopre {} {
    global portcheck_setting
    if {!$portcheck_setting(PORTCHECK:)} {
        return ""
    } elseif {!$portcheck_setting(bold)} {
        return "PORTCHECK: "
    } else {
        return "\002PORTCHECK:\002 "
    }
}
proc portcheck_onjoin_scan {nick uhost hand chan} {
    global portcheck_setting portcheck_chans
    if {($portcheck_setting(onjoin)) && ($portcheck_setting(ports) != "") && (![matchattr $hand $portcheck_setting(exemptflag)])} {
        foreach i [channel info $chan] {
            if {([string match "+portcheck" $i]) && ([botisop $chan])} {
                set host [lindex [split $uhost @] 1]
                foreach p $portcheck_setting(ports) {
                    if {![catch {set sock [socket -async $host $p]} error]} {
                        set timerid [utimer 15 [list portcheck_timeout_join $sock]]
                        fileevent $sock writable [list portcheck_connected_join $nick $chan $sock $host $p $timerid]
                    }
                }
                break
            }
        }
    }
}
proc portcheck_scan_pub {nick uhost hand chan text} {
    global portcheck_setting
    set host [lindex $text 0]
    set port [lindex $text 1]
    if {$port == ""} {
#       putquick "NOTICE $nick :Usage: $portcheck_setting(cmd_pub) <host> <port>"
        putquick "PRIVMSG $chan :Usage: $portcheck_setting(cmd_pub) <host> <port>"
    } else {
        if {[catch {set sock [socket -async $host $port]} error]} {
            putquick "PRIVMSG $chan :\002(\002Port\002)\002: Connection to $host:$port was motherfucking refused "
        } else {
            set timerid [utimer 15 [list portcheck_timeout_pub $chan $sock $host $port]]
            fileevent $sock writable [list portcheck_connected_pub $chan $sock $host $port $timerid]
        }
    }
}
proc portcheck_scan_dcc {hand idx text} {
    global portcheck_setting
    set host [lindex $text 0]
    set port [lindex $text 1]
    if {$port == ""} {
        putdcc $idx "[portcheck_dopre]Usage: .$portcheck_setting(cmd_dcc) <host> <port>"
    } else {
        if {[catch {set sock [socket -async $host $port]} error]} {
            putdcc $idx "[portcheck_dopre]Connection to $host \($port\) was refused "
        } else {
            set timerid [utimer 15 [list portcheck_timeout $idx $sock $host $port]]
            fileevent $sock writable [list portcheck_connected $idx $sock $host $port $timerid]
        }
    }
}
proc portcheck_connected {idx sock host port timerid} {
    killutimer $timerid
    if {[set error [fconfigure $sock -error]] != ""} {
        close $sock
        putdcc $idx "[portcheck_dopre]Connection to $host \($port\) failed \([string totitle $error]\)"
    } else {
        fileevent $sock writable {}
        fileevent $sock readable [list portcheck_read $idx $sock $host $port]
        putdcc $idx "[portcheck_dopre]Connection to $host \($port\) accepted "
    }
}
proc portcheck_timeout {idx sock host port} {
    close $sock
    putdcc $idx "[portcheck_dopre]Connection to $host \($port\) timed out "
}
proc portcheck_read {idx sock host port} {
    global portcheck_setting
    if {$portcheck_setting(read)} {
        if {[gets $sock read] == -1} {
            putdcc $idx "[portcheck_dopre]EOF On Connection To $host \($port\). Socket Closed."
            close $sock
        } else {
            putdcc $idx "[portcheck_dopre]$host \($port\) > $read"
        }
    } else {
        close $sock
    }
}
proc portcheck_connected_pub {chan sock host port timerid} {
    killutimer $timerid
    if {[set error [fconfigure $sock -error]] != ""} {
        close $sock
        putquick "PRIVMSG $chan :\002(\002Port\002)\002: Connection to $host:$port motherfucking failed. \([string totitle $error]\)"
    } else {
        fileevent $sock writable {}
        fileevent $sock readable [list portcheck_read_pub $chan $sock $host $port]
        putquick "PRIVMSG $chan :\002(\002Port\002)\002: Connection to $host:$port accepted. :D "
    }
}
proc portcheck_timeout_pub {chan sock host port} {
    close $sock
    putquick "PRIVMSG $chan :\002(\002Port\002)\002: Connection to $host:$port timed out. :-( "
}
proc portcheck_connected_join {nick chan sock host port timerid} {
    global portcheck_setting botnick
    killutimer $timerid
    if {[set error [fconfigure $sock -error]] != ""} {
        close $sock
    } else {
        fileevent $sock writable {}
        fileevent $sock readable [list portcheck_read_join $sock]
        if {$portcheck_setting(onotice)} {
            foreach i [chanlist $chan] {
                if {([isop $i $chan]) && ($i != $botnick)} {
                    putserv "NOTICE $i :Port $port was found open on $nick's host. \($host\)"
                }
            }
        }
        if {$portcheck_setting(autoban_svr)} {
            putserv "MODE $chan +b *!*@$host"
            putserv "KICK $chan $nick :One of the ports open on your host is banned."
            timer $portcheck_setting(bantime) [list portcheck_unsvrban $chan $host]
        } elseif {$portcheck_setting(autoban_list)} {
            if {$portcheck_setting(global)} {
                newban *!*@$host PortCheck "One of the ports open on your machine is banned." $portcheck_setting(bantime)
            } else {
                newchanban $chan *!*@$host PortCheck "One of the ports open on your machine is banned." $portcheck_setting(bantime)
            }
        }
    }
}
proc portcheck_timeout_join {sock} {
    close $sock
}
proc portcheck_read_join {sock} {
    close $sock
}
proc portcheck_read_pub {sock} {
    global portcheck_setting
    if {!$portcheck_setting(read)} {
        close $sock
    } elseif {[gets $sock read] == -1} {
        putquick "PRIVMSG $chan :\002(\002Port\002)\002: EOF On Connection To $host:$port. Socket Closed."
        close $sock
    }
}
proc portcheck_unsvrban {chan host} {
    putserv "MODE $chan -b *!*@$host"
}
putlog "port.tcl loaded." 
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 670
Location: Tennessee, USA

PostPosted: Fri Jul 23, 2021 12:50 am    Post subject: Reply with quote

Have you tried turning on the on-join function of that script?
Code:
set portcheck_setting(onjoin) 1

_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber