Skip to content

NSE script unable to add target ( target.add(...) ) on Archlinux  #2496

@mmpx12

Description

@mmpx12

Adding target is not possible on Archlinux and Termux.

i'm trying to run this little script:

local target = require "target"

prerule = function()
    local status, err = target.add( "localhost","1.1.1.1" )
    print("status: " .. tostring(status))
    print("err: " .. err)
end

action = function() return true end

I'm running the script with:

nmap  --script ./test.nse --script-args=newtargets

And the ouput is:

Starting Nmap 7.92 ( https://nmap.org ) at 2022-06-26 16:17 UTC
ERROR: to add targets run with -sC or --script options.
status: false
err: failed to add new targets.
WARNING: No targets were specified, so 0 hosts scanned.
Nmap done: 0 IP addresses (0 hosts up) scanned in 0.29 seconds

I tried on docker with Debian, Ubuntu, Centos, Alpine and FreeBSD and it's working perfectly. However on Archlinux, Blackarch and also Termux with extra/nmap or blackarch/nmap it's not working.

Easy step for reproduce with docker:

docker run -it --rm archlinux:latest  bash -c 'pacman -Sy --noconfirm nmap &&
    echo """
local target = require \"target\"

prerule = function()
    local status, err = target.add( \"localhost\",\"1.1.1.1\" )
    print(\"status: \" .. tostring(status))
    print(\"err: \" .. err)
end

action = function() return true end
""" > test.nse && nmap  --script ./test.nse --script-args=newtargets'

And with debian (working):

< docker run -it --rm archlinux:latest  bash -c 'pacman -Sy --noconfirm nmap ;
---
> docker run -it --rm debian:latest  bash -c 'apt upgrade && apt install -y nmap ;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions