Skip to content

Commit

Permalink
Merge pull request #97 from darcosion/revert-96-dev-darcosion
Browse files Browse the repository at this point in the history
Revert "Dev darcosion"
  • Loading branch information
darcosion committed Aug 22, 2024
2 parents 3d96ec9 + 3778919 commit 14107bf
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
4 changes: 2 additions & 2 deletions echosounder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down
30 changes: 29 additions & 1 deletion static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']];
},
Expand Down Expand Up @@ -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) {
Expand All @@ -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);
},
Expand All @@ -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);
},
Expand All @@ -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);
},
Expand All @@ -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);
},
Expand Down Expand Up @@ -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);
},
Expand All @@ -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",
Expand All @@ -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);
},
Expand Down Expand Up @@ -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']);
Expand Down Expand Up @@ -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']);
},
Expand All @@ -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']);
},
Expand All @@ -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']);
},
Expand All @@ -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']);
},
Expand All @@ -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']);
},
Expand All @@ -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']);
},
Expand All @@ -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']);
},
Expand All @@ -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']);
},
Expand All @@ -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']);
},
Expand All @@ -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']);
},
Expand All @@ -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);
},
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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é
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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 = [];

Expand All @@ -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...
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion webchosounder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down

0 comments on commit 14107bf

Please sign in to comment.