Nmap Development mailing list archives

UINKNOWN ERROR IN HTTP LIBRARY


From: Alo Yommy <aloyommy () gmail com>
Date: Wed, 23 Dec 2015 06:32:35 -0400

 Hi devs,
i have been having problem with nmap scripting, was just trying to get
familiar with the hash function of nmap so i wrote a  small script to
make nmap return either "vulnerable" or "not vulnerable"
here is the script...
......................................................................................................................................
local http = require "http"
local stdnse = require "stdnse"
local openssl = require "openssl"

-- The Rule Section --
portrule = function(host, port)
        return port.number == 80
                and port.protocol == "tcp"
                and port.state == "open"
end

-- The Action Section --
action = function(host, port)

    local response = http.get(host, port)

    if ( response.status == 200 ) then
        local vulnsha1 = "146c72442e340fc6e328e22a313cdfa2"
        local md5str = bin.pack("H", response)
        local sha1 = stdnse.tohex(openssl.md5(md5str))

        if ( sha1 == vulnsha1 ) then
            return "Vulnerable"
        else
            return "Not Vulnerable"
        end
    end
end
.....................................................................................................................................
nmap --script /home/yomighty/Desktop/TNT/test3.nse localhost -p 80

Starting Nmap 7.00SVN ( https://nmap.org ) at 2015-12-23 03:27 AST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00015s latency).
PORT   STATE SERVICE
80/tcp open  http
|_test3: ERROR: Script execution failed (use -d to debug)
......................................................................................................................................

I GOT THESE ERROR USING THE DEBUG FLAG

 nmap --script /home/yomighty/Desktop/TNT/test3.nse localhost -d -p 80

Starting Nmap 7.00SVN ( https://nmap.org ) at 2015-12-23 03:02 AST
--------------- Timing report ---------------
  hostgroups: min 1, max 100000
  rtt-timeouts: init 1000, min 100, max 10000
  max-scan-delay: TCP 1000, UDP 1000, SCTP 1000
  parallelism: min 0, max 0
  max-retries: 10, host-timeout: 0
  min-rate: 0, max-rate: 0
---------------------------------------------
NSE: Using Lua 5.2.
NSE: Arguments from CLI:
NSE: Loaded 1 scripts for scanning.
NSE: Script Pre-scanning.
NSE: Starting runlevel 1 (of 1) scan.
Initiating NSE at 03:02
Completed NSE at 03:02, 0.00s elapsed
Initiating Ping Scan at 03:02
Scanning localhost (127.0.0.1) [2 ports]
Completed Ping Scan at 03:02, 0.00s elapsed (1 total hosts)
Overall sending rates: 7407.41 packets / s.
mass_rdns: Using DNS server 127.0.0.1
Initiating Connect Scan at 03:02
Scanning localhost (127.0.0.1) [1 port]
Discovered open port 80/tcp on 127.0.0.1
Completed Connect Scan at 03:02, 0.00s elapsed (1 total ports)
Overall sending rates: 5813.95 packets / s.
NSE: Script scanning 127.0.0.1.
NSE: Starting runlevel 1 (of 1) scan.
Initiating NSE at 03:02
NSE: Starting test3 against localhost (127.0.0.1:80).
NSE: test3 against localhost (127.0.0.1:80) threw an error!
/usr/local/bin/../share/nmap/nselib/http.lua:941: attempt to
concatenate local 'path' (a nil value)
stack traceback:
        /usr/local/bin/../share/nmap/nselib/http.lua:941: in function 'lookup_cache'
        /usr/local/bin/../share/nmap/nselib/http.lua:1609: in function 'get'
        /home/yomighty/Desktop/TNT/test3.nse:15: in function
</home/yomighty/Desktop/TNT/test3.nse:13>
        (...tail calls...)

.....................................................................................................................................
_______________________________________________
Sent through the dev mailing list
https://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/


Current thread: