Marvin
Marvin

Reputation: 33

Nmap NSE script sh: 1: not found

I am working on a scanner with Nmap. I am expanding this scanner with NSE scripts.

I have a script that runs 'Nuclei', using Nmap. This script is made and used by someone else, and it has worked before. However, when I run it now, I get the error: sh: 1: nuclei: not found. Nuclei is (of course) installed on the system, and it works as root and normal user. It looks like Nmap doesn't have access to Nuclei, but how to fix?

The NSE script:

local shortport = require "shortport"
local stdnse = require "stdnse" 

portrule = function(host,port) 
    return true
end 

action = function(host,port) 
    local handle = ""
        local always = stdnse.get_script_args("nuclei.always")
    local hostname = stdnse.get_hostname(host)
    
    if     port.number == 80 then
        handle = io.popen("nuclei -u http://" .. hostname .. " -nc -silent -etags intrusive -rl 30 -rlm 1000 -bs 8 -c 8")
    elseif port.number == 443 then 
        handle = io.popen("nuclei -u https://" .. hostname .. " -nc -silent -etags intrusive -rl 30 -rlm 1000 -bs 8 -c 8")
    elseif always == "yes" then      
        handle = io.popen("nuclei -u " .. hostname .. " -nc -silent -etags intrusive -rl 30 -rlm 1000 -bs 8 -c 8")
    end 
    local result = handle:read("*a") 
    handle:close()
    return result
end 

The Nmap command: nmap -script=nuclei.nse -p80,443 -T2 IPADDRESS Nmap is installed using Snap. It runs on Ubuntu.

Upvotes: 0

Views: 452

Answers (1)

Marvin
Marvin

Reputation: 33

The solution was quite simple: Install nmap using apt, instead of snap did the job.

Upvotes: 0

Related Questions