From 37789194d6b4bc37a964ad20d994771a2b0c4044 Mon Sep 17 00:00:00 2001 From: darcosion <16328515+darcosion@users.noreply.github.com> Date: Thu, 22 Aug 2024 23:47:57 +0200 Subject: [PATCH] Revert "Dev darcosion" --- echosounder.py | 4 ++-- static/main.js | 30 +++++++++++++++++++++++++++++- webchosounder.py | 2 +- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/echosounder.py b/echosounder.py index 21633ac..ae76f55 100755 --- a/echosounder.py +++ b/echosounder.py @@ -447,11 +447,11 @@ def traceroute_scan(target='142.250.75.238') -> List[dict]: break return list_return_ip -def scan_dhcp_discover(): +def scan_dhcp_discover(target_cidr): nm = nmap.PortScanner() # instantiate nmap.PortScanner object result = [] try: - nm.scan(target_cidr, arguments=" --script broadcast-dhcp-discover") + nm.scan(target_cidr, arguments="-F --script broadcast-dhcp-discover") for i in nm.all_hosts(): if('addresses' in nm[i].keys()): result.append(nm[i]['addresses']) diff --git a/static/main.js b/static/main.js index 9403a44..f26b89d 100644 --- a/static/main.js +++ b/static/main.js @@ -118,6 +118,7 @@ EchoApp.controller("ParentCtrl", function($scope, $http) { function(response) { $scope.sendToastData('Echosounder', "Interface Info", "echo_toast_info"); $scope.interfaceData = response.data; + console.log($scope.interfaceData); // on place en IPv4 l'ip dans listInterfaceIP $scope.listInterfaceIP = response.data[$scope.address_family['IPv4']]; }, @@ -572,6 +573,7 @@ EchoApp.controller("notificationPanelMenu", function($scope, $timeout, $rootScop EchoApp.controller("graphNetwork", function($scope, $document, $http) { // contexte couleurs $scope.rootColor = getComputedStyle(document.documentElement); + console.log($scope.rootColor); // fonctions de récupérations de donnée Fast Scan $scope.getFastScan = function(cible) { @@ -588,6 +590,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { function(response) { $scope.$parent.sendToastData('FastPing', "réception d'un scan", 'echo_toast_scan'); + console.log(response.data); // on appel la fonction de création de graphs : $scope.createCytoVlanGraph(response.data); }, @@ -614,6 +617,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { function(response) { $scope.$parent.sendToastData('ARP Scan', "réception d'un scan", 'echo_toast_scan'); + console.log(response.data); // on appel la fonction de création de graphs : $scope.createCytoVlanGraph(response.data); }, @@ -640,6 +644,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { function(response) { $scope.$parent.sendToastData('Traceroute CIDR Scan', "réception d'un scan", 'echo_toast_scan'); + console.log(response.data); // on appel la fonction de création de graphs : $scope.createCytoTraceCIDRGraph(response.data); }, @@ -666,6 +671,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { function(response) { $scope.$parent.sendToastData('DHCP CIDR Scan', "réception d'un scan", 'echo_toast_scan'); + console.log(response.data); // on appel la fonction de création de graphs : $scope.createCytoCIDRGraph(response.data, cible); }, @@ -710,6 +716,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { function(response) { $scope.$parent.sendToastData('Traceroute Scan', "réception d'un scan", 'echo_toast_scan'); + console.log(response.data); // on appel la fonction de création de graphs : $scope.createCytoTraceGraph(response.data); }, @@ -734,6 +741,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { "192.0.0.0/24", "192.0.2.0/24", "192.88.99.0/24", + "192.175.48.0/24", "198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", @@ -757,6 +765,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { function(response) { $scope.$parent.sendToastData('Traceroute Local Scan', "réception d'un scan", 'echo_toast_scan'); + console.log(response.data); // on appel la fonction de création de graphs : $scope.createCytoTraceCIDRGraph(response.data); }, @@ -785,6 +794,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { function(response) { $scope.$parent.sendToastData('Profiling Scan', "réception d'un scan", 'echo_toast_scan'); + console.log(response.data); // on met à jour le node concerné via une fonction de sélection de node $scope.updateNodebyIP(cible, 'profiling', response.data['scan']); $scope.updateNodeOS(cible, response.data['scan']); @@ -812,6 +822,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { function(response) { $scope.$parent.sendToastData('Services Scan', "réception d'un scan", 'echo_toast_scan'); + console.log(response.data); // on met à jour le graph en ajoutant des noeuds type service lié à la cible $scope.createCytoServiceGraph(response.data['scan']); }, @@ -838,6 +849,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { function(response) { $scope.$parent.sendToastData('Services Fast Scan', "réception d'un scan", 'echo_toast_scan'); + console.log(response.data); // on met à jour le graph en ajoutant des noeuds type service lié à la cible $scope.createCytoServiceGraph(response.data['scan']); }, @@ -864,6 +876,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { function(response) { $scope.$parent.sendToastData('Reverse PTR Scan', "réception d'un scan", 'echo_toast_scan'); + console.log(response.data); // on met à jour le node concerné via une fonction de sélection de node $scope.updateNodebyIP(cible, 'hostname PTR', response.data['scan']); }, @@ -890,6 +903,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { function(response) { $scope.$parent.sendToastData('Fingerprint SSH Scan', "réception d'un scan", 'echo_toast_scan'); + console.log(response.data); // on met à jour le node concerné via une fonction de sélection de node $scope.updateNodebyIP(cible, 'fingerprint ssh', response.data['scan']); }, @@ -915,6 +929,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { function(response) { $scope.$parent.sendToastData('SMB Scan', "réception d'un scan", 'echo_toast_scan'); + console.log(response.data); // on met à jour le node concerné via une fonction de sélection de node $scope.updateNodebyIP(cible, 'smb', response.data['scan']); }, @@ -940,6 +955,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { function(response) { $scope.$parent.sendToastData('SNMP Scan', "réception d'un scan", 'echo_toast_scan'); + console.log(response.data); // on met à jour le node concerné via une fonction de sélection de node $scope.updateNodebyIP(cible, 'snmp_info', response.data['scan']); }, @@ -965,6 +981,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { function(response) { $scope.$parent.sendToastData('SNMP netstat', "réception d'un scan", 'echo_toast_scan'); + console.log(response.data); // on met à jour le node concerné via une fonction de sélection de node $scope.updateNodebyIP(cible, 'snmp_nestat', response.data['scan']); }, @@ -990,6 +1007,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { function(response) { $scope.$parent.sendToastData('SNMP process', "réception d'un scan", 'echo_toast_scan'); + console.log(response.data); // on met à jour le node concerné via une fonction de sélection de node $scope.updateNodebyIP(cible, 'snmp_process', response.data['scan']); }, @@ -1015,6 +1033,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { function(response) { $scope.$parent.sendToastData('NTP', "réception d'un scan", 'echo_toast_scan'); + console.log(response.data); // on met à jour le node concerné via une fonction de sélection de node $scope.updateNodebyIP(cible, 'ntp', response.data['scan']); }, @@ -1040,6 +1059,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { function(response) { $scope.$parent.sendToastData('RDP Scan', "réception d'un scan", 'echo_toast_scan'); + console.log(response.data); // on met à jour le node concerné via une fonction de sélection de node $scope.updateNodebyIP(cible, 'rdp_info', response.data['scan']); }, @@ -1065,6 +1085,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { function(response) { $scope.$parent.sendToastData('TraceCible Scan', "réception d'un scan", 'echo_toast_scan'); + console.log(response.data); // on met à jour le node concerné via une fonction de sélection de node $scope.createCytoTraceGraph(response.data); }, @@ -1101,6 +1122,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { // si la requête passe : function(response) { $scope.$parent.sendToastData('AS Resolution', "Récupération de donnée RDAP", 'echo_toast_scan'); + console.log(response.data); // on les fout dans le label du noeud if(node.data('label').includes(' ')) { node.data('label', node.data('label') + " & " + response.data.name); @@ -1122,6 +1144,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { // si la requête passe : function(response) { $scope.$parent.sendToastData('AS Resolution', "Récupération de donnée RDAP", 'echo_toast_scan'); + console.log(response.data); // on les fout dans le label du noeud if(node.data('label').includes(' ')) { node.data('label', node.data('label') + " & " + response.data.name); @@ -1149,6 +1172,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { // si la requête passe : function(response) { $scope.$parent.sendToastData('AS Resolution', "Récupération de donnée RDAP", 'echo_toast_scan'); + console.log(response.data); // on les fout dans le label du noeud node.data('label', node.data('label') + " " + response.data.name); // on spécifie que la résolution a été effectué @@ -1419,6 +1443,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { id : (scan_data.local_data.gateway_ip + '\n' + scan_data.local_data.gateway_mac), label : ("gateway " + scan_data.local_data.gateway_ip + "\n" + scan_data.local_data.gateway_mac), type : 'IP', + typeip: ipaddr.parse(scan_data.local_data.gateway_ip).range(), data : scan_data.local_data, data_ip : scan_data.local_data.gateway_ip, parent : scan_data.vlan, @@ -1436,6 +1461,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { id : (nodeAdd.IP + '\n' + nodeAdd.mac), label : (nodeAdd.IP + '\n' + nodeAdd.mac), type : 'IP', + typeip : ipaddr.parse(nodeAdd.IP).range(), data : nodeAdd, data_ip : nodeAdd.IP, parent : scan_data.vlan, @@ -1475,6 +1501,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { // fonction de création du graph à partir d'un scan trace $scope.createCytoTraceGraph = function(scan_data) { + console.log(scan_data); let nodes = []; let edges = []; @@ -1491,6 +1518,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { id : (ip), label : (ip), type : 'IP', + typeip : ipaddr.parse(ip).range(), data : {'ip' : ip}, data_ip : ip, parent : $scope.getVLANByIP(ip), // a retravailler : on doit préalablement voir si le noeud rentre dans le CIDR... @@ -1539,7 +1567,6 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { let cidr = ipdata[1][0]; let as_number = ipdata[1][1]; let typeip = ipaddr.parse(ip).range(); - console.log(typeip); if((typeip != 'private') && (typeip != 'multicast')) { // on crée un AS nodeAS.push( @@ -1614,6 +1641,7 @@ EchoApp.controller("graphNetwork", function($scope, $document, $http) { id : (nodeAdd.ipv4 + '\n' + nodeAdd.mac), label : (nodeAdd.ipv4 + '\n' + nodeAdd.mac), type : 'IP', + typeip : ipaddr.parse(nodeAdd.ipv4).range(), data : nodeAdd, data_ip : nodeAdd.ipv4, parent : cidr, diff --git a/webchosounder.py b/webchosounder.py index b29c213..a550998 100755 --- a/webchosounder.py +++ b/webchosounder.py @@ -115,7 +115,7 @@ def scan_dhcp_cidr(): if not if_contain_cible(request.json): return {'error': "malformed request"} else: - dhcp_ip: List[List[dict]] = echosounder.scan_dhcp_discover() + dhcp_ip: List[List[dict]] = echosounder.scan_dhcp_discover(request.json['cible']) return jsonify(scan=dhcp_ip) @app.route('/json/profiling_scan', methods=['POST'])