Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/testing'
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Kremser committed Mar 24, 2018
2 parents 03a98ba + 3b1528f commit 105957d
Show file tree
Hide file tree
Showing 33 changed files with 25,478 additions and 23,383 deletions.
15 changes: 15 additions & 0 deletions README.md
Expand Up @@ -166,10 +166,25 @@ If no port shows up you may have to reinstall the drivers.

**18** Upload!

**19** Install the [ESP8266 Sketh Data uploader](https://github.com/esp8266/arduino-esp8266fs-plugin) plugin, your mileage may vary depending on your version of Arduino IDE.

**20** Restart Arduino IDE, reopen the project, and from the "tools" menu, choose "ESP8266 Sketch Data Upload".


**Note:** If you use a 512kb version of the ESP8266, you will need to comment out a part of the mac vendor list in data.h. Otherwise it will use too much memory to fit on 512kb.

**Your ESP8266 Deauther is now ready!**


### Updating the MAC vendor list
The utils folder includes a python script for downloading the latest ["manuf"](https://code.wireshark.org/review/gitweb?p=wireshark.git;a=blob_plain;f=manuf) file from Whireshark and convert it to the format understood by esp8266_deauther.

The usage of the script is quite simple: `update_manuf.py [-h] [-o OUTPUT] [-u URL]` , e.g:
```
cd utils
python update_manuf.py -o ../esp8266_deauther/oui.h
```

### Adding an OLED display

![image of the esp8266 deauther with an OLED and three buttons](https://raw.githubusercontent.com/spacehuhn/esp8266_deauther/master/screenshots/esp8266_with_oled.jpg)
Expand Down
29 changes: 21 additions & 8 deletions esp8266_deauther/APScan.cpp
Expand Up @@ -20,7 +20,7 @@ bool APScan::start() {

if (debug) Serial.println("Scan results: "+(String)results);

for (int i = 0; i < results; i++) {
for (int i = 0; i < results && i < maxAPScanResults; i++) {
Mac _ap;
_ap.set(WiFi.BSSID(i)[0], WiFi.BSSID(i)[1], WiFi.BSSID(i)[2], WiFi.BSSID(i)[3], WiFi.BSSID(i)[4], WiFi.BSSID(i)[5]);
aps.add(_ap);
Expand All @@ -29,7 +29,6 @@ bool APScan::start() {
encryption[i] = WiFi.encryptionType(i);
hidden[i] = WiFi.isHidden(i);
String _ssid = WiFi.SSID(i);
_ssid.replace("\"", "\\\"");
_ssid.toCharArray(names[i], 33);
//data_getVendor(WiFi.BSSID(i)[0],WiFi.BSSID(i)[1],WiFi.BSSID(i)[2]).toCharArray(vendors[i],9);
if (debug) {
Expand Down Expand Up @@ -109,7 +108,7 @@ String APScan::getEncryption(int code) {
}

String APScan::getAPName(int num) {
if (isHidden(num)) return "* Hidden SSID *";
//if (isHidden(num)) return "* Hidden SSID *";
return names[num];
}
String APScan::getAPEncryption(int num) {
Expand All @@ -136,6 +135,18 @@ int APScan::getFirstTarget() {
return -1;
}

String APScan::sanitizeJson(String input){
input.replace("\\","\\\\");
input.replace("\"","\\\"");
input.replace("/","\\/");
input.replace("\b","\\b");
input.replace("\f","\\f");
input.replace("\n","\\n");
input.replace("\r","\\r");
input.replace("\t","\\t");
return input;
}

void APScan::sendResults() {
if (debug) Serial.print("sending AP scan result JSON ");

Expand All @@ -155,10 +166,10 @@ void APScan::sendResults() {
_size += 6; // "e": ,
_size += 6; // "se":0
_size++; // }*/
_size += 61;
_size += 67;
_size += String(i).length();
_size += String(getAPChannel(i)).length();
_size += getAPName(i).length();
_size += sanitizeJson(getAPName(i)).length();
_size += String(getAPRSSI(i)).length();

if ((i != results - 1) && (i != maxAPScanResults - 1)) _size++; // ,
Expand All @@ -178,11 +189,12 @@ void APScan::sendResults() {
json += "\"i\":" + (String)i + ",";
json += "\"c\":" + (String)getAPChannel(i) + ",";
json += "\"m\":\"" + getAPMac(i) + "\",";
json += "\"ss\":\"" + getAPName(i) + "\",";
json += "\"ss\":\"" + sanitizeJson(getAPName(i)) + "\",";
json += "\"r\":" + (String)getAPRSSI(i) + ",";
json += "\"e\":" + (String)encryption[i] + ",";
//json += "\"v\":\""+getAPVendor(i)+"\",";
json += "\"se\":" + (String)isSelected(i);
json += "\"h\":" + (String)hidden[i] + ",";
json += "\"se\":" + (String)isSelected(i);
json += "}";
if ((i != results - 1) && (i != maxAPScanResults - 1)) json += ",";

Expand Down Expand Up @@ -211,10 +223,11 @@ String APScan::getResultsJSON() {
json += "\"i\":" + (String)i + ",";
json += "\"c\":" + (String)getAPChannel(i) + ",";
json += "\"m\":\"" + getAPMac(i) + "\",";
json += "\"ss\":\"" + getAPName(i) + "\",";
json += "\"ss\":\"" + sanitizeJson(getAPName(i)) + "\",";
json += "\"r\":" + (String)getAPRSSI(i) + ",";
json += "\"e\":" + (String)encryption[i] + ",";
//json += "\"v\":\""+getAPVendor(i)+"\",";
json += "\"h\":" + (String)hidden[i] + ",";
json += "\"se\":" + (String)isSelected(i);
json += "}";
if ((i != results - 1) && (i != maxAPScanResults - 1)) json += ",";
Expand Down
2 changes: 2 additions & 0 deletions esp8266_deauther/APScan.h
Expand Up @@ -39,6 +39,8 @@ class APScan {
int getFirstTarget();
bool isSelected(int num);

String sanitizeJson(String input);

int results = 0;
int selectedSum;
MacList aps;
Expand Down
8 changes: 2 additions & 6 deletions esp8266_deauther/Attack.cpp
Expand Up @@ -139,12 +139,8 @@ void Attack::sendDeauths(Mac from, Mac to){
buildDeauth(from, to, 0xc0, settings.deauthReason );
if(send()) packetsCounter[0]++;
buildDeauth(from, to, 0xa0, settings.deauthReason );
send();
buildDeauth(to, from, 0xc0, settings.deauthReason );
send();
buildDeauth(to, from, 0xa0, settings.deauthReason );
send();
delay(5);
if(send()) packetsCounter[0]++;
delay(3);
}
}

Expand Down
22,975 changes: 39 additions & 22,936 deletions esp8266_deauther/data.h

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions web_server/html/apscan.html → esp8266_deauther/data/apscan.html
Expand Up @@ -12,11 +12,11 @@
</head>
<body>
<nav>
<a href="apscan.html">APs</a>
<a href="stations.html">Stations</a>
<a href="attack.html">Attacks</a>
<a href="settings.html">Settings</a>
<a class="right" href="info.html">Info</a>
<a href="apscan.html">{APs}</a>
<a href="stations.html">{Stations}</a>
<a href="attack.html">{Attacks}</a>
<a href="settings.html">{Settings}</a>
<a class="right" href="info.html">{Info}</a>
</nav>

<div class="container">
Expand All @@ -25,19 +25,19 @@

<div id="error" class="hide"></div>

<h1 class="header">Scan for Wi-Fi access points</h1>
<h1 class="header">{h1}</h1>

<a id="scanInfo" class="left labelFix">scanning...</a>
<a id="scanInfo" class="left labelFix">{a1}</a>

<button onclick="scan()" id="apScanStart" class="right button-primary">scan</button>
<button onclick="scan()" id="apScanStart" class="right button-primary">{button1}</button>

<p class="clear">
Networks found: <span id="networksFound">0</span><br />
MAC: <span id="apMAC"></span><br />
{p1} <span id="networksFound">0</span><br />
{p2} <span id="apMAC"></span><br />
<br />
<span id="selectAllBtns" style="visibility:'hidden'">
<button class="marginNull button-primary left" onclick="select(-2)">deselect all</button>
<button class="marginNull button-primary right" onclick="select(-1)">select all</button>
<button class="marginNull button-primary left" onclick="select(-2)">{button2}</button>
<button class="marginNull button-primary right" onclick="select(-1)">{button3}</button>
<br />
</span>

Expand All @@ -46,7 +46,7 @@ <h1 class="header">Scan for Wi-Fi access points</h1>
<table></table>

<p class="small">
<span class="red">INFO: </span><span class="bold">You may have to reload the site to see the results.</span>
<span class="red">{p3} </span><span class="bold">{p4}</span>
<br />
<br />
</p>
Expand All @@ -57,10 +57,10 @@ <h1 class="header">Scan for Wi-Fi access points</h1>
<a href="https://github.com/spacehuhn" target="_blank">github.com/spacehuhn</a>
</div>

<script src="js/apscan.js"></script>

</div>
</div>
</div>
<script src="js/l10n.js" async defer></script>
<script data-src="js/apscan.js"></script>
</body>
</html>
63 changes: 31 additions & 32 deletions web_server/html/attack.html → esp8266_deauther/data/attack.html
Expand Up @@ -12,11 +12,11 @@
</head>
<body>
<nav>
<a href="apscan.html">APs</a>
<a href="stations.html">Stations</a>
<a href="attack.html">Attacks</a>
<a href="settings.html">Settings</a>
<a class="right" href="info.html">Info</a>
<a href="apscan.html">{APs}</a>
<a href="stations.html">{Stations}</a>
<a href="attack.html">{Attacks}</a>
<a href="settings.html">{Settings}</a>
<a class="right" href="info.html">{Info}</a>
</nav>

<div class="container">
Expand All @@ -25,12 +25,12 @@

<div id="error" class="hide"></div>

<h1 class="header">Attacks</h1>
<h1 class="header">{h1}</h1>

<p class="bold">Selected AP(s): <button onclick='cloneSelected()'>clone</button></p>
<p class="bold">{p1} <button onclick='cloneSelected()'>{button1}</button></p>
<ul id="selectedAPs"></ul>

<p class="bold">Selected Station(s):</p>
<p class="bold">{p2}</p>
<ul id="selectedClients"></ul>

<table></table>
Expand All @@ -39,12 +39,12 @@ <h1 class="header">Attacks</h1>
<input type="number" id="randomIntrvl" value="5" min="1" max="65000"/>s
</label>

<button class="right" id="randomBtn" onclick="random()">Enable Random</button>
<button class="right" id="randomBtn" onclick="random()">{button2}</button>

<p class="clear">
<br />
<span class="red">INFO: </span><span class="bold">You may loose connection when starting the attack.</span><br />
Change the channel in the settings to the same of the selected AP to prevent this.
<span class="red">{p3} </span><span class="bold">{p4}</span><br />
{p5}
</p>

<hr />
Expand All @@ -53,16 +53,16 @@ <h1 class="header">Attacks</h1>

<div class="row">
<div class="col-6">
<label for="ssid">SSID</label>
<label for="ssid">{label1}</label>
</div>
<div class="col-6">
<input type="text" id="ssid" minlength="1" maxlength="32" placeholder="SSID" />
<input type="text" id="ssid" minlength="1" maxlength="32" placeholder="{placeholder1}" />
</div>
</div>

<div class="row">
<div class="col-6">
<label for="num">Number of Clones</label>
<label for="num">{label2}</label>
</div>
<div class="col-6">
<input type="number" id="num" min="0" max="48" value="0" />
Expand All @@ -71,7 +71,7 @@ <h1 class="header">Attacks</h1>

<div class="row">
<div class="col-6">
<label for="enc">Encrypted</label>
<label for="enc">{label3}</label>
</div>
<div class="col-6">
<input type="checkbox" id="enc" name="enc" />
Expand All @@ -81,46 +81,45 @@ <h1 class="header">Attacks</h1>
<div class="row">
<div class="col-12">

<button class="button-primary col-4" onclick="addSSID()">add</button>
<button class="button-primary col-4" onclick="addSSID()">{button3}</button>

<hr />

<p class="left">SSIDs: <span id="ssidCounter">0/48</span></p>
<p class="left">{p6} <span id="ssidCounter">0/48</span></p>

<div class="right">
<button class="red" onclick="clearSSID()">clear</button>
<button onclick="randomSSID()">random</button>
<button class="red" onclick="clearSSID()">{button4}</button>
<button onclick="randomSSID()">{button5}</button>
</div>

<table></table>

<button class="marginNull red" onclick="resetSSID()">reset</button>
<button class="marginNull button-primary right" onclick="saveSSID()">save</button>
<button class="marginNull red" onclick="resetSSID()">{button6}</button>
<button class="marginNull button-primary right" onclick="saveSSID()">{button7}</button>

<p class="small" id="saved">saved</p>
<p class="small" id="saved">{p7}</p>

<p>
<br />
<span class="bold">Deauth [deauthentication attack]:</span><br />
Sends constantly deauthentication and disassociation frames to the selected station(s) and access point(s).<br />
<span class="bold">{p8}</span><br />
{p9}<br />
<br />
<span class="bold">Beacon [beacon flooding]:</span><br />
Broadcasts constantly beacon frames to advertise all SSIDs in the list below.<br />
<span class="bold">{pa}</span><br />
{pb}<br />
<br />
<span class="bold">Probe-Request [probe request flooding]:</span><br />
Broadcasts constantly probe request frames with all SSIDs in the list below.
<span class="bold">{pc}</span><br />
{pd}
</p>

<div id="copyright">
Version 1.6<br />
Copyright (c) 2017 Stefan Kremser<br />
<a href="https://github.com/spacehuhn" target="_blank">github.com/spacehuhn</a>
</div>

<script src="js/attack.js"></script>

</div>
</div>
</div>
<script src="js/l10n.js" async defer></script>
<script data-src="js/attack.js"></script>
</body>
</html>
</html>
32 changes: 32 additions & 0 deletions esp8266_deauther/data/config.ru
@@ -0,0 +1,32 @@
#
# this is a small ruby webserver for fast UI development
# make sure you have ruby and rack gem
#
# $ sudo gem install rack
#
# once installed, run this:
#
# $ rackup config.ru
#
# and access the given port on localhost
#


require "net/http"
require "uri"

# app root
@root = File.expand_path(File.dirname(__FILE__))

run Proc.new { |env|
request = Rack::Request.new(env)
path = Rack::Utils.unescape(env['PATH_INFO'])
index_file = @root + "#{path}/index.html"
if File.exists?(index_file)
# Return the index
[200, {'Content-Type' => 'text/html'}, [File.read(index_file)]]
else
# Pass the request to the directory app
Rack::Directory.new(@root).call(env)
end
}

0 comments on commit 105957d

Please sign in to comment.