use xslt!
This commit is contained in:
33
scan_all.php
33
scan_all.php
@ -1,27 +1,44 @@
|
||||
<?php
|
||||
if (!file_exists("scans")) mkdir("scans");
|
||||
|
||||
foreach (scandir("./confs") as $file) {
|
||||
foreach (scandir("./site") as $file) {
|
||||
if (strrpos($file, ".yaml")) {
|
||||
$site = str_replace(".yaml", "", $file);
|
||||
$conf = yaml_parse_file("confs/$file");
|
||||
$yaml = yaml_parse_file("site/$file");
|
||||
|
||||
$targets = [];
|
||||
$services = [];
|
||||
|
||||
foreach ($conf as $sitename => $hosts) {
|
||||
foreach($hosts as $hostaddress => $servicesList) {
|
||||
$targets[$hostaddress] = true;
|
||||
foreach ($servicesList as $service) {
|
||||
$services[$service] = true;
|
||||
$xml = new SimpleXMLElement(<<<XML
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href='../results.xsl' type='text/xsl'?>
|
||||
<lanScanConf/>
|
||||
XML);
|
||||
$xml->addChild("scan path='scans/$site.xml'");
|
||||
|
||||
foreach ($yaml as $siteName => $groups) {
|
||||
$xml->addAttribute("name", $siteName);
|
||||
if ($groups) foreach ($groups as $groupName => $hosts) {
|
||||
$xmlGroup = $xml->addChild("group");
|
||||
$xmlGroup->addAttribute("name", $groupName);
|
||||
if ($hosts) foreach($hosts as $hostaddress => $servicesList) {
|
||||
$targets[$hostaddress] = true;
|
||||
$xmlHost = $xmlGroup->addChild("host");
|
||||
$xmlHost->addAttribute("address", $hostaddress);
|
||||
if ($servicesList) foreach ($servicesList as $service) {
|
||||
$services[$service] = true;
|
||||
$xmlService = $xmlHost->addChild("service");
|
||||
$xmlService->addAttribute("name", $service);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$targets = array_keys($targets);
|
||||
$services = array_keys($services);
|
||||
$xml->asXML("site/$site.xml");
|
||||
|
||||
exec("nmap -v -Pn -p ".join($services, ",")." --script smb-enum-shares.nse -oX 'scans/$site.xml' ".join($targets, " "));
|
||||
//exec("nmap -v -Pn -p ".join($services, ",")." --script smb-enum-shares.nse -oX 'scans/$site.xml' ".join($targets, " "));
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user