split scan
This commit is contained in:
parent
874e5bb833
commit
8973dc8979
@ -1,93 +0,0 @@
|
|||||||
local shortport = require "shortport"
|
|
||||||
|
|
||||||
description = [[
|
|
||||||
Get and return a page info
|
|
||||||
]]
|
|
||||||
|
|
||||||
---
|
|
||||||
-- @args http-get.path Path to get. Default /.
|
|
||||||
--
|
|
||||||
-- @usage nmap -p80 --script http-get.nse --script-args http-get.path=/ <target>
|
|
||||||
--
|
|
||||||
-- @output
|
|
||||||
-- status: 200
|
|
||||||
-- status-line: HTTP/1.1 200 OK\x0D
|
|
||||||
---
|
|
||||||
|
|
||||||
categories = {"discovery", "intrusive"}
|
|
||||||
author = "Adrien Malingrey"
|
|
||||||
license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
|
|
||||||
|
|
||||||
portrule = shortport.service({"http", "https", "ssl"})
|
|
||||||
|
|
||||||
|
|
||||||
local http = require "http"
|
|
||||||
local stdnse = require "stdnse"
|
|
||||||
|
|
||||||
action = function(host, port)
|
|
||||||
local scheme = ""
|
|
||||||
local hostaddress = (host.name ~= '' and host.name) or host.ip
|
|
||||||
local path = ""
|
|
||||||
local answer
|
|
||||||
local favicon = "/favicon.ico"
|
|
||||||
|
|
||||||
if (port.service == "ssl") then
|
|
||||||
scheme = "https"
|
|
||||||
else
|
|
||||||
scheme = port.service
|
|
||||||
end
|
|
||||||
|
|
||||||
if(stdnse.get_script_args('http-get.path')) then
|
|
||||||
path = "/" .. stdnse.get_script_args('http-get.path')
|
|
||||||
end
|
|
||||||
|
|
||||||
answer = http.get_url(scheme.."://"..hostaddress..":"..port.number.."/"..path)
|
|
||||||
|
|
||||||
if (answer and answer.status == 200) then
|
|
||||||
favicon_relative_uri = parseIcon(answer.body) or "favicon.ico"
|
|
||||||
end
|
|
||||||
|
|
||||||
favicon_absolute_uri = scheme.."://"..hostaddress..":"..port.number.."/"..favicon_relative_uri
|
|
||||||
favicon = http.get_url(favicon_absolute_uri)
|
|
||||||
|
|
||||||
if (favicon and favicon.status == 200) then
|
|
||||||
return {status=answer.status, ["status-line"]=answer["status-line"], favicon=favicon_absolute_uri}
|
|
||||||
else
|
|
||||||
return {status=answer.status, ["status-line"]=answer["status-line"]}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--- function taken from http_favicon.nse by Vlatko Kosturjak
|
|
||||||
|
|
||||||
function parseIcon( body )
|
|
||||||
local _, i, j
|
|
||||||
local rel, href, word
|
|
||||||
|
|
||||||
-- Loop through link elements.
|
|
||||||
i = 0
|
|
||||||
while i do
|
|
||||||
_, i = string.find(body, "<%s*[Ll][Ii][Nn][Kk]%s", i + 1)
|
|
||||||
if not i then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
-- Loop through attributes.
|
|
||||||
j = i
|
|
||||||
while true do
|
|
||||||
local name, quote, value
|
|
||||||
_, j, name, quote, value = string.find(body, "^%s*(%w+)%s*=%s*([\"'])(.-)%2", j + 1)
|
|
||||||
if not j then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
if string.lower(name) == "rel" then
|
|
||||||
rel = value
|
|
||||||
elseif string.lower(name) == "href" then
|
|
||||||
href = value
|
|
||||||
end
|
|
||||||
end
|
|
||||||
for word in string.gmatch(rel or "", "%S+") do
|
|
||||||
if string.lower(word) == "icon" then
|
|
||||||
return href
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -39,5 +39,5 @@ $xml->asXML("site/$site.xml");
|
|||||||
$targets = join(array_keys($targets), " ");
|
$targets = join(array_keys($targets), " ");
|
||||||
$services = join(array_keys($services), ",");
|
$services = join(array_keys($services), ",");
|
||||||
|
|
||||||
echo ("nmap -v -Pn -p $services --script $__DIR__/http-info.nse -oX $__DIR__/scans/.~$site.xml $targets");
|
echo ("nmap -Pn -p $services --script $__DIR__/http-info.nse -oX $__DIR__/scans/.~$site.xml $targets");
|
||||||
?>
|
?>
|
||||||
|
8
scan.sh
Executable file
8
scan.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
DIR="$(dirname -- "$0")"
|
||||||
|
conf="$1"
|
||||||
|
|
||||||
|
site="$(basename ${conf/.yaml/})"
|
||||||
|
php "$DIR/nmap_cmd.php" $conf | sh
|
||||||
|
mv "$DIR/scans/.~$site.xml" "$DIR/scans/$site.xml"
|
@ -1,13 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
DIR="$(dirname -- "$0")"
|
DIR="$(dirname -- $0)"
|
||||||
|
|
||||||
mkdir -p "$DIR"/scans
|
mkdir -p "$DIR"/scans
|
||||||
mkdir -p "$DIR"/site
|
mkdir -p "$DIR"/site
|
||||||
|
|
||||||
for conf in "$DIR"/confs/*.yaml
|
for conf in "$DIR"/confs/*.yaml
|
||||||
do
|
do
|
||||||
site="$(basename ${conf/.yaml/})"
|
./scan.sh "$conf"
|
||||||
php "$DIR/nmap_cmd.php" $conf | sh
|
|
||||||
mv "$DIR/scans/.~$site.xml" "$DIR/scans/$site.xml"
|
|
||||||
done
|
done
|
||||||
|
32
to_xml.php
32
to_xml.php
@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
$file = $argv[1];
|
|
||||||
$site = basename($file, ".yaml");
|
|
||||||
|
|
||||||
$conf = yaml_parse_file($file);
|
|
||||||
|
|
||||||
$xml = new SimpleXMLElement(<<<XML
|
|
||||||
<?xml version="1.0"?>
|
|
||||||
<?xml-stylesheet href='../results.xsl' type='text/xsl'?>
|
|
||||||
<lanScanConf scanpath="scans/$site.xml"/>
|
|
||||||
XML
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($conf as $key => $value) {
|
|
||||||
if ($key == "site") {
|
|
||||||
$xml->addAttribute("site", $value);
|
|
||||||
} else {
|
|
||||||
$xmlGroup = $xml->addChild("group");
|
|
||||||
$xmlGroup->addAttribute("name", $key);
|
|
||||||
foreach($value as $hostaddress => $servicesList) {
|
|
||||||
$xmlHost = $xmlGroup->addChild("host");
|
|
||||||
$xmlHost->addAttribute("address", $hostaddress);
|
|
||||||
if ($servicesList) foreach ($servicesList as $service) {
|
|
||||||
$xmlService = $xmlHost->addChild("service");
|
|
||||||
$xmlService->addAttribute("name", $service);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
echo $xml->asXML();
|
|
||||||
?>
|
|
Loading…
x
Reference in New Issue
Block a user