Skip to content

Commit

Permalink
Added chip information to info page + minor bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
samdenty committed Aug 19, 2017
1 parent 66a05b0 commit 0f4493f
Show file tree
Hide file tree
Showing 17 changed files with 168 additions and 86 deletions.
39 changes: 39 additions & 0 deletions arduino/Wi-PWN/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,3 +300,42 @@ void Settings::send() {
if (debug) Serial.println("\ndone");

}

size_t Settings::getSysInfoSize() {
String json = "{";
size_t jsonSize = 0;
uint32_t free = system_get_free_heap_size();

json += "\"availableram\":\"" + (String)free + "\",";
json += "\"bootmode\":\"" + (String)ESP.getBootMode() + "\",";
json += "\"bootversion\":\"" + (String)ESP.getBootVersion() + "\",";
json += "\"sdkversion\":\"" + (String)ESP.getSdkVersion() + "\",";
json += "\"chipid\":\"" + (String)ESP.getChipId() + "\",";
json += "\"flashchipid\":\"" + (String)ESP.getFlashChipId() + "\",";
json += "\"flashchipsize\":\"" + (String)ESP.getFlashChipSize() + "\",";
json += "\"flashchiprealsize\":\"" + (String)ESP.getFlashChipRealSize() + "\"}";
jsonSize += json.length();

return jsonSize;
}

void Settings::sendSysInfo() {
if (debug) Serial.println("getting sysinfo json");
sendHeader(200, "text/json", getSysInfoSize());
uint32_t free = system_get_free_heap_size();

String json = "{";
json += "\"availableram\":\"" + (String)free + "\",";
json += "\"bootmode\":\"" + (String)ESP.getBootMode() + "\",";
json += "\"bootversion\":\"" + (String)ESP.getBootVersion() + "\",";
json += "\"sdkversion\":\"" + (String)ESP.getSdkVersion() + "\",";
json += "\"chipid\":\"" + (String)ESP.getChipId() + "\",";
json += "\"flashchipid\":\"" + (String)ESP.getFlashChipId() + "\",";
json += "\"flashchipsize\":\"" + (String)ESP.getFlashChipSize() + "\",";
json += "\"flashchiprealsize\":\"" + (String)ESP.getFlashChipRealSize() + "\"}";
sendToBuffer(json);
sendBuffer();

if (debug) Serial.println("\ndone");

}
2 changes: 2 additions & 0 deletions arduino/Wi-PWN/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class Settings
void reset();
void save();
void send();
void sendSysInfo();
void info();

int ssidLen;
Expand Down Expand Up @@ -107,6 +108,7 @@ class Settings

private:
size_t getSize();
size_t getSysInfoSize();
};

#endif
17 changes: 13 additions & 4 deletions arduino/Wi-PWN/Wi-PWN.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
************************************************
*/

// Including some libraries we need //
// Including some libraries we need //se
#include <Arduino.h>

#include <ESP8266WiFi.h>
Expand Down Expand Up @@ -197,9 +197,6 @@ void loadInfoHTML(){
sendFile(200, "text/html", data_info_HTML, sizeof(data_info_HTML), false);
}

