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.

Portscan

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
R
REDLiNE1
Voice
Posts: 9
Joined: Tue Jul 03, 2007 8:35 pm

Portscan

Post by REDLiNE1 »

Hi,
Can some one help me out i want to make a portscan Script that will scan an ip and bring back somthing like this:
!portscan $IP
* start scanning $IP
* 21 (ftp)
* 22 (ssh)
* 113 (auth)
* 8080 (webcache)
* scan finished! 51 ports scanned. (open: 4, closed: 4, stealth: 43)

this is an other frends eggdrop script unfortunately he will not give it to me.
it would be great if someone can help me thanks
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

First of all, if you want this script made, then post @ the scripting request's forum.

Secondly, if your willing to modify/learn tcl then heres a pointer:

This is the portscan code from my trojan scanner, with a few tweaks/mods here and there...

Code: Select all

proc trojan::portscan {host ports} {
    set portlist ""
    set hostmask ""
    set ip ""
    set nmap [exec nmap -sT -P0 -p [join $ports ,] $host]
    foreach line [split $nmap \n] {
        if {[regexp {Interesting ports on (.+) \(([^)]+)\)} $line]} {
            set hostmask [lindex [split $line] 3]
            set ip [string range [lindex [split $line] 4] 1 end-1]
        } elseif {[regexp {[0-9]{1,3}/tcp open|filtered [a-z0-9]} $line]} {
            lappend portlist [set p [lindex [split [lindex [split $line] 0] /] 0]]
        }
    }
    if {$portlist == ""} {
        set portlist "0"
    }
    foreach x [split $portlist \n] {
        return "$x"
    }
}
r0t3n @ #r0t3n @ Quakenet
R
REDLiNE1
Voice
Posts: 9
Joined: Tue Jul 03, 2007 8:35 pm

Post by REDLiNE1 »

i ddent no there was a scripting request's forum. also i no tcl but i could never get this to work thats why i came here and asked for help
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

REDLiNE1 wrote:i ddent no there was a scripting request's forum.
How could you not see it? Plain as the nose on your face. :roll:
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

@Tosser:
Isn't it a bit dangerous using exec with nmap, since scans may take a while. Thought 'bout using "open" with pipe instead? A bit more complex, but wouldn't block your bot while scanning...

Also, what's the point of this:

Code: Select all

foreach x [split $portlist \n] {
 return "$x"
}
Would'nt it be simpler to just do something like this:

Code: Select all

return [lindex [split $portlist \n] 0]
NML_375
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

nml375 wrote:@Tosser:
Isn't it a bit dangerous using exec with nmap, since scans may take a while. Thought 'bout using "open" with pipe instead? A bit more complex, but wouldn't block your bot while scanning...

Also, what's the point of this:

Code: Select all

foreach x [split $portlist \n] {
 return "$x"
}
Would'nt it be simpler to just do something like this:

Code: Select all

return [lindex [split $portlist \n] 0]
That's because he doesn't know that it would stop after the first loop. :roll:
R
REDLiNE1
Voice
Posts: 9
Joined: Tue Jul 03, 2007 8:35 pm

Post by REDLiNE1 »

could http://insecure.org get the ports then tcl print the info to a irc chan?
Post Reply