mirror of
https://github.com/SpacehuhnTech/esp8266_deauther.git
synced 2025-12-14 18:50:01 +01:00
Updated web files + progmem hosted web server
This commit is contained in:
@@ -15,9 +15,9 @@
|
|||||||
Uncomment the type of LED you're using
|
Uncomment the type of LED you're using
|
||||||
Only one of them can be defined at a time!
|
Only one of them can be defined at a time!
|
||||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||||
#define DIGITAL_LED
|
//#define DIGITAL_LED
|
||||||
//#define RGB_LED
|
//#define RGB_LED
|
||||||
//#define NEOPIXEL_LED
|
#define NEOPIXEL_LED
|
||||||
|
|
||||||
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||||
Adjust following settings for your type of LED
|
Adjust following settings for your type of LED
|
||||||
@@ -39,8 +39,8 @@
|
|||||||
#define LED_DYNAMIC_BRIGHTNESS false // brightness in scan mode depending on packet rate and deauths per second
|
#define LED_DYNAMIC_BRIGHTNESS false // brightness in scan mode depending on packet rate and deauths per second
|
||||||
|
|
||||||
// === Settings for Neopixel LED === //
|
// === Settings for Neopixel LED === //
|
||||||
#define LED_NEOPIXEL_NUM 1
|
#define LED_NEOPIXEL_NUM 12
|
||||||
#define LED_NEOPIXEL_PIN 9
|
#define LED_NEOPIXEL_PIN 14
|
||||||
// if it doesn't work try changing NEO_GRB to NEO_GRBW
|
// if it doesn't work try changing NEO_GRB to NEO_GRBW
|
||||||
#define LED_NEOPIXEL Adafruit_NeoPixel(LED_NEOPIXEL_NUM, LED_NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800)
|
#define LED_NEOPIXEL Adafruit_NeoPixel(LED_NEOPIXEL_NUM, LED_NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800)
|
||||||
|
|
||||||
@@ -51,9 +51,9 @@
|
|||||||
Adjust the pins to match your setup
|
Adjust the pins to match your setup
|
||||||
Comment out the buttons you don't use.
|
Comment out the buttons you don't use.
|
||||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
|
||||||
#define BUTTON_UP 12
|
//#define BUTTON_UP 12
|
||||||
#define BUTTON_DOWN 13
|
//#define BUTTON_DOWN 13
|
||||||
#define BUTTON_A 14
|
//#define BUTTON_A 14
|
||||||
|
|
||||||
//#define BUTTON_LEFT 12
|
//#define BUTTON_LEFT 12
|
||||||
//#define BUTTON_RIGHT 13
|
//#define BUTTON_RIGHT 13
|
||||||
@@ -64,8 +64,8 @@
|
|||||||
Only one of them can be defined at a time!
|
Only one of them can be defined at a time!
|
||||||
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
||||||
*/
|
*/
|
||||||
#define DEAUTHER_DISPLAY SSD1306Wire display = SSD1306Wire(0x3c, 5, 4); // for 0.96" OLED
|
//#define DEAUTHER_DISPLAY SSD1306Wire display = SSD1306Wire(0x3c, 5, 4); // for 0.96" OLED
|
||||||
//#define DEAUTHER_DISPLAY SH1106Wire display = SH1106Wire(0x3c, 5, 4); // for 1.3" OLED
|
#define DEAUTHER_DISPLAY SH1106Wire display = SH1106Wire(0x3c, 13, 12); // for 1.3" OLED
|
||||||
|
|
||||||
/* RST = GPIO 5 (D1)
|
/* RST = GPIO 5 (D1)
|
||||||
DC = GPIO 4 (D2)
|
DC = GPIO 4 (D2)
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
esp8266_deauther/data/web/lang/cs.lang.gz
Normal file
BIN
esp8266_deauther/data/web/lang/cs.lang.gz
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
esp8266_deauther/data/web/lang/fr.lang.gz
Normal file
BIN
esp8266_deauther/data/web/lang/fr.lang.gz
Normal file
Binary file not shown.
BIN
esp8266_deauther/data/web/lang/tlh.lang.gz
Normal file
BIN
esp8266_deauther/data/web/lang/tlh.lang.gz
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -194,6 +194,12 @@ void handleFileList() {
|
|||||||
server.send(200, str(W_JSON).c_str(), output);
|
server.send(200, str(W_JSON).c_str(), output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sendProgmem(const char* ptr, uint32_t size, const char* type) {
|
||||||
|
server.sendHeader(PSTR("Content-Encoding"), PSTR("gzip"));
|
||||||
|
server.sendHeader(PSTR("Cache-Control"), PSTR("max-age=86400"));
|
||||||
|
server.send_P(200, type, ptr, size);
|
||||||
|
}
|
||||||
|
|
||||||
// path = folder of web files, ssid = name of network, password = password ("0" => no password), hidden = if the network is visible, captivePortal = enable a captive portal
|
// path = folder of web files, ssid = name of network, password = password ("0" => no password), hidden = if the network is visible, captivePortal = enable a captive portal
|
||||||
void startAP(String path, String ssid, String password, uint8_t ch, bool hidden, bool captivePortal) {
|
void startAP(String path, String ssid, String password, uint8_t ch, bool hidden, bool captivePortal) {
|
||||||
if (password.length() < 8) {
|
if (password.length() < 8) {
|
||||||
@@ -221,15 +227,85 @@ void startAP(String path, String ssid, String password, uint8_t ch, bool hidden,
|
|||||||
|
|
||||||
server.on(str(W_LIST).c_str(), HTTP_GET, handleFileList); //list directory
|
server.on(str(W_LIST).c_str(), HTTP_GET, handleFileList); //list directory
|
||||||
|
|
||||||
|
|
||||||
|
// ================================================================
|
||||||
|
// post here the output of the webConverter.py
|
||||||
|
|
||||||
|
if (settings.getWebSpiffs()) {
|
||||||
|
server.on(PSTR("/attack.html"), HTTP_GET, []() {
|
||||||
|
sendProgmem(attackhtml, sizeof(attackhtml), PSTR("text/html"));
|
||||||
|
});
|
||||||
|
server.on(PSTR("/index.html"), HTTP_GET, []() {
|
||||||
|
sendProgmem(indexhtml, sizeof(indexhtml), PSTR("text/html"));
|
||||||
|
});
|
||||||
|
server.on(PSTR("/info.html"), HTTP_GET, []() {
|
||||||
|
sendProgmem(infohtml, sizeof(infohtml), PSTR("text/html"));
|
||||||
|
});
|
||||||
|
server.on(PSTR("/scan.html"), HTTP_GET, []() {
|
||||||
|
sendProgmem(scanhtml, sizeof(scanhtml), PSTR("text/html"));
|
||||||
|
});
|
||||||
|
server.on(PSTR("/settings.html"), HTTP_GET, []() {
|
||||||
|
sendProgmem(settingshtml, sizeof(settingshtml), PSTR("text/html"));
|
||||||
|
});
|
||||||
|
server.on(PSTR("/ssids.html"), HTTP_GET, []() {
|
||||||
|
sendProgmem(ssidshtml, sizeof(ssidshtml), PSTR("text/html"));
|
||||||
|
});
|
||||||
|
server.on(PSTR("/style.css"), HTTP_GET, []() {
|
||||||
|
sendProgmem(stylecss, sizeof(stylecss), PSTR("text/css"));
|
||||||
|
});
|
||||||
|
server.on(PSTR("/attack.js"), HTTP_GET, []() {
|
||||||
|
sendProgmem(attackjs, sizeof(attackjs), PSTR("application/javascript"));
|
||||||
|
});
|
||||||
|
server.on(PSTR("/scan.js"), HTTP_GET, []() {
|
||||||
|
sendProgmem(scanjs, sizeof(scanjs), PSTR("application/javascript"));
|
||||||
|
});
|
||||||
|
server.on(PSTR("/settings.js"), HTTP_GET, []() {
|
||||||
|
sendProgmem(settingsjs, sizeof(settingsjs), PSTR("application/javascript"));
|
||||||
|
});
|
||||||
|
server.on(PSTR("/site.js"), HTTP_GET, []() {
|
||||||
|
sendProgmem(sitejs, sizeof(sitejs), PSTR("application/javascript"));
|
||||||
|
});
|
||||||
|
server.on(PSTR("/ssids.js"), HTTP_GET, []() {
|
||||||
|
sendProgmem(ssidsjs, sizeof(ssidsjs), PSTR("application/javascript"));
|
||||||
|
});
|
||||||
|
server.on(PSTR("/cs.lang"), HTTP_GET, []() {
|
||||||
|
sendProgmem(cslang, sizeof(cslang), PSTR("application/json"));
|
||||||
|
});
|
||||||
|
server.on(PSTR("/de.lang"), HTTP_GET, []() {
|
||||||
|
sendProgmem(delang, sizeof(delang), PSTR("application/json"));
|
||||||
|
});
|
||||||
|
server.on(PSTR("/en.lang"), HTTP_GET, []() {
|
||||||
|
sendProgmem(enlang, sizeof(enlang), PSTR("application/json"));
|
||||||
|
});
|
||||||
|
server.on(PSTR("/fr.lang"), HTTP_GET, []() {
|
||||||
|
sendProgmem(frlang, sizeof(frlang), PSTR("application/json"));
|
||||||
|
});
|
||||||
|
server.on(PSTR("/tlh.lang"), HTTP_GET, []() {
|
||||||
|
sendProgmem(tlhlang, sizeof(tlhlang), PSTR("application/json"));
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
server.on(str(W_DEFAULT_LANG).c_str(), HTTP_GET, []() {
|
||||||
|
if (settings.getWebSpiffs()) {
|
||||||
|
if (settings.getLang() == String(F("cs"))) sendProgmem(cslang, sizeof(cslang), PSTR("application/json"));
|
||||||
|
else if (settings.getLang() == String(F("de"))) sendProgmem(delang, sizeof(delang), PSTR("application/json"));
|
||||||
|
else if (settings.getLang() == String(F("en"))) sendProgmem(enlang, sizeof(enlang), PSTR("application/json"));
|
||||||
|
else if (settings.getLang() == String(F("fr"))) sendProgmem(frlang, sizeof(frlang), PSTR("application/json"));
|
||||||
|
else if (settings.getLang() == String(F("tlh"))) sendProgmem(tlhlang, sizeof(tlhlang), PSTR("application/json"));
|
||||||
|
|
||||||
|
else handleFileRead("/web/lang/" + settings.getLang() + ".lang");
|
||||||
|
} else {
|
||||||
|
handleFileRead("/web/lang/" + settings.getLang() + ".lang");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// ================================================================
|
||||||
|
|
||||||
server.on(str(W_RUN).c_str(), HTTP_GET, []() {
|
server.on(str(W_RUN).c_str(), HTTP_GET, []() {
|
||||||
server.send(200, str(W_TXT), str(W_OK).c_str());
|
server.send(200, str(W_TXT), str(W_OK).c_str());
|
||||||
serialInterface.runCommands(server.arg(str(W_CMD).c_str()));
|
serialInterface.runCommands(server.arg(str(W_CMD).c_str()));
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on(str(W_DEFAULT_LANG).c_str(), HTTP_GET, [](){
|
|
||||||
handleFileRead("/web/lang/"+settings.getLang()+".lang");
|
|
||||||
});
|
|
||||||
|
|
||||||
server.on("/attack.json", HTTP_GET, []() {
|
server.on("/attack.json", HTTP_GET, []() {
|
||||||
server.send(200, str(W_JSON), attack.getStatusJSON());
|
server.send(200, str(W_JSON), attack.getStatusJSON());
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ js_files = []
|
|||||||
lang_files = []
|
lang_files = []
|
||||||
progmem_definitions = ""
|
progmem_definitions = ""
|
||||||
copy_files_function = ""
|
copy_files_function = ""
|
||||||
|
webserver_events = ""
|
||||||
|
load_lang = ""
|
||||||
|
|
||||||
filelist = Path(dir).glob('**/*')
|
filelist = Path(dir).glob('**/*')
|
||||||
for x in filelist:
|
for x in filelist:
|
||||||
@@ -88,6 +90,7 @@ for file in html_files:
|
|||||||
hex_formatted_content = hex_formatted_content[:-2]
|
hex_formatted_content = hex_formatted_content[:-2]
|
||||||
progmem_definitions += "const char " + array_name + "[] PROGMEM = {" + hex_formatted_content + "};\n"
|
progmem_definitions += "const char " + array_name + "[] PROGMEM = {" + hex_formatted_content + "};\n"
|
||||||
copy_files_function += ' if(!SPIFFS.exists(String(F("/web/' + base_file + '.gz"))) || force) progmemToSpiffs(' + array_name + ', sizeof(' + array_name + '), String(F("/web/' + base_file + '.gz")));\n'
|
copy_files_function += ' if(!SPIFFS.exists(String(F("/web/' + base_file + '.gz"))) || force) progmemToSpiffs(' + array_name + ', sizeof(' + array_name + '), String(F("/web/' + base_file + '.gz")));\n'
|
||||||
|
webserver_events += 'server.on(PSTR("/' + base_file + '"), HTTP_GET, [](){\n sendProgmem(' + array_name + ', sizeof(' + array_name + '), PSTR("text/html"));\n});\n'
|
||||||
|
|
||||||
for file in css_files:
|
for file in css_files:
|
||||||
base_file = os.path.basename(str(file))
|
base_file = os.path.basename(str(file))
|
||||||
@@ -115,6 +118,7 @@ for file in css_files:
|
|||||||
hex_formatted_content = hex_formatted_content[:-2]
|
hex_formatted_content = hex_formatted_content[:-2]
|
||||||
progmem_definitions += "const char " + array_name + "[] PROGMEM = {" + hex_formatted_content + "};\n"
|
progmem_definitions += "const char " + array_name + "[] PROGMEM = {" + hex_formatted_content + "};\n"
|
||||||
copy_files_function += ' if(!SPIFFS.exists(String(F("/web/' + base_file + '.gz"))) || force) progmemToSpiffs(' + array_name + ', sizeof(' + array_name + '), String(F("/web/' + base_file + '.gz")));\n'
|
copy_files_function += ' if(!SPIFFS.exists(String(F("/web/' + base_file + '.gz"))) || force) progmemToSpiffs(' + array_name + ', sizeof(' + array_name + '), String(F("/web/' + base_file + '.gz")));\n'
|
||||||
|
webserver_events += 'server.on(PSTR("/' + base_file + '"), HTTP_GET, [](){\n sendProgmem(' + array_name + ', sizeof(' + array_name + '), PSTR("text/css"));\n});\n'
|
||||||
|
|
||||||
for file in js_files:
|
for file in js_files:
|
||||||
q = PurePath('js')
|
q = PurePath('js')
|
||||||
@@ -146,6 +150,7 @@ for file in js_files:
|
|||||||
hex_formatted_content = hex_formatted_content[:-2]
|
hex_formatted_content = hex_formatted_content[:-2]
|
||||||
progmem_definitions += "const char " + array_name + "[] PROGMEM = {" + hex_formatted_content + "};\n"
|
progmem_definitions += "const char " + array_name + "[] PROGMEM = {" + hex_formatted_content + "};\n"
|
||||||
copy_files_function += ' if(!SPIFFS.exists(String(F("/web/js/' + base_file + '.gz"))) || force) progmemToSpiffs(' + array_name + ', sizeof(' + array_name + '), String(F("/web/js/' + base_file + '.gz")));\n'
|
copy_files_function += ' if(!SPIFFS.exists(String(F("/web/js/' + base_file + '.gz"))) || force) progmemToSpiffs(' + array_name + ', sizeof(' + array_name + '), String(F("/web/js/' + base_file + '.gz")));\n'
|
||||||
|
webserver_events += 'server.on(PSTR("/' + base_file + '"), HTTP_GET, [](){\n sendProgmem(' + array_name + ', sizeof(' + array_name + '), PSTR("application/javascript"));\n});\n'
|
||||||
|
|
||||||
for file in lang_files:
|
for file in lang_files:
|
||||||
q = PurePath('lang')
|
q = PurePath('lang')
|
||||||
@@ -165,6 +170,7 @@ for file in lang_files:
|
|||||||
content = f_in.read()
|
content = f_in.read()
|
||||||
f_in.close()
|
f_in.close()
|
||||||
array_name = base_file.replace(".", "")
|
array_name = base_file.replace(".", "")
|
||||||
|
lang_name = base_file.replace(".lang", "")
|
||||||
hex_formatted_content = ""
|
hex_formatted_content = ""
|
||||||
hex_content = binascii.hexlify(content)
|
hex_content = binascii.hexlify(content)
|
||||||
hex_content = hex_content.decode("UTF-8")
|
hex_content = hex_content.decode("UTF-8")
|
||||||
@@ -174,6 +180,11 @@ for file in lang_files:
|
|||||||
hex_formatted_content = hex_formatted_content[:-2]
|
hex_formatted_content = hex_formatted_content[:-2]
|
||||||
progmem_definitions += "const char " + array_name + "[] PROGMEM = {" + hex_formatted_content + "};\n"
|
progmem_definitions += "const char " + array_name + "[] PROGMEM = {" + hex_formatted_content + "};\n"
|
||||||
copy_files_function += ' if(!SPIFFS.exists(String(F("/web/lang/' + base_file + '.gz"))) || force) progmemToSpiffs(' + array_name + ', sizeof(' + array_name + '), String(F("/web/lang/' + base_file + '.gz")));\n'
|
copy_files_function += ' if(!SPIFFS.exists(String(F("/web/lang/' + base_file + '.gz"))) || force) progmemToSpiffs(' + array_name + ', sizeof(' + array_name + '), String(F("/web/lang/' + base_file + '.gz")));\n'
|
||||||
|
webserver_events += 'server.on(PSTR("/' + base_file + '"), HTTP_GET, [](){\n sendProgmem(' + array_name + ', sizeof(' + array_name + '), PSTR("application/json"));\n});\n'
|
||||||
|
if(len(load_lang) > 0):
|
||||||
|
load_lang += ' else if(settings.getLang() == String(F("'+lang_name+'"))) sendProgmem(' + array_name + ', sizeof(' + array_name + '), PSTR("application/json"));\n'
|
||||||
|
else:
|
||||||
|
load_lang += ' if(settings.getLang() == String(F("'+lang_name+'"))) sendProgmem(' + array_name + ', sizeof(' + array_name + '), PSTR("application/json"));\n'
|
||||||
|
|
||||||
base_file = os.path.basename(license_file_path)
|
base_file = os.path.basename(license_file_path)
|
||||||
new_file = str(os.path.join(str(compressed), str("LICENSE")))
|
new_file = str(os.path.join(str(compressed), str("LICENSE")))
|
||||||
@@ -219,3 +230,16 @@ f.write("#endif")
|
|||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
print("\n[+] Done, happy uploading :)")
|
print("\n[+] Done, happy uploading :)")
|
||||||
|
print("Here are the updated functions for wifi.h, in case you added or removed files:")
|
||||||
|
print();
|
||||||
|
print('if(settings.getWebSpiffs()){')
|
||||||
|
print(webserver_events)
|
||||||
|
print('}')
|
||||||
|
print("server.on(str(W_DEFAULT_LANG).c_str(), HTTP_GET, [](){")
|
||||||
|
print(" if(settings.getWebSpiffs()){")
|
||||||
|
print(load_lang)
|
||||||
|
print(' else handleFileRead("/web/lang/"+settings.getLang()+".lang");')
|
||||||
|
print(' } else {')
|
||||||
|
print(' handleFileRead("/web/lang/"+settings.getLang()+".lang");')
|
||||||
|
print(' }')
|
||||||
|
print("});");
|
||||||
|
|||||||
Reference in New Issue
Block a user