minor improvements

This commit is contained in:
Stefan Kremser
2017-02-25 15:07:57 +01:00
parent 1bccb3e99f
commit 75087e12f6
5 changed files with 21 additions and 32 deletions

View File

@@ -6,7 +6,7 @@ Attack::Attack(){
}
void Attack::generate(){
if(debug) Serial.print("generating Macs");
if(debug) Serial.print("generating Macs...");
Mac _randomBeaconMac;
uint8_t _randomMacBuffer[6];
@@ -16,7 +16,7 @@ void Attack::generate(){
getRandomVendorMac(_randomMacBuffer);
for(int i=0;i<6;i++) _randomBeaconMac.setAt(_randomMacBuffer[i],i);
}while(beaconAdrs.add(_randomBeaconMac) >= 0);
if(debug) Serial.println(" done");
if(debug) Serial.println("done");
}
void Attack::buildDeauth(Mac _ap, Mac _client, uint8_t type, uint8_t reason){
@@ -165,42 +165,26 @@ void Attack::run(){
Mac _broadcast;
_broadcast.set(0xFF,0xFF,0xFF,0xFF,0xFF,0xFF);
wifi_set_channel(_ch);
//int _selectedClients = 0;
//wifi_set_channel(_ch);
for(int c=0;c<macListLen/apScan.selectedSum;c++){
String _apName = _ssid;
if(c < _restSSIDLen) for(int d=0; d < _restSSIDLen-c; d++) _apName += " ";//e.g. "SAMPLEAP "
if(c < _restSSIDLen) for(int d=0; d < _restSSIDLen-c; d++) _apName += " ";//e.g. "SAMPLEAP "
else if(c < _restSSIDLen*2){
_apName = " "+_apName;
for(int d=0;d<(_restSSIDLen-1)-c/2;d++) _apName += " ";//e.g. " SAMPLEAP "
}else if(c < _restSSIDLen*3){
_apName += ".";
_apName = "."+_apName;
for(int d=0;d<(_restSSIDLen-1)-c/3;d++) _apName += " ";//e.g. ".SAMPLEAP "
} else{
for(int d=0; d < _restSSIDLen-1; d++) _apName += " ";
for(int d=0; d < _restSSIDLen-2; d++) _apName += " ";
_apName += (String)c;//e.g. "SAMPLEAP 78"
}
//build a broadcast packet for this AP & SSID
buildBeacon(beaconAdrs._get(c),_broadcast,_apName,_ch,apScan.getAPEncryption(a) != "none");
/*
for(int b=0;b<clientScan.results;b++){
if(clientScan.getClientSelected(b)){
_selectedClients++;
//change packet to adress only the selected client
for(int i=0;i<6;i++) packet[4+i] = clientScan.getClientMac(b)._get(i);
if(send()) packetsCounter[1]++;
}
}*/
//if no clients are selected send the broadcast packet
/*if(_selectedClients == 0)*/ if(send()) packetsCounter[1]++;
if(send()) packetsCounter[1]++;
}
}

View File

@@ -14,7 +14,7 @@ extern "C" {
#include "Settings.h"
#define attacksNum 2
#define macListLen 50 //max 80 - see MacList.h
#define macListLen 80
extern void PrintHex8(uint8_t *data, uint8_t length);
extern void getRandomVendorMac(uint8_t *buf);

File diff suppressed because one or more lines are too long

View File

@@ -53,6 +53,7 @@
var selectedAPs = document.getElementById("selectedAPs");
var selectedClients = document.getElementById("selectedClients");
var table = document.getElementsByTagName("table")[0];
var resultInterval;
function getResults(){
getResponse("attackInfo.json",function(responseText){
@@ -79,6 +80,9 @@
tr += "</tr>";
}
table.innerHTML = tr;
},function(){
clearInterval(resultInterval);
alert("timeout error. Please reload the site");
});
}
@@ -93,6 +97,6 @@
}
getResults();
setInterval(getResults,3000);
resultInterval = setInterval(getResults,3000);
</script>
</html>

View File

@@ -130,11 +130,12 @@
function changeName(id){
var newName = prompt("Name for "+res.clients[id].mac);
getResponse("setName.json?id="+id+"&name="+newName,function(responseText){
if(responseText == "true") getResults();
else alert("error");
});
if(newName != null){
getResponse("setName.json?id="+id+"&name="+newName,function(responseText){
if(responseText == "true") getResults();
else alert("error");
});
}
}
getResponse("ClientScanTime.json",function(responseText){