options (WIP)
This commit is contained in:
parent
d0de27c4a2
commit
c2268c4f00
@ -4,5 +4,8 @@ $BASEDIR = "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['SERVER_NAME']}$port
|
|||||||
$SCANSDIR = "scans";
|
$SCANSDIR = "scans";
|
||||||
$STYLESHEETSDIR = "stylesheets";
|
$STYLESHEETSDIR = "stylesheets";
|
||||||
|
|
||||||
$lanScanCmd = "sudo nmap -PSmicrosoft-ds -F -T5 --datadir . --script http-info,smb-shares-size --script-args-file script-args.ini -oX - --stylesheet $BASEDIR/$STYLESHEETSDIR/lanScan.xsl";
|
$NMAP = "sudo nmap"; # nmap command, E.g. 'nmap', 'sudo nmap' for root privileges or '/usr/bin/nmap' if not in PATH
|
||||||
$hostScanCmd = "sudo nmap -A -T5 --datadir . --script http-info,smb-shares-size --script-args-file script-args.ini -oX - --stylesheet $BASEDIR/$STYLESHEETSDIR/hostScan.xsl";
|
$LANSCANOPTIONS = "-PSmicrosoft-ds -F -T5 --datadir . --script http-info,smb-shares-size --script-args-file script-args.ini -oX - --stylesheet $BASEDIR/$STYLESHEETSDIR/lanScan.xsl";
|
||||||
|
$HOSTSCANOPTIONS = "-A -T5 --datadir . --script http-info,smb-shares-size --script-args-file script-args.ini -oX - --stylesheet $BASEDIR/$STYLESHEETSDIR/hostScan.xsl";
|
||||||
|
$DATADIR = ".";
|
||||||
|
$SCRIPTARGSFILE = "script-args.ini";
|
@ -31,6 +31,15 @@ body > .grid {
|
|||||||
<h2 class="ui inverted teal fluid image header logo">
|
<h2 class="ui inverted teal fluid image header logo">
|
||||||
lan<?php include 'logo.svg'; ?>can
|
lan<?php include 'logo.svg'; ?>can
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
<?php if(isset($errorMessage)) { ?>
|
||||||
|
<div class="ui negative message">
|
||||||
|
<i class="close icon"></i>
|
||||||
|
<div class="header">Erreur</div>
|
||||||
|
<p><?=$errorMessage?></p>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<form id="scanForm" class="ui large form initial inverted" action="scan.php" method="get">
|
<form id="scanForm" class="ui large form initial inverted" action="scan.php" method="get">
|
||||||
<div class="ui left aligned stacked segment inverted">
|
<div class="ui left aligned stacked segment inverted">
|
||||||
<h4 class="ui header">Découvrir ou superviser un réseau</h4>
|
<h4 class="ui header">Découvrir ou superviser un réseau</h4>
|
||||||
|
696
options.php
Executable file
696
options.php
Executable file
@ -0,0 +1,696 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>lanScan</title>
|
||||||
|
<link rel="icon" href="favicon.ico" />
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.3/dist/semantic.min.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css"
|
||||||
|
href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.3/dist/semantic.min.css" />
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/@yaireo/tagify"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/@yaireo/tagify/dist/tagify.polyfills.min.js"></script>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/@yaireo/tagify/dist/tagify.css" rel="stylesheet" type="text/css" />
|
||||||
|
<link href="style.css" rel="stylesheet" type="text/css" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<nav class="ui inverted secondary menu">
|
||||||
|
<a href="." class="ui header button item logo">lan<?php include 'logo.svg'; ?>can</a>
|
||||||
|
<div class="right menu">
|
||||||
|
<div class="item">
|
||||||
|
<a class="button item" href="https://nmap.org/man/fr/index.html" target="_blank">
|
||||||
|
<i class="question circle icon"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<main class="ui main container">
|
||||||
|
|
||||||
|
<h1 class="ui inverted header">Scanner un <?=$preset == "host"? "hôte" : "réseau" ?></h1>
|
||||||
|
|
||||||
|
<form id="newScanForm" class="ui inverted form" method="get" action="scan.php">
|
||||||
|
<div class="field">
|
||||||
|
<label for="targetsInput" title="Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc.
|
||||||
|
Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.0-255.0-255.1-254">Cibles</label>
|
||||||
|
<input id="targetsInput" type="text" name="targets" placeholder="Cibles"
|
||||||
|
pattern="[a-zA-Z0-9._\/ \-]+" value="<?= $targets; ?>" list="targetsList"
|
||||||
|
title="Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc.
|
||||||
|
Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.0-255.0-255.1-254" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui styled fluid inverted accordion field">
|
||||||
|
<div class="title"><i class="icon dropdown"></i>Spécification des cibles</div>
|
||||||
|
<div class="content">
|
||||||
|
<div class="field">
|
||||||
|
<label for="excludeInput" title="--exclude">Exclure les hôtes ou réseaux</label>
|
||||||
|
<input id="excludeInput" type="text" name="--exclude" placeholder="Hôte/réseau" list="targetsList"
|
||||||
|
pattern="[a-zA-Z0-9._\/,\-]*" value="<?= $options['--exclude'] ?? "" ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label for="iRInput" title="-iR">Nombre de cibles au hasard</label>
|
||||||
|
<input id="iRInput" type="number" min="0" name="-iR" placeholder="Nombre"
|
||||||
|
value="<?= $options['-iR'] ?? "" ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="title"><i class="icon dropdown"></i>Découverte des hôtes actifs</div>
|
||||||
|
<div class="content">
|
||||||
|
<div class="inline field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="PnCheckbox" type="checkbox" name="-Pn" <?= $options['-Pn'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="PnCheckbox" title="-Pn">Sauter cette étape (considérer tous les hôtes comme actifs)</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label for="PSInput" title="-PS">TCP SYN</label>
|
||||||
|
<input id="PSInput" type="text" name="-PS" placeholder="Ports" list="servicesList"
|
||||||
|
pattern="([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*" value="<?= $options['-PS'] ?? "" ?>"
|
||||||
|
title="Liste de ports ex: 22,23,25,80,200-1024,60000-">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label for="PAInput" title="-PA">TCP ACK</label>
|
||||||
|
<input id="PAInput" type="text" name="-PA" placeholder="Ports" list="servicesList"
|
||||||
|
pattern="([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*" value="<?= $options['-PA'] ?? "" ?>"
|
||||||
|
title="Liste de ports ex: 22,23,25,80,200-1024,60000-">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label for="PUInput" title="-PU">UDP</label>
|
||||||
|
<input id="PUInput" type="text" name="-PU" placeholder="Ports" list="servicesList"
|
||||||
|
pattern="([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*" value="<?= $options['-PU'] ?? "" ?>"
|
||||||
|
title="Liste de ports ex: 22,23,25,80,200-1024,60000-">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label>ICMP</label>
|
||||||
|
<div class="inline fields">
|
||||||
|
<div class="field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="PECheckbox" type="checkbox" name="-PE" <?= $options['-PE'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="PECheckbox" title="-PE">Echo request</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="PPCheckbox" type="checkbox" name="-PP" <?= $options['-PP'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="PPCheckbox" title="-PP">Timestamp request</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="PMCheckbox" type="checkbox" name="-PM" <?= $options['-PM'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="PMCheckbox" title="-PM">Mask request</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label for="POInput" title="-PO">Protocole IP (par type)</label>
|
||||||
|
<input id="POInput" type="text" name="-PO" placeholder="Protocole"
|
||||||
|
pattern="[0-9,\-]+" value="<?= $options['-PO'] ?? "" ?>"
|
||||||
|
title="[num de protocole]">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="inline fields">
|
||||||
|
<div class="field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="PRCheckbox" type="checkbox" name="-PR" <?= $options['-PR'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="PRCheckbox" title="-PR">Ping ARP</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="sendIPCheckbox" type="checkbox" name="--send-ip" <?= $options['--send-ip'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="sendIPCheckbox" title="--send-ip">Pas de scan ARP</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="inline fields">
|
||||||
|
<div class="field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="nCheckbox" type="checkbox" name="-n" <?= $options['-n'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="nCheckbox" title="-n">Ne jamais résoudre les noms DNS</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="RCheckbox" type="checkbox" name="-R" <?= $options['-R'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="nCheckbox" title="-R">Toujours résoudre les noms DNS<br />(par défault seuls les hôtes actifs sont résolus)</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label for="dnsServersInput" title="--dns-servers">Utiliser les serveurs DNS</label>
|
||||||
|
<input id="dnsServersInput" type="text" name="--dns-servers" placeholder="serveur"
|
||||||
|
pattern="[a-zA-Z0-9._,\-]*" value="<?= $options['--dns-servers'] ?? "" ?>"
|
||||||
|
title="serv1[,serv2],...">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="title"><i class="icon dropdown"></i>Techniques de scan de ports</div>
|
||||||
|
<div class="content">
|
||||||
|
<div class="field">
|
||||||
|
<div class="fields">
|
||||||
|
<div class="field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="sSCheckbox" type="checkbox" name="-sS" <?= $options['-sS'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="sSCheckbox" title="-sS">TCP SYN</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="sTCheckbox" type="checkbox" name="-sT" <?= $options['-sT'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="sTCheckbox" title="-sT">TCP Connect()</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="sACheckbox" type="checkbox" name="-sA" <?= $options['-sA'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="sACheckbox" title="-sA">TCP ACK</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="fields">
|
||||||
|
<div class="field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="sWCheckbox" type="checkbox" name="-sW" <?= $options['-sW'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="sWCheckbox" title="-sW">Fenêtre TCP</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="sMCheckbox" type="checkbox" name="-sM" <?= $options['-sM'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="sMCheckbox" title="-sM">Maimon</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="sNCheckbox" type="checkbox" name="-sN" <?= $options['-sN'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="sNCheckbox" title="-sN">TCP Null</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="fields">
|
||||||
|
<div class="field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="sFCheckbox" type="checkbox" name="-sF" <?= $options['-sF'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="sFCheckbox" title="-sF">TCP FIN</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="sXCheckbox" type="checkbox" name="-sX" <?= $options['-sX'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="sXCheckbox" title="-sX">Sapin de Noël</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="sUCheckbox" type="checkbox" name="-sU" <?= $options['-sU'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="sUCheckbox" title="-sU">UDP</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label for="scanflagsInput" title="--scanflags">Scan TCP personnalisé</label>
|
||||||
|
<input id="scanflagsInput" type="text" name="--scanflags" placeholder="Drapeaux TCP" list="flagsList"
|
||||||
|
pattern="(URG|ACK|PSH|RST|SYN|FIN|,)+|[1-9]?[0-9]|[1-2][0-9][0-9]" value="<?= $options['--scanflags'] ?? "" ?>"
|
||||||
|
title="Mélanger simplement les drapeaux URG, ACK, PSH, RST, SYN et FIN.">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label for="sIInput" title="-sI">Hôte zombie</label>
|
||||||
|
<input id="sIInput" type="text" name="-p" placeholder="zombie host[:probeport]"
|
||||||
|
pattern="[a-zA-Z0-9._\-]+(:[0-9]+)?" value="<?= $options['-sI'] ?? "" ?>"
|
||||||
|
title="zombie host[:probeport]">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label for="bInput" title="-b">Rebond FTP</label>
|
||||||
|
<input id="bInput" type="text" name="-p" placeholder="[<username>[:<password>]@]<server>[:<port>]"
|
||||||
|
pattern="([a-zA-Z0-9._\-]+(:.+)?@)?[a-zA-Z0-9._\-]+(:[0-9]+)?" value="<?= $options['-b'] ?? "" ?>"
|
||||||
|
title="[<username>[:<password>]@]<server>[:<port>]">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="sUCheckbox" type="checkbox" name="-sU" <?= $options['-sU'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="sUCheckbox" title="-sO">Scan des protocoles supportés par la couche IP</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="title"><i class="icon dropdown"></i>Spécifications des ports et ordre du scan</div>
|
||||||
|
<div class="content">
|
||||||
|
<div class="inline field">
|
||||||
|
<div class="ui toggle checkbox" title="-sP">
|
||||||
|
<input id="sPCheckbox" type="checkbox" name="-sP" <?= $options['-sP'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="sPCheckbox">Sauter cette étape</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="inline field">
|
||||||
|
<div class="ui toggle checkbox" title="-F">
|
||||||
|
<input id="FCheckbox" type="checkbox" name="-F" <?= $options['-F'] ?? false ? 'checked' : ''; ?>
|
||||||
|
onchange="pInput.disabled = FCheckbox.checked" />
|
||||||
|
<label for="FCheckbox">Scanner les ports connus</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label for="pInput" title="-p">Scanner les ports</label>
|
||||||
|
<input id="pInput" type="text" name="-p" placeholder="Ports" list="servicesList" <?= $options['-F'] ?? false ? 'disabled' : ''; ?>
|
||||||
|
pattern="(([TU]:)?[0-9\-]+|[a-z\-]+)(,([TU]:)?[0-9\-]+|,[a-z\-]+)*" value="<?= $options['-p'] ?? "" ?>"
|
||||||
|
title="Liste de ports ex: ssh,ftp,U:53,111,137,T:21-25,80,139,8080">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="inline field">
|
||||||
|
<div class="ui toggle checkbox" title="-r">
|
||||||
|
<input id="rCheckbox" type="checkbox" name="-r" <?= $options['-r'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="rCheckbox">Ne pas mélanger les ports</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="title"><i class="icon dropdown"></i>Détection de services et de versions</div>
|
||||||
|
<div class="content">
|
||||||
|
<div class="inline field">
|
||||||
|
<div class="ui toggle checkbox" title="-sV">
|
||||||
|
<input id="sVCheckbox" type="checkbox" name="-sV" <?= $options['-sV'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="sVCheckbox">Détection de version</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="inline field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="allportsCheckbox" type="checkbox" name="--allports" <?= $options['--allports'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="allportsCheckbox" title="--allports">N'exclure aucun port de la détection de version</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label for="versionIntensityInput" title="--version-intensity">Intensité des tests de version</label>
|
||||||
|
<input type="number" min="0" max="9" id="versionIntensityInput" name="--version-intensity" placeholder="0-9"
|
||||||
|
value="<?= $options["--version-intensity"] ?? "" ?>" title="2: léger, 9: tous, défaut: 7">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="inline field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="sRCheckbox" type="checkbox" name="-sR" <?= $options['-sR'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="sRCheckbox" title="-sR">Scan RPC</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="title"><i class="icon dropdown"></i>Scripts</div>
|
||||||
|
<div class="content">
|
||||||
|
<div class="inline field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="sCCheckbox" type="checkbox" name="-sC" <?= $options['-sC'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="sCCheckbox" title="-sC">Scripts par défaut</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label for="scriptInput">Scripts</label>
|
||||||
|
<input id="scriptInput" type="text" name="--script" placeholder="Nom"
|
||||||
|
title="<catégories|répertoire|nom|all>" list="scripts" pattern="[a-z][a-z0-9\-\.\/]*"
|
||||||
|
value="<?= $options["--script"] ?? ""; ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label for="scriptArgsInput" title="--script-args">Arguments des scripts</label>
|
||||||
|
<input id="scriptArgsInput" type="text" name="--script-args" placeholder="arg=valeur"
|
||||||
|
pattern='[a-zA-Z][a-zA-Z0-9\-_]*=[^"]+(,[a-zA-Z][a-zA-Z0-9\-_]*=[^"]+)?' value="<?= $options['--script-args'] ?? "" ?>"
|
||||||
|
title="<n1=v1,[n2=v2,...]>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="inline field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="scriptTraceCheckbox" type="checkbox" name="--script-trace" <?= $options['--script-trace'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="scriptTraceCheckbox" title="--script-trace">Montrer toutes les données envoyées ou recues</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="inline field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="scriptUpdateDBCheckbox" type="checkbox" name="--script-updatedb" <?= $options['--script-updatedb'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="scriptUpdateDBCheckbox" title="--script-updatedb">Mettre à jour la base de données des scripts</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="title"><i class="icon dropdown"></i>Détection du système d'exploitation</div>
|
||||||
|
<div class="content">
|
||||||
|
<div class="inline field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="OCheckbox" type="checkbox" name="-O" <?= $options['-O'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="OCheckbox" title="-O">Détecter le système d'exploitation</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="inline field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="osscanLimitCheckbox" type="checkbox" name="--osscan-limit" <?= $options['--osscan-limit'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="osscanLimitCheckbox" title="--osscan-limit">Seulement les cibles prometteuses</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="inline field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="osscanGuessCheckbox" type="checkbox" name="--osscan-guess" <?= $options['--osscan-guess'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="osscanGuessCheckbox" title="--osscan-guess">Essayer de deviner</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label for="maxOSTriesInput" title="--max-os-tries">Nombre d'essais maximum</label>
|
||||||
|
<input type="number" min="0" id="maxOSTriesInput" name="--max-os-tries" placeholder="Nombre"
|
||||||
|
value="<?= $options["--max-os-tries"] ?? "" ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="title"><i class="icon dropdown"></i>Temporisation et performances</div>
|
||||||
|
<div class="content">
|
||||||
|
<div class="field">
|
||||||
|
<label for="TSelect" title="--T">Intensité des tests de version</label>
|
||||||
|
<select id="TSelect" class="ui clearable dropdown" name="-T" value="<?= $options["-T"] ?? ""?>">
|
||||||
|
<option value="0"<?=($options["-T"]??"")==0?" selected":""?>>Paranoïaque</option>
|
||||||
|
<option value="1"<?=($options["-T"]??"")==1?" selected":""?>>Sournois</option>
|
||||||
|
<option value="2"<?=($options["-T"]??"")==2?" selected":""?>>Poli</option>
|
||||||
|
<option value="3"<?=($options["-T"]??"")==3?" selected":""?>>Normal</option>
|
||||||
|
<option value="4"<?=($options["-T"]??"")==4?" selected":""?>>Aggressif</option>
|
||||||
|
<option value="5"<?=($options["-T"]??"")==5?" selected":""?>>Dément</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label>Tailles des groupes d'hôtes à scanner en parallèle</label>
|
||||||
|
<div class="two fields">
|
||||||
|
<div class="field">
|
||||||
|
<label for="minHostgroupInput" title="--min-hostgroup">Minimum</label>
|
||||||
|
<input id="minHostgroupInput" type="number" min="0" placeholder="Nombre"
|
||||||
|
value="<?= $options["--min-hostgroup"] ?? "" ?>"
|
||||||
|
oninput="maxHostgroupInput.min = minHostgroupInput.value">
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label for="maxHostgroupInput" title="--max-hostgroup">Maximum</label>
|
||||||
|
<input id="maxHostgroupInput" type="number" min="0" placeholder="Nombre"
|
||||||
|
value="<?= $options["--max-hostgroup"] ?? "" ?>"
|
||||||
|
oninput="minHostgroupInput.max = maxHostgroupInput.value">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label>Parallélisation des paquets de tests</label>
|
||||||
|
<div class="two fields">
|
||||||
|
<div class="field">
|
||||||
|
<label for="minParallelismInput" title="--min-parallelism">Minimum</label>
|
||||||
|
<input id="minParallelismInput" type="number" min="0" placeholder="Nombre"
|
||||||
|
value="<?= $options["--min-parallelism"] ?? "" ?>"
|
||||||
|
oninput="maxParallelismInput.min = minParallelismInput.value">
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label for="maxParallelismInput" title="--max-parallelism">Maximum</label>
|
||||||
|
<input id="maxParallelismInput" type="number" min="0" placeholder="Nombre"
|
||||||
|
value="<?= $options["--max-parallelism"] ?? "" ?>"
|
||||||
|
oninput="minParallelismInput.max = maxParallelismInput.value">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label>Temps d'aller-retour des paquets de tests</label>
|
||||||
|
<div class="three fields">
|
||||||
|
<div class="field">
|
||||||
|
<label for="initialRTTNumber" title="--initial-rtt-timeout">Initial</label>
|
||||||
|
<div class="ui right labeled input">
|
||||||
|
<input type="number" min="0" id="initialRTTNumber" placeholder="Durée"
|
||||||
|
oninput="initialRTTHidden.value = initialRTTNumber.value? initialRTTNumber.value+initialRTTUnit.value: ''; maxRTTHidden.initial=initialRTTHidden.value"
|
||||||
|
<?= preg_match("/^\d+/", $options["--initial-rtt-timeout"] ?? "", $matches) ? "value='{$matches[0]}'" : "" ?>>
|
||||||
|
<select id="initialRTTUnit" class="ui clearable dropdown label"
|
||||||
|
oninput="initialRTTHidden.value = initialRTTNumber.value? initialRTTNumber.value+initialRTTUnit.value: ''">
|
||||||
|
<option value="">ms</option>
|
||||||
|
<option value="s" <?=substr($options["--initial-rtt-timeout"]??"", -1)=="s"?"selected":"" ?>>secondes</option>
|
||||||
|
<option value="m" <?=substr($options["--initial-rtt-timeout"]??"", -1)=="m"?"selected":"" ?>>minutes</option>
|
||||||
|
<option value="h" <?=substr($options["--initial-rtt-timeout"]??"", -1)=="h"?"selected":"" ?>>heures</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<input id="initialRTTHidden" type="hidden" name="--initial-rtt-timeout"
|
||||||
|
value="<?= $options["--initial-rtt-timeout"] ?? "" ?>">
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label for="minRTTNumber" title="--min-rtt-timeout">Minimum</label>
|
||||||
|
<div class="ui right labeled input">
|
||||||
|
<input type="number" min="0" id="minRTTNumber" placeholder="Durée"
|
||||||
|
oninput="minRTTHidden.value = minRTTNumber.value? minRTTNumber.value+minRTTUnit.value: ''; maxRTTHidden.min=minRTTHidden.value"
|
||||||
|
<?= preg_match("/^\d+/", $options["--min-rtt-timeout"] ?? "", $matches) ? "value='{$matches[0]}'" : "" ?>>
|
||||||
|
<select id="minRTTUnit" class="ui clearable dropdown label"
|
||||||
|
oninput="minRTTHidden.value = minRTTNumber.value? minRTTNumber.value+minRTTUnit.value: ''">
|
||||||
|
<option value="">ms</option>
|
||||||
|
<option value="s" <?=substr($options["--min-rtt-timeout"]??"", -1)=="s"?"selected":"" ?>>secondes</option>
|
||||||
|
<option value="m" <?=substr($options["--min-rtt-timeout"]??"", -1)=="m"?"selected":"" ?>>minutes</option>
|
||||||
|
<option value="h" <?=substr($options["--min-rtt-timeout"]??"", -1)=="h"?"selected":"" ?>>heures</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<input id="minRTTHidden" type="hidden" name="--min-rtt-timeout"
|
||||||
|
value="<?= $options["--min-rtt-timeout"] ?? "" ?>">
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label for="maxRTTNumber" title="--max-rtt-timeout">Maximum</label>
|
||||||
|
<div class="ui right labeled input">
|
||||||
|
<input type="number" min="0" id="maxRTTNumber" placeholder="Durée"
|
||||||
|
oninput="maxRTTHidden.value = maxRTTNumber.value? maxRTTNumber.value+maxRTTUnit.value: ''; minRTTHidden.max=maxRTTHidden.value"
|
||||||
|
<?= preg_match("/^\d+/", $options["--max-rtt-timeout"] ?? "", $matches) ? "value='{$matches[0]}'" : "" ?>>
|
||||||
|
<select id="maxRTTUnit" class="ui clearable dropdown label"
|
||||||
|
oninput="maxRTTHidden.value = maxRTTNumber.value? maxRTTNumber.value+maxRTTUnit.value: ''">
|
||||||
|
<option value="">ms</option>
|
||||||
|
<option value="s" <?=substr($options["--max-rtt-timeout"]??"", -1)=="s"?"selected":"" ?>>secondes</option>
|
||||||
|
<option value="m" <?=substr($options["--max-rtt-timeout"]??"", -1)=="m"?"selected":"" ?>>minutes</option>
|
||||||
|
<option value="h" <?=substr($options["--max-rtt-timeout"]??"", -1)=="h"?"selected":"" ?>>heures</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<input id="maxRTTHidden" type="hidden" name="--max-rtt-timeout"
|
||||||
|
value="<?= $options["--max-rtt-timeout"] ?? "" ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label for="maxRetriesInput" title="--max-retries">Nombre de retransmissions des paquets de tests des scans de ports</label>
|
||||||
|
<input type="number" min="0" id="maxRetriesInput" name="--max-retries" placeholder="Nombre"
|
||||||
|
value="<?= $options["--max-retries"] ?? "" ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label for="hostTimoutInput" title="--host-timeout">Délai d'expiration du scan d'un hôte trop lent</label>
|
||||||
|
<div class="ui right labeled input">
|
||||||
|
<input type="number" min="0" id="hostTimoutNumber" placeholder="Durée"
|
||||||
|
oninput="hostTimoutHidden.value = hostTimoutNumber.value? hostTimoutNumber.value+hostTimoutUnit.value: ''"
|
||||||
|
<?= preg_match("/^\d+/", $options["--host-timeout"] ?? "", $matches) ? "value='{$matches[0]}'" : "" ?>>
|
||||||
|
<select id="hostTimoutUnit" class="ui clearable dropdown label"
|
||||||
|
oninput="hostTimoutHidden.value = hostTimoutNumber.value? hostTimoutNumber.value+hostTimoutUnit.value: ''">
|
||||||
|
<option value="">ms</option>
|
||||||
|
<option value="s" <?=substr($options["--host-timeout"]??"", -1)=="s"?"selected":"" ?>>secondes</option>
|
||||||
|
<option value="m" <?=substr($options["--host-timeout"]??"", -1)=="m"?"selected":"" ?>>minutes</option>
|
||||||
|
<option value="h" <?=substr($options["--host-timeout"]??"", -1)=="h"?"selected":"" ?>>heures</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<input id="hostTimoutHidden" type="hidden" name="--host-timeout"
|
||||||
|
value="<?= $options["--host-timeout"] ?? "" ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="two fields">
|
||||||
|
<div class="field">
|
||||||
|
<label for="scanDelayNumber" title="--scan-delay">Délai entre les paquets de tests</label>
|
||||||
|
<div class="ui right labeled input">
|
||||||
|
<input type="number" min="0" id="scanDelayNumber" placeholder="Durée"
|
||||||
|
oninput="scanDelayHidden.value = scanDelayNumber.value? scanDelayNumber.value+scanDelayUnit.value: ''"
|
||||||
|
<?= preg_match("/^\d+/", $options["--scan-delay"] ?? "", $matches) ? "value='{$matches[0]}'" : "" ?>>
|
||||||
|
<select id="scanDelayUnit" class="ui clearable dropdown label"
|
||||||
|
oninput="scanDelayHidden.value = scanDelayNumber.value? scanDelayNumber.value+scanDelayUnit.value: ''">
|
||||||
|
<option value="">ms</option>
|
||||||
|
<option value="s" <?=substr($options["--scan-delay"]??"", -1)=="s"?"selected":"" ?>>secondes</option>
|
||||||
|
<option value="m" <?=substr($options["--scan-delay"]??"", -1)=="m"?"selected":"" ?>>minutes</option>
|
||||||
|
<option value="h" <?=substr($options["--scan-delay"]??"", -1)=="h"?"selected":"" ?>>heures</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<input id="scanDelayHidden" type="hidden" name="--scan-delay"
|
||||||
|
value="<?= $options["--scan-delay"] ?? "" ?>">
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label for="maxScanDelay" title="--max-scan-delay">Maximum</label>
|
||||||
|
<div class="ui right labeled input">
|
||||||
|
<input type="number" min="0" id="maxScanDelay" placeholder="Durée"
|
||||||
|
oninput="maxRTTHidden.value = maxScanDelay.value? maxScanDelay.value+maxRTTUnit.value: ''"
|
||||||
|
<?= preg_match("/^\d+/", $options["--max-scan-delay"] ?? "", $matches) ? "value='{$matches[0]}'" : "" ?>>
|
||||||
|
<select id="maxRTTUnit" class="ui clearable dropdown label"
|
||||||
|
oninput="maxRTTHidden.value = maxScanDelay.value? maxScanDelay.value+maxRTTUnit.value: ''">
|
||||||
|
<option value="">ms</option>
|
||||||
|
<option value="s" <?=substr($options["--max-scan-delay"]??"", -1)=="s"?"selected":"" ?>>secondes</option>
|
||||||
|
<option value="m" <?=substr($options["--max-scan-delay"]??"", -1)=="m"?"selected":"" ?>>minutes</option>
|
||||||
|
<option value="h" <?=substr($options["--max-scan-delay"]??"", -1)=="h"?"selected":"" ?>>heures</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<input id="maxRTTHidden" type="hidden" name="--max-scan-delay"
|
||||||
|
value="<?= $options["--max-scan-delay"] ?? "" ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="inline field">
|
||||||
|
<div class="ui toggle checkbox">
|
||||||
|
<input id="defeatRSTRateLimitCheckbox" type="checkbox" name="--defeat-rst-ratelimit" <?= $options['--defeat-rst-ratelimit'] ?? false ? 'checked' : ''; ?> />
|
||||||
|
<label for="defeatRSTRateLimitCheckbox" title="--defeat-rst-ratelimit">Ignorer les limitations de paquets RST</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="ui teal submit button">Démarrer</button>
|
||||||
|
</form>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<datalist id='targetsList'>
|
||||||
|
<option value="<?= $_SERVER['REMOTE_ADDR']; ?>/24"></option>
|
||||||
|
<option value="<?= $_SERVER['SERVER_NAME']; ?>"></option>
|
||||||
|
<?php
|
||||||
|
if (file_exists($SCANSDIR)) {
|
||||||
|
foreach (scandir($SCANSDIR) as $filename) {
|
||||||
|
if (substr($filename, -4) === '.xml') {
|
||||||
|
$name = substr($filename, 0, -4);
|
||||||
|
$name = str_replace("!", "/", $name);
|
||||||
|
echo " <option value='$name'>$name</option>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</datalist>
|
||||||
|
|
||||||
|
<datalist id='servicesList'>
|
||||||
|
<?php
|
||||||
|
$services = [];
|
||||||
|
foreach ([$DATADIR, $NMAPDIR] as $dir) {
|
||||||
|
echo "<!-- $nmap_services -->\n";
|
||||||
|
if (file_exists("$dir/nmap-services")) {
|
||||||
|
$nmap_services = file("$dir/nmap-services");
|
||||||
|
foreach ($nmap_services as $service) {
|
||||||
|
if (0 !== strpos($service, '#')) {
|
||||||
|
[$name, $port] = explode("\t", $service);
|
||||||
|
$services[$name] = explode("/", $port);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($services as $name => [$portid, $protocol]) {
|
||||||
|
echo " <option value='$name'></option>\n";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</datalist>
|
||||||
|
|
||||||
|
<datalist id="flagsList">
|
||||||
|
<option value="URG"></option>
|
||||||
|
<option value="ACK"></option>
|
||||||
|
<option value="PSH"></option>
|
||||||
|
<option value="RST"></option>
|
||||||
|
<option value="SYN"></option>
|
||||||
|
<option value="FIN"></option>
|
||||||
|
</datalist>
|
||||||
|
|
||||||
|
<datalist id="scripts">
|
||||||
|
<!-- categories -->
|
||||||
|
<option value="auth"></option>
|
||||||
|
<option value="broadcast"></option>
|
||||||
|
<option value="brute"></option>
|
||||||
|
<option value="default"></option>
|
||||||
|
<option value="ddiscovery"></option>
|
||||||
|
<option value="dos"></option>
|
||||||
|
<option value="exploit"></option>
|
||||||
|
<option value="external"></option>
|
||||||
|
<option value="fuzzer"></option>
|
||||||
|
<option value="intrusive"></option>
|
||||||
|
<option value="malware"></option>
|
||||||
|
<option value="safe"></option>
|
||||||
|
<option value="version"></option>
|
||||||
|
<option value="vuln"></option>
|
||||||
|
<!-- names -->
|
||||||
|
<?php
|
||||||
|
foreach ([$DATADIR, $NMAPDIR] as $dir) {
|
||||||
|
foreach (scandir("$dir/scripts") as $filename) {
|
||||||
|
if (substr($filename, -4) === '.nse') {
|
||||||
|
$name = substr($filename, 0, -4);
|
||||||
|
echo " <option value='$name'></option>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</datalist>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
class TagsInput extends Tagify {
|
||||||
|
constructor(input, options={}, delim = ",") {
|
||||||
|
if (!options.delimiters) options.delimiters = " |,"
|
||||||
|
if (!options.originalInputValueFormat) options.originalInputValueFormat = tags => tags.map(tag => tag.value).join(delim)
|
||||||
|
if (input.list) options.whitelist = Array.from(input.list.options).map(option => option.value)
|
||||||
|
super(input, options)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$(".ui.accordion").accordion()
|
||||||
|
|
||||||
|
$(".ui.clearable.dropdown").dropdown({
|
||||||
|
clearable: true
|
||||||
|
})
|
||||||
|
$(".ui:not(.clearable).dropdown").dropdown({
|
||||||
|
clearable: false
|
||||||
|
})
|
||||||
|
|
||||||
|
new TagsInput(targetsInput, {}, " ")
|
||||||
|
new TagsInput(excludeInput)
|
||||||
|
new TagsInput(PSInput)
|
||||||
|
new TagsInput(PAInput)
|
||||||
|
new TagsInput(PUInput)
|
||||||
|
new TagsInput(POInput)
|
||||||
|
var pTagsInput = new TagsInput(pInput)
|
||||||
|
FCheckbox.onchange = () => {
|
||||||
|
pInput.disabled = FCheckbox.checked
|
||||||
|
pTagsInput.setDisabled(FCheckbox.checked)
|
||||||
|
}
|
||||||
|
new TagsInput(dnsServersInput)
|
||||||
|
new TagsInput(scanflagsInput)
|
||||||
|
new TagsInput(scriptInput, {enforceWhitelist: true})
|
||||||
|
new TagsInput(scriptArgsInput, {delimiters: ','})
|
||||||
|
|
||||||
|
newScanForm.onsubmit = function(event) {
|
||||||
|
if (this.checkValidity()) {
|
||||||
|
newScanForm.classList.add("loading")
|
||||||
|
$.toast({
|
||||||
|
title : 'Scan en cours...',
|
||||||
|
message : 'Merci de patienter',
|
||||||
|
class : 'info',
|
||||||
|
showIcon : 'satellite dish',
|
||||||
|
displayTime: 0,
|
||||||
|
closeIcon : true,
|
||||||
|
position : 'bottom right',
|
||||||
|
})
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
event.preventDefault()
|
||||||
|
this.reportValidity()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
164
scan.php
164
scan.php
@ -2,9 +2,11 @@
|
|||||||
|
|
||||||
include_once 'config.php';
|
include_once 'config.php';
|
||||||
|
|
||||||
$lan = filter_input(INPUT_GET, 'lan', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '/^[\da-zA-Z-. \/]+$/'], "flags" => FILTER_NULL_ON_FAILURE]);
|
$targetsListRegex = '/^[\da-zA-Z-. \/]+$/';
|
||||||
|
|
||||||
|
$lan = filter_input(INPUT_GET, 'lan', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $targetsListRegex], "flags" => FILTER_NULL_ON_FAILURE]);
|
||||||
if ($lan) {
|
if ($lan) {
|
||||||
$cmd = "$lanScanCmd $lan";
|
$cmd = "$NMAP $LANSCANOPTIONS $lan";
|
||||||
|
|
||||||
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
|
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
|
||||||
$filename = str_replace("/", "!", $lan);
|
$filename = str_replace("/", "!", $lan);
|
||||||
@ -18,9 +20,9 @@ if ($lan) {
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$host = filter_input(INPUT_GET, 'host', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '/^[\da-zA-Z-. \/]+$/'], "flags" => FILTER_NULL_ON_FAILURE]);
|
$host = filter_input(INPUT_GET, 'host', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $targetsListRegex], "flags" => FILTER_NULL_ON_FAILURE]);
|
||||||
if ($host) {
|
if ($host) {
|
||||||
$cmd = "$hostScanCmd $host";
|
$cmd = "$NMAP $HOSTSCANOPTIONS $host";
|
||||||
|
|
||||||
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
|
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
|
||||||
$filename = str_replace("/", "!", $host);
|
$filename = str_replace("/", "!", $host);
|
||||||
@ -34,4 +36,156 @@ if ($host) {
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
include "index.php";
|
$targets = filter_input(INPUT_GET, 'targets', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $targetsListRegex], "flags" => FILTER_NULL_ON_FAILURE]);
|
||||||
|
if ($targets) {
|
||||||
|
$hostsListRegex = '/^[\da-zA-Z-.,:\/]+$/';
|
||||||
|
$protocolePortsListRegex = '/^(([TU]:)?[0-9\-]+|[a-z\-]+)(,([TU]:)?[0-9\-]+|,[a-z\-]+)*$/';
|
||||||
|
$portsListRegex = '/^([0-9\-]+|[a-z\-]+)(,[0-9\-]+|,[a-z\-]+)*$/';
|
||||||
|
$tempoRegex = '/^\d+[smh]?$/';
|
||||||
|
$fileNameRegex = '/^[^<>:\/|?]+$/';
|
||||||
|
|
||||||
|
$inputs = filter_input_array(INPUT_GET, [
|
||||||
|
// TARGET SPECIFICATION:
|
||||||
|
'-iR' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
|
||||||
|
'--exclude' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $hostsListRegex]],
|
||||||
|
// HOST DISCOVERY:
|
||||||
|
'-sL' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $hostsListRegex]],
|
||||||
|
'-sP' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'-P0' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'-Pn' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'-PS' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $portsListRegex]],
|
||||||
|
'-PA' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $portsListRegex]],
|
||||||
|
'-PU' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $portsListRegex]],
|
||||||
|
'-PE' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'-PP' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'-PM' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'-PO' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0, 'max_range' => 255]],
|
||||||
|
'-PR' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'--send-ip' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'-n' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'-R' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'--dns-servers' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $hostsListRegex]],
|
||||||
|
// SCAN TECHNIQUES:
|
||||||
|
'-sS' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'-sT' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'-sA' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'-sW' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'-sM' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'-sF' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'-sN' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'-sX' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'-sU' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'--scanflags' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => '/^(URG|ACK|PSH|RST|SYN|FIN|,)+|[1-9]?[0-9]|[1-2][0-9][0-9]$/']],
|
||||||
|
'-sI' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => '/^[a-zA-Z\d:.-]+(:\d+)?$/']],
|
||||||
|
'-sO' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'-b' => FILTER_VALIDATE_URL,
|
||||||
|
'--traceroute' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'--reason' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
// PORT SPECIFICATION AND SCAN ORDER:
|
||||||
|
'-p' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $portsListRegex]],
|
||||||
|
'-F' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'-r' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'--top-ports' => FILTER_VALIDATE_INT,
|
||||||
|
'--port-ratio' => ['filter' => FILTER_VALIDATE_FLOAT, 'options' => ['min_range' => 0, 'max_range' => 1]],
|
||||||
|
// SERVICE/VERSION DETECTION:
|
||||||
|
'-sV' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'--version-light' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'--version-intensity' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0, 'max_range' => 9]],
|
||||||
|
'--version-all' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'--version-trace' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
// SCRIPT SCAN:
|
||||||
|
'-sC' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'--script' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => '/^[a-z][a-z0-9,\-\.\/]*$/']],
|
||||||
|
'--script-args' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => '/^([a-zA-Z][a-zA-Z0-9\-_]*=[^"]+(,[a-zA-Z][a-zA-Z0-9\-_]*=[^"]+)?)$/']],
|
||||||
|
// OS DETECTION:
|
||||||
|
'-O' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'--osscan-limit' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'--osscan-guess' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'--max-os-tries' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
|
||||||
|
// TIMING AND PERFORMANCE:
|
||||||
|
'-T' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0, 'max_range' => 5]],
|
||||||
|
'--min-hostgroup' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
|
||||||
|
'--max-hostgroup' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
|
||||||
|
'--min-parallelism' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
|
||||||
|
'--max-parallelism' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
|
||||||
|
'--min-rtt-timeout' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $tempoRegex]],
|
||||||
|
'--max-rtt-timeout' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $tempoRegex]],
|
||||||
|
'--initial-rtt-timeout' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $tempoRegex]],
|
||||||
|
'--max-retries' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
|
||||||
|
'--host-timeout' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $tempoRegex]],
|
||||||
|
'--scan-delay' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $tempoRegex]],
|
||||||
|
'--max-scan-delay' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $tempoRegex]],
|
||||||
|
// FIREWALL/IDS EVASION AND SPOOFING:
|
||||||
|
'-f' => FILTER_VALIDATE_INT,
|
||||||
|
'--mtu' => FILTER_VALIDATE_INT,
|
||||||
|
'-D' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $hostsListRegex]],
|
||||||
|
'-S' => ['filter' => FILTER_VALIDATE_IP],
|
||||||
|
'-e' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => '/^[a-z\d]+$/']],
|
||||||
|
'-g' => FILTER_VALIDATE_INT,
|
||||||
|
'--source-port' => FILTER_VALIDATE_INT,
|
||||||
|
'--data-length' => FILTER_VALIDATE_INT,
|
||||||
|
'--ip-options' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => '/^\"(R|T|U|L [\da-zA-Z-.: ]+|S [\da-zA-Z-.: ]+|\\\\x[\da-fA-F]{1,2}(\*[\d]+)?|\\\\[0-2]?[\d]{1,2}(\*[\d]+)?)\"$/']],
|
||||||
|
'--ttl' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0, 'max_range' => 255]],
|
||||||
|
'--spoof-mac' => FILTER_VALIDATE_MAC,
|
||||||
|
'--badsum' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
// MISC:
|
||||||
|
// '6' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'-A' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'--send-eth' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'--privileged' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'-V' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'--unprivileged' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'-h' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
'--stylesheet' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $fileNameRegex]],
|
||||||
|
// lanScan
|
||||||
|
'name' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $fileNameRegex]],
|
||||||
|
'originalURL' => FILTER_VALIDATE_URL,
|
||||||
|
'refreshPeriod' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
|
||||||
|
'sudo' => FILTER_VALIDATE_BOOLEAN,
|
||||||
|
], false);
|
||||||
|
|
||||||
|
echo "<!--";
|
||||||
|
var_dump($inputs);
|
||||||
|
echo "-->\n";
|
||||||
|
|
||||||
|
$inputs["--datadir"] = $DATADIR;
|
||||||
|
$inputs["--script-args-file"] = $SCRIPTARGSFILE;
|
||||||
|
$inputs["-oX"] = "-";
|
||||||
|
$inputs["--stylesheet"] = "$BASEDIR/$STYLESHEETSDIR/lanScan.xsl#";
|
||||||
|
|
||||||
|
$options = "";
|
||||||
|
foreach ($inputs as $option => $value) {
|
||||||
|
if (substr($option, 0, 1) == '-') {
|
||||||
|
if (is_null($value)) {
|
||||||
|
http_response_code(400);
|
||||||
|
$errorMessage = "Valeur incorrecte pour le paramètre <var>$option</var> : " . filter_input(INPUT_GET, $option, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
|
||||||
|
include_once "index.php";
|
||||||
|
die();
|
||||||
|
} else if ($value) {
|
||||||
|
if ($value === true) {
|
||||||
|
$options .= " $option";
|
||||||
|
} else {
|
||||||
|
if (substr($option, 0, 2) == '--') $options .= " $option " . escapeshellarg($value);
|
||||||
|
else $options .= " $option" . escapeshellarg($value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$cmd = "$NMAP$options $targets";
|
||||||
|
echo "<!--$cmd-->\n";
|
||||||
|
|
||||||
|
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
|
||||||
|
$filename = str_replace("/", "!", $targets);
|
||||||
|
$path = "$SCANSDIR/$filename.xml";
|
||||||
|
|
||||||
|
if (!file_exists($path)) $cmd .= " | tee '$path'";
|
||||||
|
|
||||||
|
header('Content-type: text/xml');
|
||||||
|
system("$cmd", $retcode);
|
||||||
|
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
include_once "index.php";
|
||||||
|
die();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user