From 9087efcffda66b56737c8a1be08195b72a1ae7c7 Mon Sep 17 00:00:00 2001 From: fra-2107 Date: Mon, 25 Nov 2024 19:45:35 -0500 Subject: [PATCH] arborescence clean --- {web2 => web}/css/styles.css | 0 {web2 => web}/index.html | 0 {web2 => web}/js/ajax.js | 0 {web2 => web}/js/alerts.js | 0 {web2 => web}/php/constants.php | 0 {web2 => web}/php/database.php | 0 {web2 => web}/php/request.php | 0 web1/class/Alerts.class.php | 212 ------------------------------ web1/class/Database.class.php | 226 -------------------------------- web1/css/styles.css | 13 -- web1/css/styles2.css | 19 --- web1/index.php | 184 -------------------------- web1/tmp.html | 39 ------ 13 files changed, 693 deletions(-) rename {web2 => web}/css/styles.css (100%) rename {web2 => web}/index.html (100%) rename {web2 => web}/js/ajax.js (100%) rename {web2 => web}/js/alerts.js (100%) rename {web2 => web}/php/constants.php (100%) rename {web2 => web}/php/database.php (100%) rename {web2 => web}/php/request.php (100%) delete mode 100644 web1/class/Alerts.class.php delete mode 100644 web1/class/Database.class.php delete mode 100644 web1/css/styles.css delete mode 100644 web1/css/styles2.css delete mode 100644 web1/index.php delete mode 100644 web1/tmp.html diff --git a/web2/css/styles.css b/web/css/styles.css similarity index 100% rename from web2/css/styles.css rename to web/css/styles.css diff --git a/web2/index.html b/web/index.html similarity index 100% rename from web2/index.html rename to web/index.html diff --git a/web2/js/ajax.js b/web/js/ajax.js similarity index 100% rename from web2/js/ajax.js rename to web/js/ajax.js diff --git a/web2/js/alerts.js b/web/js/alerts.js similarity index 100% rename from web2/js/alerts.js rename to web/js/alerts.js diff --git a/web2/php/constants.php b/web/php/constants.php similarity index 100% rename from web2/php/constants.php rename to web/php/constants.php diff --git a/web2/php/database.php b/web/php/database.php similarity index 100% rename from web2/php/database.php rename to web/php/database.php diff --git a/web2/php/request.php b/web/php/request.php similarity index 100% rename from web2/php/request.php rename to web/php/request.php diff --git a/web1/class/Alerts.class.php b/web1/class/Alerts.class.php deleted file mode 100644 index b57b9aa..0000000 --- a/web1/class/Alerts.class.php +++ /dev/null @@ -1,212 +0,0 @@ -id; - } - - public function setId($id) - { - $this->id = $id; - } - - // Getter et Setter pour cef_version - public function getCefVersion() - { - return $this->cef_version; - } - - public function setCefVersion($cef_version) - { - $this->cef_version = $cef_version; - } - - // Getter et Setter pour date_alerte - public function getDateAlerte() - { - return $this->date_alerte; - } - - public function setDateAlerte($date_alerte) - { - $this->date_alerte = $date_alerte; - } - - // Getter et Setter pour event_gravite - public function getEventGravite() - { - return $this->event_gravite; - } - - public function setEventGravite($event_gravite) - { - $this->event_gravite = $event_gravite; - } - - // Getter et Setter pour device_product - public function getDeviceProduct() - { - return $this->device_product; - } - - public function setDeviceProduct($device_product) - { - $this->device_product = $device_product; - } - - // Getter et Setter pour device_vendor - public function getDeviceVendor() - { - return $this->device_vendor; - } - - public function setDeviceVendor($device_vendor) - { - $this->device_vendor = $device_vendor; - } - - // Getter et Setter pour device_version - public function getDeviceVersion() - { - return $this->device_version; - } - - public function setDeviceVersion($device_version) - { - $this->device_version = $device_version; - } - - // Getter et Setter pour alerte_name - public function getAlerteName() - { - return $this->alerte_name; - } - - public function setAlerteName($alerte_name) - { - $this->alerte_name = $alerte_name; - } - - // Getter et Setter pour destinationAddress - public function getDestinationAddress() - { - return $this->destinationAddress; - } - - public function setDestinationAddress($destinationAddress) - { - $this->destinationAddress = $destinationAddress; - } - - // Getter et Setter pour sourceAddress - public function getSourceAddress() - { - return $this->sourceAddress; - } - - public function setSourceAddress($sourceAddress) - { - $this->sourceAddress = $sourceAddress; - } - - // Getter et Setter pour destinationPort - public function getDestinationPort() - { - return $this->destinationPort; - } - - public function setDestinationPort($destinationPort) - { - $this->destinationPort = $destinationPort; - } - - // Getter et Setter pour sourcePort - public function getSourcePort() - { - return $this->sourcePort; - } - - public function setSourcePort($sourcePort) - { - $this->sourcePort = $sourcePort; - } - - // Getter et Setter pour protocol - public function getProtocol() - { - return $this->protocol; - } - - public function setProtocol($protocol) - { - $this->protocol = $protocol; - } - - // Getter et Setter pour applicationProtocol - public function getApplicationProtocol() - { - return $this->applicationProtocol; - } - - public function setApplicationProtocol($applicationProtocol) - { - $this->applicationProtocol = $applicationProtocol; - } - - // Getter et Setter pour reason - public function getReason() - { - return $this->reason; - } - - public function setReason($reason) - { - $this->reason = $reason; - } - - // Getter et Setter pour action - public function getAction() - { - return $this->action; - } - - public function setAction($action) - { - $this->action = $action; - } - - // Getter et Setter pour commentaire - public function getCommentaire() - { - return $this->commentaire; - } - - public function setCommentaire($commentaire) - { - $this->commentaire = $commentaire; - } -} - -?> diff --git a/web1/class/Database.class.php b/web1/class/Database.class.php deleted file mode 100644 index 2156cdd..0000000 --- a/web1/class/Database.class.php +++ /dev/null @@ -1,226 +0,0 @@ -db_name = $db_name; - $this->db_user = $db_user; - $this->db_pass = $db_pass; - $this->db_host = $db_host; - } - - private function getPDO() - { - if ($this->pdo === null) { - $pdo = new PDO('mysql:dbname=' . $this->db_name . ';host=localhost;charset=UTF8', $this->db_user, $this->db_pass); - $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $this->pdo = $pdo; - } - return $this->pdo; - } - - public function query($stmt, $class_name) - { - $req = $this->getPDO()->query($stmt); - return $req->fetchAll(PDO::FETCH_CLASS, $class_name); - } - - - // TOCHANGE - public function getnbAlerts() - { - $sql = 'SELECT COUNT(*) AS nb_alerts FROM alertes'; - - $sth = $this->getPDO()->prepare($sql); - $sth->execute(); - $result = $sth->fetch(); - - $nbAlerts = (int) $result['nb_alerts']; - return $nbAlerts; - } - - // TODO - public function getAlerts($filters = null, $limit = 10) - { - $whereArgs = []; - - if (isset($_GET["page"])) { - $page = intval($_GET['page']); - } else { - $page = 1; - } - - $decalage = ($page - 1) * $limit; - - $sql = 'SELECT * - FROM alertes '; - - if ($filters != null) { - foreach ($filters as $key => $value) { - if ($value != '') $whereArgs[] = $key . ' = :' . $key; - } - } - if (!empty($whereArgs)) $sql .= 'WHERE ' . implode(' AND ', $whereArgs); - - $sql .= ' LIMIT :limit OFFSET :offset'; - $sth = $this->getPDO()->prepare($sql); - - // TODO : edit filters - if ($filters != null) { - if ($filters['event_gravite'] != '') $sth->bindParam('event_gravite', $filters['event_gravite']); - if ($filters['device_product'] != '') $sth->bindParam('device_product', $filters['device_product']); - // if ($filters['zone'] != '') $sth->bindParam('zone', $filters['zone']); - } - $sth->bindParam(':limit', $limit, PDO::PARAM_INT); - $sth->bindParam(':offset', $decalage, PDO::PARAM_INT); - $sth->execute(); - - return $sth->fetchAll(PDO::FETCH_CLASS, 'Alerts'); - } - - public function getAlertUnique($filters = null) - { - $whereArgs = []; - $sql = 'SELECT * - FROM alertes '; - - if ($filters != null) { - foreach ($filters as $key => $value) { - if ($value != '') $whereArgs[] = $key . ' = :' . $key; - } - } - if (!empty($whereArgs)) $sql .= 'WHERE ' . implode(' AND ', $whereArgs); - - $sth = $this->getPDO()->prepare($sql); - - if ($filters != null) { - if ($filters['id'] != '') $sth->bindParam('id', $filters['id']); - } - $sth->execute(); - - return $sth->fetchAll(PDO::FETCH_CLASS, 'Alerts'); - } - - public function getDevices() - { - $sql = 'SELECT device_product - FROM alertes - GROUP BY device_product'; - - $sth = $this->getPDO()->prepare($sql, [PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY]); - $sth->execute(); - return $sth->fetchAll(PDO::FETCH_CLASS, 'Alerts'); - } - - - public function getnbbygravite($filters = null) - { - $i=0; - $tmp=0; - $maxrg=0; - $whereArgs = []; - if ($filters != null) { - foreach ($filters as $key) { - $whereArgs[] = $key; - } - $sql = 'SELECT gravite, COUNT(*) as nbbygravite FROM alertes where date>='. implode(' AND ', $whereArgs).' GROUP BY gravite'; - }else { - $sql = 'SELECT gravite, COUNT(*) as nbbygravite FROM alertes GROUP BY gravite'; - - } - - - $sth = $this->getPDO()->prepare($sql); - $sth->execute(); - $result = $sth->fetchAll(PDO::FETCH_CLASS, 'Alerts'); - while($i<38) - { - if((int)($result[$i]->nbbyespece)>$tmp) - { - $tmp=(int)($result[$i]->nbbyespece); - $maxrg=$i; - } - $i++; - } - return $result[$maxrg]->espece; - } - - // TODO : remplacer par ce qui est demandé - // public function getnbbyzone($filters = null) - // { - // $i=0; - // $tmp=0; - // $maxrg=0; - // $whereArgs = []; - // if ($filters != null) { - // foreach ($filters as $key) { - // $whereArgs[] = $key; - // } - // $sql = 'SELECT zone, COUNT(*) as nbbyzone FROM echouage where date>='. implode(' AND ', $whereArgs).' GROUP BY zone'; - // }else { - // $sql = 'SELECT espece, COUNT(*) as nbbyespece FROM echouage GROUP BY espece'; - // } - - - - // $sth = $this->getPDO()->prepare($sql); - // $sth->execute(); - // $result = $sth->fetchAll(PDO::FETCH_CLASS, 'Echouage'); - // while($i<2) - // { - // if((int)($result[$i]->nbbyzone)>$tmp) - // { - // $tmp=(int)($result[$i]->nbbyzone); - // $maxrg=$i; - // } - // $i++; - // } - // return $result[$maxrg]->zone; - // } - - // public function getZonesEchouage() - // { - // $sql = 'SELECT zone - // FROM echouage - // GROUP BY zone'; - - // $sth = $this->getPDO()->prepare($sql, [PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY]); - // $sth->execute(); - // return $sth->fetchAll(PDO::FETCH_CLASS, 'Echouage'); - // } - - - public function editEchouage($id, $newCet) - { - $sql = "UPDATE echouage - SET date=".$newCet['date'].", espece='".$newCet['espece']."', zone='".$newCet['zone']."', nombre=".$newCet['nb'] - ." WHERE id=".$id; - - $sth = $this->getPDO()->prepare($sql); - $sth->execute(); - } - - // TODO : ajouter commentaires - // public function addComm($newCet) - // { - // $sql = "INSERT INTO echouage (date, espece, zone, nombre) - // VALUES (".$newCet['date'].", '".$newCet['espece']."', '".$newCet['zone']."', ".$newCet['nb'].")"; - - // $sth = $this->getPDO()->prepare($sql); - // $sth->execute(); - // } - - public function deleteAlerts($id) - { - // $sql = "DELETE from echouage WHERE id=".$id; - // $sth = $this->getPDO()->prepare($sql); - // $sth->execute(); - } -} diff --git a/web1/css/styles.css b/web1/css/styles.css deleted file mode 100644 index 0d7caf7..0000000 --- a/web1/css/styles.css +++ /dev/null @@ -1,13 +0,0 @@ -html { - scroll-padding-top: 3.5rem; -} - -header { - padding-top: 9rem; - padding-bottom: 6rem; -} - -section { - padding-top: 9rem; - padding-bottom: 9rem; -} diff --git a/web1/css/styles2.css b/web1/css/styles2.css deleted file mode 100644 index ea9a784..0000000 --- a/web1/css/styles2.css +++ /dev/null @@ -1,19 +0,0 @@ -html { - scroll-padding-top: 3.5rem; -} - -header { - padding-top: 5rem; - padding-bottom: 3rem; -} - -section { - padding-top: 9rem; - padding-bottom: 9rem; -} - -figcaption{ - font-weight: lighter; - font-size: small; - font-style: italic; -} diff --git a/web1/index.php b/web1/index.php deleted file mode 100644 index f4e5e9f..0000000 --- a/web1/index.php +++ /dev/null @@ -1,184 +0,0 @@ - - - - - - - - - - IDPS visualization - - - - - - - - -
-
-

Alertes systemes

-

meilleur outil de surveillance du monde

- Alertes -
-
- -
-
-
-
-

Liste des Attaques

-

veuillez selectionner les filtres de recherche ou parcourez la liste ci-dessous

- - -
- -
- -
- -
- -
- - -
- -
-
- - - - - - - - - - - - - - - - - getAlerts($_POST, 20); - foreach ($alerts as $alert) : ?> - - - - - - - - - - - - - - -
DateNom alerteAppareil de détectionAdresse sourceNiveau d'alerte
getId(); ?>getDateAlerte(); ?>getAlerteName(); ?>getDeviceProduct(); ?>getSourceAddress(); ?>getEventGravite(); ?> - - - - - - - - -
- - - - - -
-
-
-
- - - - - - - - - - \ No newline at end of file diff --git a/web1/tmp.html b/web1/tmp.html deleted file mode 100644 index 25d9007..0000000 --- a/web1/tmp.html +++ /dev/null @@ -1,39 +0,0 @@ - -
- -
- -
- -
- -
- - - -
- -
-
\ No newline at end of file