From 2e9143c2202fcd1b2266ac51cdff70d40ef5eecb Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Thu, 4 Jul 2024 14:57:20 +0900 Subject: [PATCH] Update nmap.js --- lib/nmap.js | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/lib/nmap.js b/lib/nmap.js index 75701ee..8ca6e6c 100644 --- a/lib/nmap.js +++ b/lib/nmap.js @@ -1,14 +1,28 @@ //////////////////////////////////////////////////////////////////////// -// NMAP API +// NMAP interface API //////////////////////////////////////////////////////////////////////// -var NMAPObject = function() { - this.binPath = "bin\\32bit\\nmap-7.92\\nmap.exe"; +var client = require("lib/catproxy"); - this.start = function() { - var cmd = []; - // .. todo .. - }; +var PortScanner = function(binpath, url) { + this.url = url; + this.binpath = binpath; + + this.scan = function(hosts) { + var worker = client.create(url); + worker.set_method("scan_ports_by_hosts"); + + var result = worker.exec({ + "binpath": this.binpath, + "hosts": hosts + }); + return result; + } }; -exports.NMAPObject = NMAPObject; +exports.PortScanner = PortScanner; + +exports.VERSIONINFO = "NMAP interface version 0.2"; +exports.AUTHOR = "abuse@catswords.net"; +exports.global = global; +exports.require = global.require;