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.

A little help with !nmap <ip|hostname> [arguments]

Support & discussion of released scripts, and announcements of new releases.
Post Reply
e
edu
Voice
Posts: 31
Joined: Sun Oct 29, 2006 2:10 pm

A little help with !nmap <ip|hostname> [arguments]

Post by edu »

hey guys, I have a little problem here

Here's the code:

Code: Select all

bind pub - !nmap nmap:scan
proc nmap:scan {nickname hostname handle channel text} {
      set text [split $text]
	set nmap_host [lindex $text 0]
	if {$nmap_host == ""} {
		putquick "NOTICE $nickname :SYNTAX: !nmap <ip|hostname> \[arguments\]"
		return
	}
	set nmap_arg [lindex $text 1]
	if {$nmap_arg == ""} {
		putquick "PRIVMSG $channel :Scanning $nmap_host (DEFAULT) will occupy me for about one minute!"
		global data_var
		set data_var [exec nmap $nmap_host]
		set l_data_var [split $data_var "\r\n"]
	} else {
		putquick "PRIVMSG $channel :Scanning $nmap_host ($nmap_arg) will occupy me for about one minute!"
		global data_var
		set data_var [exec nmap $nmap_host $nmap_arg]
		set l_data_var [split $data_var "\r\n"]
	}
	foreach nmap_info $l_data_var { 
		putquick "PRIVMSG $channel :$nmap_info"
	}
}
When I do "!nmap motd.cc":

Code: Select all

( 10:53:35 [a] ) <@Protos0> Scanning motd.cc (DEFAULT) will occupy me for about one minute!
( 10:55:16 [a] ) <@Protos0> Starting Nmap 4.20 ( http://insecure.org ) at 2007-06-09 10:53 CEST
( 10:55:16 [a] ) <@Protos0> Interesting ports on ip-208-109-197-133.ip.secureserver.net (208.109.197.133):
( 10:55:18 [a] ) <@Protos0> Not shown: 1665 closed ports
( 10:55:20 [a] ) <@Protos0> PORT      STATE    SERVICE
( 10:55:22 [a] ) <@Protos0> 21/tcp    open     ftp
( 10:55:24 [a] ) <@Protos0> 22/tcp    open     ssh
( 10:55:26 [a] ) <@Protos0> 25/tcp    open     smtp
( 10:55:28 [a] ) <@Protos0> 42/tcp    filtered nameserver
( 10:55:30 [a] ) <@Protos0> 53/tcp    open     domain
( 10:55:32 [a] ) <@Protos0> 69/tcp    filtered tftp
( 10:55:34 [a] ) <@Protos0> 80/tcp    open     http
( 10:55:36 [a] ) <@Protos0> 106/tcp   open     pop3pw
( 10:55:38 [a] ) <@Protos0> 110/tcp   open     pop3
( 10:55:40 [a] ) <@Protos0> 113/tcp   open     auth
( 10:55:42 [a] ) <@Protos0> 135/tcp   filtered msrpc
( 10:55:44 [a] ) <@Protos0> 137/tcp   filtered netbios-ns
( 10:55:46 [a] ) <@Protos0> 138/tcp   filtered netbios-dgm
( 10:55:48 [a] ) <@Protos0> 139/tcp   filtered netbios-ssn
( 10:55:50 [a] ) <@Protos0> 143/tcp   open     imap
( 10:55:52 [a] ) <@Protos0> 161/tcp   filtered snmp
( 10:55:54 [a] ) <@Protos0> 162/tcp   filtered snmptrap
( 10:55:56 [a] ) <@Protos0> 179/tcp   filtered bgp
( 10:55:58 [a] ) <@Protos0> 443/tcp   open     https
( 10:56:00 [a] ) <@Protos0> 465/tcp   open     smtps
( 10:56:02 [a] ) <@Protos0> 993/tcp   open     imaps
( 10:56:04 [a] ) <@Protos0> 995/tcp   open     pop3s
( 10:56:06 [a] ) <@Protos0> 1080/tcp  filtered socks
( 10:56:08 [a] ) <@Protos0> 1241/tcp  filtered nessus
( 10:56:10 [a] ) <@Protos0> 3128/tcp  filtered squid-http
( 10:56:12 [a] ) <@Protos0> 3306/tcp  open     mysql
( 10:56:14 [a] ) <@Protos0> 6666/tcp  filtered irc-serv
( 10:56:16 [a] ) <@Protos0> 6667/tcp  filtered irc
( 10:56:18 [a] ) <@Protos0> 6668/tcp  filtered irc
( 10:56:20 [a] ) <@Protos0> 8080/tcp  filtered http-proxy
( 10:56:22 [a] ) <@Protos0> 8443/tcp  open     https-alt
( 10:56:24 [a] ) <@Protos0> 31337/tcp open     Elite
( 10:56:28 [a] ) <@Protos0> Nmap finished: 1 IP address (1 host up) scanned in 100.776 seconds
The problem is when I do something like "!nmap 1" as know as an ERROR, I want it to "reply" into the $channel, not in DCC, the ERROR belong:

Code: Select all

( 10:58:12 [a] ) <Protos0> Tcl error [nmap:scan]: 
( 10:58:12 [a] ) <Protos0> Starting Nmap 4.20 ( http://insecure.org ) at 2007-06-09 10:58 CEST
( 10:58:12 [a] ) <Protos0> Invalid target host specification: 1
( 10:58:12 [a] ) <Protos0> QUITTING!
Please help me, thanks.
Seek the truth
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

You need to catch{} the error msg..

Code: Select all

      set data_var (catch {[exec nmap $nmap_host $nmap_arg]} error)
      if {$error != ""} {puthelp "PRIVMSG $channel :$error"}
something like that.
Post Reply