void loadFunctionsJS() {
sendFile(200, "text/javascript", data_functions_JS, sizeof(data_functions_JS), false);
}
void loadScanJS() {
sendFile(200, "text/javascript", data_scan_JS, sizeof(data_scan_JS), false);
}
Expand All @@ -216,6 +213,12 @@ void loadControlJS() {
void loadSettingsJS() {
sendFile(200, "text/javascript", data_settings_JS, sizeof(data_settings_JS), false);
}
void loadInfoJS() {
sendFile(200, "text/javascript", data_info_JS, sizeof(data_info_JS), false);
}
void loadFunctionsJS() {
sendFile(200, "text/javascript", data_functions_JS, sizeof(data_functions_JS), false);
}

void loadStyle() {
sendFile(200, "text/css;charset=UTF-8", data_main_CSS, sizeof(data_main_CSS), false);
Expand Down Expand Up @@ -455,6 +458,10 @@ void getSettings() {
settings.send();
}

void getSysInfo() {
settings.sendSysInfo();
}

void saveSettings() {
server.send( 200, "text/json", "true" );
if (server.hasArg("ssid")) settings.ssid = server.arg("ssid");
Expand Down Expand Up @@ -648,6 +655,7 @@ void setup() {
server.on("/js/attack.js", loadAttackJS);
server.on("/js/control.js", loadControlJS);
server.on("/js/settings.js", loadSettingsJS);
server.on("/js/info.js", loadInfoJS);
server.on("/js/functions.js", loadFunctionsJS);

/* CSS */
Expand All @@ -667,6 +675,7 @@ void setup() {
server.on("/attackInfo.json", sendAttackInfo);
server.on("/attackStart.json", startAttack);
server.on("/settings.json", getSettings);
server.on("/sysinfo.json", getSysInfo);
server.on("/settingsSave.json", saveSettings);
server.on("/settingsReset.json", resetSettings);
server.on("/deleteName.json", deleteName);
Expand Down
25 changes: 13 additions & 12 deletions arduino/Wi-PWN/data.h

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions web_server/html/attack.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<head>
<title>Attack - Wi-PWN</title>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="dark.css">
<link rel="stylesheet" href="/main.css">
<link rel="stylesheet" href="/dark.css">
<meta name="theme-color" content="#1976d2">
</head>

Expand All @@ -13,11 +13,11 @@
</div>
<div id="links">
<a href="./">Scan</a>
<a href="users.html">Users</a>
<a href="attack.html" class="active">Attack</a>
<a href="control.html">Control</a>
<a href="settings.html">Settings</a>
<a class="right" href="info.html">Info</a>
<a href="/users.html">Users</a>
<a href="/attack.html" class="active">Attack</a>
<a href="/control.html">Control</a>
<a href="/settings.html">Settings</a>
<a class="right" href="/info.html">Info</a>
</div>
</nav>
<div id="notification"></div>
Expand Down
14 changes: 7 additions & 7 deletions web_server/html/control.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<head>
<title>GPIO Control - Wi-PWN</title>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="dark.css">
<link rel="stylesheet" href="/main.css">
<link rel="stylesheet" href="/dark.css">
<meta name="theme-color" content="#1976d2">
</head>

Expand All @@ -13,11 +13,11 @@
</div>
<div id="links">
<a href="./">Scan</a>
<a href="users.html">Users</a>
<a href="attack.html">Attack</a>
<a href="control.html" class="active">Control</a>
<a href="settings.html">Settings</a>
<a class="right" href="info.html">Info</a>
<a href="/users.html">Users</a>
<a href="/attack.html">Attack</a>
<a href="/control.html" class="active">Control</a>
<a href="/settings.html">Settings</a>
<a class="right" href="/info.html">Info</a>
</div>
</nav>
<div id="notification"></div>
Expand Down
2 changes: 1 addition & 1 deletion web_server/html/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ a,
@media (min-width:520px) {
::-webkit-scrollbar {
width: 14px;
background-color: #1d1d23
background-color: #28282E
}
::-webkit-scrollbar-thumb {
background-color: #4b4b54
Expand Down
14 changes: 7 additions & 7 deletions web_server/html/detector.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<head>
<title>Deauth Detector - Wi-PWN</title>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="dark.css">
<link rel="stylesheet" href="/main.css">
<link rel="stylesheet" href="/dark.css">
<meta name="theme-color" content="#1976d2">
</head>

Expand All @@ -13,12 +13,12 @@
</div>
<div id="links">
<a href="./">Scan</a>
<a href="users.html">Users</a>
<a href="attack.html">Attack</a>
<a href="control.html">Control</a>
<a href="/users.html">Users</a>
<a href="/attack.html">Attack</a>
<a href="/control.html">Control</a>
<a href="detector.html" class="active">Detector</a>
<a href="settings.html">Settings</a>
<a class="right" href="info.html">Info</a>
<a href="/settings.html">Settings</a>
<a class="right" href="/info.html">Info</a>
</div>
</nav>
<div id="notification"></div>
Expand Down
14 changes: 7 additions & 7 deletions web_server/html/error.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<head>
<title>404 - Wi-PWN</title>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="dark.css">
<link rel="stylesheet" href="/main.css">
<link rel="stylesheet" href="/dark.css">
<meta name="theme-color" content="#1976d2">
</head>

Expand All @@ -13,11 +13,11 @@
</div>
<div id="links">
<a href="./">Scan</a>
<a href="users.html">Users</a>
<a href="attack.html">Attack</a>
<a href="control.html">Control</a>
<a href="settings.html">Settings</a>
<a class="right" href="info.html">Info</a>
<a href="/users.html">Users</a>
<a href="/attack.html">Attack</a>
<a href="/control.html">Control</a>
<a href="/settings.html">Settings</a>
<a class="right" href="/info.html">Info</a>
</div>
</nav>
<div id="notification"></div>
Expand Down
18 changes: 9 additions & 9 deletions web_server/html/index.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<head>
<title>Scan - Wi-PWN</title>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="dark.css">
<link rel="stylesheet" href="/main.css">
<link rel="stylesheet" href="/dark.css">
<meta name="theme-color" content="#1976d2">
</head>

Expand All @@ -13,11 +13,11 @@
</div>
<div id="links">
<a href="./" class="active">Scan</a>
<a href="users.html">Users</a>
<a href="attack.html">Attack</a>
<a href="control.html">Control</a>
<a href="settings.html">Settings</a>
<a class="right" href="info.html">Info</a>
<a href="/users.html">Users</a>
<a href="/attack.html">Attack</a>
<a href="/control.html">Control</a>
<a href="/settings.html">Settings</a>
<a class="right" href="/info.html">Info</a>
</div>
</nav>
<div id="notification"></div>
Expand All @@ -38,8 +38,8 @@
<div class="card">
<table id="apscan"></table>
<div class="card-action">
<a onclick="window.location='users.html'" class="light">Users</a>
<a onclick="window.location='attack.html'" class="right">Attack</a>
<a onclick="window.location='/users.html'" class="light">Users</a>
<a onclick="window.location='/attack.html'" class="right">Attack</a>
</div>
</div>
</div>
Expand Down
36 changes: 21 additions & 15 deletions web_server/html/info.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<head>
<title>Info - Wi-PWN</title>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="dark.css">
<link rel="stylesheet" href="/main.css">
<link rel="stylesheet" href="/dark.css">
<meta name="theme-color" content="#1976d2">
</head>

Expand All @@ -13,11 +13,11 @@
</div>
<div id="links">
<a href="./">Scan</a>
<a href="users.html">Users</a>
<a href="attack.html">Attack</a>
<a href="control.html">Control</a>
<a href="settings.html">Settings</a>
<a class="right active" href="info.html">Info</a>
<a href="/users.html">Users</a>
<a href="/attack.html">Attack</a>
<a href="/control.html">Control</a>
<a href="/settings.html">Settings</a>
<a class="right active" href="/info.html">Info</a>
</div>
</nav>
<div id="notification"></div>
Expand All @@ -31,13 +31,19 @@
<div class="settingsHeader">Wi-PWN</div>
<div class="card">
<div class="card-content">
This project is licensed under the <a href="https://creativecommons.org/licenses/by-nc/4.0/"><i title="CC BY-NC 4.0">Creative Commons Attribution-NonCommercial 4.0 license.</i></a>
<br>It can perform deauth attacks on unprotected <i>802.11</i> Wi-Fi networks, <i>not to be confused with as a 'Wi-Fi Jammer'.</i> This software is based upon the work of Stefan Kremser (Spacehuhn)<br><br>
<button onclick="checkUpdate()">Check for updates</button>
<a class="samddAttrib" href="https://samdenty99.github.io/about" target="_blank">
<button>@samdenty99</button> (Sam Denty)
</a>

</div>
<table>
<tr>
<td>Installed version</td>
<td id="version"></td>
<td><button onclick="checkUpdate()">Check for updates</button></td>
</tr>
<tr>
<td>Available RAM</td>
<td id="availableram"></td>
</tr>
</table>
<div class="card-action">
<a href="https://samdenty99.github.io/r?https://Wi-PWN.samdd.me/discord" target="blank_">Report bug</a><a href="https://samdenty99.github.io/projects" class="right" target="blank_">Other projects</a>
</div>
Expand Down Expand Up @@ -69,7 +75,7 @@
<br>
<br>
<div class="divider"></div>
<br>For more information go to <a href="https://github.com/samdenty99/Wi-PWN/graphs/contributors">contributors page</a> on GitHub.
<br>This software is based upon the work of Stefan Kremser (Spacehuhn)<br>For more information go to <a href="https://github.com/samdenty99/Wi-PWN/graphs/contributors">contributors page</a> on GitHub.
</div>
</div>
<hr>
Expand All @@ -94,5 +100,5 @@
</div>
<footer></footer>
<script src="js/functions.js"></script>
<script>document.getElementsByClassName('main-wrap')[0].className = 'main-wrap fadeIn'</script>
<script src="js/info.js"></script>
</body>
2 changes: 1 addition & 1 deletion web_server/html/js/functions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var version = "7.0",
var version = "7.1",
sL = getE('spinner-container'),
notification = document.getElementById("notification"),
themeColor = getComputedStyle(document.body),
Expand Down
15 changes: 15 additions & 0 deletions web_server/html/js/info.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var versionCell = getE("version"),
availableram = getE("availableram");

function getData() {
getResponse("sysinfo.json", function(responseText) {
var res = JSON.parse(responseText);
availableram.innerHTML = res.availableram;
});
}

getData();
versionCell.innerHTML = version;
document.getElementsByClassName('main-wrap')[0].className = 'main-wrap fadeIn'

infoInterval = setInterval(getData, 1200);

0 comments on commit 0f4493f

Please sign in to comment.