Compare commits

...

2 Commits

Author SHA1 Message Date
7b66313c01 toxml 2023-04-07 02:34:57 +02:00
d3b5a014e1 separate confs and scans 2023-04-07 02:34:42 +02:00
8 changed files with 31 additions and 11 deletions

6
.gitignore vendored
View File

@ -1,3 +1,3 @@
scans/*.yaml
!scans/example.yaml
scans/*.xml
confs/*.yaml
!confs/example.yaml
scans/

View File

@ -2,7 +2,7 @@
Scan hosts with nmap and display results in webpage.
* Create a configuration yaml file in scans/ subdirectory (see example.yaml).
* Create a configuration yaml file in confs/ subdirectory (see example.yaml).
It may be generated by scanning a network with `init.sh`.
* Scan with `php scan_all.php` (use a cron task!).
* Open index.php to see results.

View File

@ -2,8 +2,8 @@
$site = filter_input(INPUT_GET, "site", FILTER_SANITIZE_STRING);
$site = escapeshellcmd($site);
if ($site and file_exists("scans/$site.yaml") and file_exists("scans/$site.xml")) {
$conf = yaml_parse_file("scans/$site.yaml");
if ($site and file_exists("confs/$site.yaml") and file_exists("scans/$site.xml")) {
$conf = yaml_parse_file("confs/$site.yaml");
$scan = simplexml_load_file("scans/$site.xml");
require("results.php");
} else {

View File

@ -10,5 +10,5 @@ echo "Nom du site ?"
read name
echo "Plage IP (xxx.xxx.xxx.xxx/xx) ?"
read network
nmap --script smb-enum-shares.nse -oX "scans/$name.xml" $network
xsltproc toyaml.xsl "scans/$name.xml" > "scans/$name.yaml"
nmap --script smb-enum-shares.nse -oX "confs/$name.xml" $network
xsltproc toyaml.xsl "confs/$name.xml" > "confs/$name.yaml"

2
ls.php
View File

@ -22,7 +22,7 @@
</header>
<div class="ui main text container">
<div class="ui link selection list">
<?php foreach (scandir("./scans") as $file) {
<?php foreach (scandir("./confs") as $file) {
if (strrpos($file, ".yaml")) {
$site = str_replace(".yaml", "", $file);
if (file_exists("scans/$site.xml")) {

View File

@ -1,8 +1,9 @@
<?php
foreach (scandir("./scans") as $file) {
mkdir("scans");
foreach (scandir("./confs") as $file) {
if (strrpos($file, ".yaml")) {
$site = str_replace(".yaml", "", $file);
$conf = yaml_parse_file("scans/$file");
$conf = yaml_parse_file("confs/$file");
$targets = [];
$services = [];

19
toxml.php Normal file
View File

@ -0,0 +1,19 @@
<?php
$yaml = yaml_parse_file($argv[1]);
$xml = new SimpleXMLElement("<lanScanConf></lanScanConf>");
foreach ($yaml as $groupName => $hosts) {
$xmlGroup = $xml->addChild("group");
$xmlGroup->addAttribute("name", $groupName);
if ($hosts) foreach ($hosts as $hostName => $services) {
$xmlHost = $xmlGroup->addChild("host");
$xmlHost->addAttribute("name", $hostName);
if ($services) foreach ($services as $service) {
$xmlHost->addChild("service");
$xmlHost->addAttribute("name", $service);
}
}
}
echo $xml->asXML();
?>