diff --git a/Source Code/esprfidtool/WiegandNG.cpp b/Source Code/esprfidtool/WiegandNG.cpp index d3d8653..8866081 100644 --- a/Source Code/esprfidtool/WiegandNG.cpp +++ b/Source Code/esprfidtool/WiegandNG.cpp @@ -86,13 +86,13 @@ bool WiegandNG::available() { return ret; } -void WiegandNG::ReadD0 () { +ICACHE_RAM_ATTR void WiegandNG::ReadD0 () { _bitCounted++; // increment bit count for Interrupt connected to D0 shift_left(_buffer,_bufferSize,1); // shift 0 into buffer _lastPulseTime = millis(); // keep track of time last wiegand bit received } -void WiegandNG::ReadD1() { +ICACHE_RAM_ATTR void WiegandNG::ReadD1() { _bitCounted++; // increment bit count for Interrupt connected to D1 if (_bitCounted > (_bufferSize * 8)) { _bitCounted=0; // overflowed, diff --git a/Source Code/esprfidtool/aba2str.h b/Source Code/esprfidtool/aba2str.h index 57ee4b9..09142c3 100644 --- a/Source Code/esprfidtool/aba2str.h +++ b/Source Code/esprfidtool/aba2str.h @@ -1,12 +1,9 @@ String aba2str (String magstripe, int magStart, int magEnd, String swipeDirection) { - //f.println(String()+"Start pos:"+magStart); - //f.println(String()+"Start pos:"+magEnd); String ABA=""; String aba2str=""; int magCount=abs(magEnd-magStart); - //f.println(String()+"magCount:"+magCount); aba2str=(String()+"\"Cleaned\" Binary:"+magstripe.substring(magStart,magEnd)+"\n"); - aba2str+=(String()+" * Possible "+swipeDirection+" Card Data\(ASCII\):"); + aba2str+=(String()+" * Possible "+swipeDirection+" Card Data(ASCII):"); while (magCount>0) { ABA=magstripe.substring(magStart,magStart+4); if (ABA=="1101") {aba2str+=(";");} diff --git a/Source Code/esprfidtool/api.h b/Source Code/esprfidtool/api.h index 952d0fe..657ebae 100644 --- a/Source Code/esprfidtool/api.h +++ b/Source Code/esprfidtool/api.h @@ -39,14 +39,12 @@ void apiinfo(int prettify) { String freespace; freespace=fs_info.totalBytes-fs_info.usedBytes; - const size_t bufferSize = JSON_ARRAY_SIZE(5) + JSON_OBJECT_SIZE(3); - DynamicJsonBuffer jsonAPIbuffer(bufferSize); - JsonObject& apilog = jsonAPIbuffer.createObject(); + DynamicJsonDocument apilog(1024); apilog["Device"] = "ESP-RFID-Tool"; apilog["Firmware"] = version; apilog["API"] = APIversion; - JsonObject& apifs = apilog.createNestedObject("File System"); + JsonObject apifs = apilog.createNestedObject("File System"); apifs["Total Space"]=total; apifs["Used Space"]=used; apifs["Free Space"]=freespace; @@ -54,14 +52,15 @@ void apiinfo(int prettify) { String API_Response=""; if (prettify==1) { - apilog.prettyPrintTo(API_Response); + serializeJsonPretty(apilog, API_Response); } else { - apilog.printTo(API_Response); + serializeJson(apilog, API_Response); } server.send(200, "application/json", API_Response); delay(50); - jsonAPIbuffer.clear(); + apifs.clear(); + apilog.clear(); } void apilistlogs(int prettify) { @@ -72,15 +71,13 @@ void apilistlogs(int prettify) { while (dir.next()) { File f = dir.openFile("r"); String FileName = dir.fileName(); - if((!FileName.startsWith("/payloads/"))&&(!FileName.startsWith("/esploit.json"))&&(!FileName.startsWith("/esportal.json"))&&(!FileName.startsWith("/esprfidtool.json"))&&(!FileName.startsWith("/config.json"))) { + if((!FileName.startsWith("/esprfidtool.json"))&&(!FileName.startsWith("/config.json"))) { logcount++; } f.close(); } - const size_t bufferSize = JSON_ARRAY_SIZE(5) + JSON_OBJECT_SIZE(1); - DynamicJsonBuffer jsonAPIbuffer(bufferSize); - JsonObject& apilog = jsonAPIbuffer.createObject(); + DynamicJsonDocument apilog(1024); apilog["Device"] = "ESP-RFID-Tool"; apilog["Firmware"] = version; @@ -92,10 +89,10 @@ void apilistlogs(int prettify) { while (dir2ndrun.next()) { File f = dir2ndrun.openFile("r"); String FileName = dir2ndrun.fileName(); - if ((!FileName.startsWith("/payloads/"))&&(!FileName.startsWith("/esploit.json"))&&(!FileName.startsWith("/esportal.json"))&&(!FileName.startsWith("/esprfidtool.json"))&&(!FileName.startsWith("/config.json"))) { + if ((!FileName.startsWith("/esprfidtool.json"))&&(!FileName.startsWith("/config.json"))) { currentlog++; FileName.remove(0,1); - JsonObject& apilistlogs = apilog.createNestedObject(String(currentlog)); + JsonObject apilistlogs = apilog.createNestedObject(String(currentlog)); apilistlogs["File Name"]=FileName; } f.close(); @@ -103,14 +100,14 @@ void apilistlogs(int prettify) { String API_Response=""; if (prettify==1) { - apilog.prettyPrintTo(API_Response); + serializeJsonPretty(apilog, API_Response); } else { - apilog.printTo(API_Response); + serializeJson(apilog, API_Response);; } server.send(200, "application/json", API_Response); delay(50); - jsonAPIbuffer.clear(); + apilog.clear(); } void apilog(String logfile,int prettify) { @@ -131,33 +128,35 @@ void apilog(String logfile,int prettify) { } } f.close(); - const size_t bufferSize = JSON_ARRAY_SIZE(6) + JSON_OBJECT_SIZE(4); - DynamicJsonBuffer jsonAPIbuffer(bufferSize); - JsonObject& apilog = jsonAPIbuffer.createObject(); + DynamicJsonDocument apilog(2048); apilog["Device"] = "ESP-RFID-Tool"; apilog["Firmware"] = version; apilog["API"] = APIversion; apilog["Log File"] = logfile; - apilog["Captures"] = apiCAPTUREcount; + apilog["CaptureCount"] = apiCAPTUREcount; + + JsonArray captures = apilog.createNestedArray("Captures"); int apiCURRENTcapture=0; File f = SPIFFS.open(String()+"/"+logfile, "r"); + DynamicJsonDocument apiCURRENTcaptureOBJECT(1024); + while(f.available()) { String line = f.readStringUntil('\n'); - if(line.indexOf(",Binary:") > 0) { + int firstIndex = line.indexOf(",Binary:"); + + if(firstIndex > -1) { apiCURRENTcapture++; - int firstIndex = line.indexOf(",Binary:"); int secondIndex = line.indexOf(",", firstIndex + 1); String binaryCaptureLINE=line.substring(firstIndex+8, secondIndex); if ( binaryCaptureLINE.indexOf(" ") > 0 ) { binaryCaptureLINE=binaryCaptureLINE.substring(binaryCaptureLINE.indexOf(" ")+1); } binaryCaptureLINE.replace("\r",""); - JsonObject& apiCURRENTcaptureOBJECT = apilog.createNestedObject(String(apiCURRENTcapture)); - apiCURRENTcaptureOBJECT["Bit Count"]=binaryCaptureLINE.length(); - apiCURRENTcaptureOBJECT["Binary"]=binaryCaptureLINE; + apiCURRENTcaptureOBJECT["Bit Count"] = binaryCaptureLINE.length(); + apiCURRENTcaptureOBJECT["Binary"] = binaryCaptureLINE; if(line.indexOf(",HEX:") > 0) { int hfirstIndex = line.indexOf(",HEX:"); int hsecondIndex = line.indexOf(",", hfirstIndex + 1); @@ -168,22 +167,24 @@ void apilog(String logfile,int prettify) { if(line.indexOf(",Keypad Code:") > 0) { int kfirstIndex = line.indexOf(",Keypad Code:"); int ksecondIndex = line.indexOf(",", kfirstIndex + 1); - String pinCURRENT=line.substring(kfirstIndex+13, ksecondIndex); + String pinCURRENT = line.substring(kfirstIndex + 13, ksecondIndex); pinCURRENT.replace("\r",""); - apiCURRENTcaptureOBJECT["Keypad Press"]=pinCURRENT; + apiCURRENTcaptureOBJECT["Keypad Press"] = pinCURRENT; } + + captures.add(apiCURRENTcaptureOBJECT); } } f.close(); String API_Response=""; if (prettify==1) { - apilog.prettyPrintTo(API_Response); + serializeJsonPretty(apilog, API_Response); } else { - apilog.printTo(API_Response); + serializeJson(apilog, API_Response);; } server.send(200, "application/json", API_Response); delay(50); - jsonAPIbuffer.clear(); + apilog.clear(); } } diff --git a/Source Code/esprfidtool/api_server.h b/Source Code/esprfidtool/api_server.h index bb0c9f1..f419858 100644 --- a/Source Code/esprfidtool/api_server.h +++ b/Source Code/esprfidtool/api_server.h @@ -20,15 +20,13 @@ server.on("/api/tx/bin", [](){ prettify=1; } - const size_t bufferSize = JSON_ARRAY_SIZE(4) + JSON_OBJECT_SIZE(5); - DynamicJsonBuffer jsonAPIbuffer(bufferSize); - JsonObject& apitxbin = jsonAPIbuffer.createObject(); + DynamicJsonDocument apitxbin(1024); apitxbin["Device"] = "ESP-RFID-Tool"; apitxbin["Firmware"] = version; apitxbin["API"] = APIversion; - JsonObject& apitxbinary = apitxbin.createNestedObject("Transmission"); + JsonObject apitxbinary = apitxbin.createNestedObject("Transmission"); int commacount=0; for (int commalook=0; commalook<=api_binary.length(); commalook++) { if (api_binary.charAt(commalook)==',') { @@ -52,14 +50,15 @@ server.on("/api/tx/bin", [](){ else { String API_Response=""; if (prettify==1) { - apitxbin.prettyPrintTo(API_Response); + serializeJsonPretty(apitxbin, API_Response); } else { - apitxbin.printTo(API_Response); + serializeJson(apitxbin, API_Response); } server.send(200, "application/json", API_Response); delay(50); - jsonAPIbuffer.clear(); + apitxbinary.clear(); + apitxbin.clear(); apiTX(api_binary,api_pulsewidth,api_datainterval,api_wait); } }); diff --git a/Source Code/esprfidtool/esprfidtool.ino b/Source Code/esprfidtool/esprfidtool.ino index ed08978..80f8d2f 100644 --- a/Source Code/esprfidtool/esprfidtool.ino +++ b/Source Code/esprfidtool/esprfidtool.ino @@ -36,7 +36,7 @@ #include #include #include -#include // ArduinoJson library 5.11.0 by Benoit Blanchon https://github.com/bblanchon/ArduinoJson +#include // ArduinoJson library 6.19.4 by Benoit Blanchon https://github.com/bblanchon/ArduinoJson #include // https://github.com/exploitagency/esp8266FTPServer/tree/feature/bbx10_speedup #include #include @@ -384,6 +384,11 @@ void LogWiegand(WiegandNG &tempwg) { break; } + //This happens on boot so we filter it. + if(unknown && countedBits == 2) { + return; + } + File f = SPIFFS.open("/"+String(logname), "a"); //Open the log in append mode to store capture int preambleLen; if (unknown==true && countedBits!=4 && countedBits!=8 && countedBits!=248) { @@ -568,7 +573,6 @@ void LogWiegand(WiegandNG &tempwg) { int endSentinel=(magstripe.lastIndexOf("11111")+4); int magStart=0; int magEnd=1; - //f.print("
");
   
     f.print(" * Trying \"Forward\" Swipe,");
     magStart=startSentinel;
@@ -579,19 +583,11 @@ void LogWiegand(WiegandNG &tempwg) {
     char magchar[249];
     magstripe.toCharArray(magchar,249);
     magstripe=String(strrev(magchar));
-    //f.println(String()+"Reverse: "+magstripe);
     magStart=magstripe.indexOf("11010");
     magEnd=(magstripe.lastIndexOf("11111")+4);
     f.println(aba2str(magstripe,magStart,magEnd,"\"Reverse\" Swipe"));
-  
-    //f.print("
"); - //f.println(String()+F(" * You can verify the data at the following URL: https://www.legacysecuritygroup.com/aba-decode.php?binary=")+magstripe+F("")); } -//Debug -// f.print(F("Free heap:")); -// f.println(ESP.getFreeHeap(),DEC); - unknown=false; binChunk3=""; binChunk2exists=false; @@ -599,7 +595,7 @@ void LogWiegand(WiegandNG &tempwg) { cardChunk1 = 0; cardChunk2 = 0; binChunk2len=0; - f.close(); //done + f.close(); } #include "api.h" @@ -664,74 +660,132 @@ void settingsPage() "" "" "" - "" + "" "ESP-RFID-Tool Settings" - "" + "" "" "" - "<- BACK TO INDEX

" + "
" + "BACK TO INDEX" "

ESP-RFID-Tool Settings

" - "" + "Restore Default Configuration" "
" "
" - "

" - "WiFi Configuration:

" - "Network Type
" + "

WiFi Configuration

" + "
" + "" + "
" )+ - F("Access Point Mode:
" - "Join Existing Network:

" - "Hidden
" - "Yes
" - "No

" - "SSID:
" - "Password:
" - "Channel:

" - "IP:
" - "Gateway:
" - "Subnet:

" + F("
" + "" + "
" + "
" + "" + "
" + "
" + "" + "
" + "
" + "" + "" + "
" + "
" + "" + "" + "
" + "
" + "" + "" + "
" + "
" + "" + "" + "
" + "
" + "" + "" + "
" + "
" + "" + "" + "
" "
" - "Web Interface Administration Settings:

" - "Username:
" - "Password:

" + "

Web Interface Administration Settings

" + "
" + "" + "" + "
" + "
" + "" + "" + "
" "
" - "FTP Server Settings
" - "Changes require a reboot.
" - "Enabled
" - "Disabled
" - "FTP Username:
" - "FTP Password:

" + "

FTP Server Settings

" + "
" + "Changes require a reboot." + "
" + "
" + "" + "
" + "
" + "" + "" + "
" + "
" + "" + "" + "
" "
" - "Power LED:
" - "Changes require a reboot.
" - "Enabled
" - "Disabled

" + "

Power LED

" + "
" + "Changes require a reboot." + "
" + "
" + "" + "
" "
" - "RFID Capture Log:
" - "Useful to change this value to differentiate between facilities during various security assessments.
" - "File Name:
" + "

RFID Capture Log

" + "
" + "" + "Useful to change this value to differentiate between facilities during various security assessments." + "" + "
" "
" - "Experimental Settings:
" - "Changes require a reboot.
" - "Default Buffer Length is 256 bits with an allowed range of 52-4096 bits." - "
Default Experimental TX mode timing is 40us Wiegand Data Pulse Width and a 2ms Wiegand Data Interval with an allowed range of 0-1000." - "
Changing these settings may result in unstable performance.

" - "Wiegand RX Buffer Length: bit(s)
" - "Wiegand RX Packet Length: millisecond(s)
" - "Experimental TX Wiegand Data Pulse Width: microsecond(s)
" - "Experimental TX Wiegand Data Interval: millisecond(s)
" + "

Experimental Settings

" + "
" + "Changes require a reboot." + "Default Buffer Length is 256 bits with an allowed range of 52-4096 bits. Default Experimental TX mode timing is 40us Wiegand Data Pulse Width and a 2ms Wiegand Data Interval with an allowed range of 0-1000. Changing these settings may result in unstable performance." + "
" + "
" + "" + " bit(s)" + "
" + "
" + "" + " millisecond(s)" + "
" + "
" + "" + " microsecond(s)" + "
" + "
" + "" + " millisecond(s)" + "
" "
" - "Safe Mode:
" - "Enable to reboot the device after every capture.
Disable to avoid missing quick consecutive captures such as keypad entries.

" - "Enabled
" - "Disabled

" + "

Safe Mode

" + "
" + "Enable to reboot the device after every capture. Disable to avoid missing quick consecutive captures such as keypad entries." + "
" + "
" + "" + "
" "
" "" "" "
" - "
" - "

" + "

Reboot Device" + "
" "" "" ) @@ -785,7 +839,7 @@ void handleSubmitSettings() if (SETTINGSvalue == "1") { saveConfig(); - server.send(200, "text/html", F("<- BACK TO INDEX



Settings have been saved.
Some setting may require manually rebooting before taking effect.
If network configuration has changed then be sure to connect to the new network first in order to access the web interface.")); + server.send(200, "text/html", F("
BACK TO INDEX

Reboot Device

Settings have been saved.

Some setting may require manually rebooting before taking effect. If network configuration has changed then be sure to connect to the new network first in order to access the web interface.

")); delay(50); loadConfig(); } @@ -798,8 +852,7 @@ void handleSubmitSettings() } bool loadDefaults() { - StaticJsonBuffer<500> jsonBuffer; - JsonObject& json = jsonBuffer.createObject(); + StaticJsonDocument<500> json; json["version"] = version; json["accesspointmode"] = "1"; json["ssid"] = "ESP-RFID-Tool"; @@ -822,10 +875,11 @@ bool loadDefaults() { json["txdelayms"] = "2"; json["safemode"] = "0"; File configFile = SPIFFS.open("/esprfidtool.json", "w"); - json.printTo(configFile); + serializeJson(json, configFile); configFile.close(); - jsonBuffer.clear(); + json.clear(); loadConfig(); + return true; } bool loadConfig() { @@ -839,8 +893,8 @@ bool loadConfig() { std::unique_ptr buf(new char[size]); configFile.readBytes(buf.get(), size); - StaticJsonBuffer<500> jsonBuffer; - JsonObject& json = jsonBuffer.parseObject(buf.get()); + StaticJsonDocument<500> json; + deserializeJson(json, buf.get()); if (!json["version"]) { delay(3500); @@ -885,60 +939,29 @@ bool loadConfig() { IPAddress subnet; subnet.fromString(subnetstr); -/* - Serial.println(accesspointmode); - Serial.println(ssid); - Serial.println(password); - Serial.println(channel); - Serial.println(hidden); - Serial.println(local_IP); - Serial.println(gateway); - Serial.println(subnet); -*/ WiFi.persistent(false); - //ESP.eraseConfig(); -// Determine if set to Access point mode + if (accesspointmode == 1) { WiFi.disconnect(true); WiFi.mode(WIFI_AP); - -// Serial.print("Starting Access Point ... "); -// Serial.println(WiFi.softAP(ssid, password, channel, hidden) ? "Success" : "Failed!"); WiFi.softAP(ssid, password, channel, hidden); - -// Serial.print("Setting up Network Configuration ... "); -// Serial.println(WiFi.softAPConfig(local_IP, gateway, subnet) ? "Success" : "Failed!"); WiFi.softAPConfig(local_IP, gateway, subnet); - -// WiFi.reconnect(); - -// Serial.print("IP address = "); -// Serial.println(WiFi.softAPIP()); } // or Join existing network else if (accesspointmode != 1) { WiFi.disconnect(true); WiFi.mode(WIFI_STA); -// Serial.print("Setting up Network Configuration ... "); WiFi.config(local_IP, gateway, subnet); -// WiFi.config(local_IP, gateway, subnet); - -// Serial.print("Connecting to network ... "); -// WiFi.begin(ssid, password); WiFi.begin(ssid, password); WiFi.reconnect(); - -// Serial.print("IP address = "); -// Serial.println(WiFi.localIP()); } configFile.close(); - jsonBuffer.clear(); + json.clear(); return true; } bool saveConfig() { - StaticJsonBuffer<500> jsonBuffer; - JsonObject& json = jsonBuffer.createObject(); + StaticJsonDocument<500> json; json["version"] = version; json["accesspointmode"] = accesspointmode; json["ssid"] = ssid; @@ -962,9 +985,9 @@ bool saveConfig() { json["safemode"] = safemode; File configFile = SPIFFS.open("/esprfidtool.json", "w"); - json.printTo(configFile); + serializeJson(json, configFile); configFile.close(); - jsonBuffer.clear(); + json.clear(); return true; } @@ -983,15 +1006,15 @@ void ListLogs(){ String freespace; freespace=fs_info.totalBytes-fs_info.usedBytes; Dir dir = SPIFFS.openDir(directory); - String FileList = String()+F("<- BACK TO INDEX

File System Info Calculated in Bytes
Total: ")+total+" Free: "+freespace+" "+" Used: "+used+"

NOTE: Larger log files will need to be downloaded instead of viewed from the browser.
"; + String FileList = String()+F("
BACK TO INDEX

File System Info (Bytes)

Total: ")+total+F(" | Free: ")+freespace+F(" | Used: ")+used+F("

NOTE: Larger log files will need to be downloaded instead of viewed from the browser.

Display File ContentsSize in BytesDownload FileDelete File
"); while (dir.next()) { String FileName = dir.fileName(); File f = dir.openFile("r"); FileList += " "; - if((!FileName.startsWith("/payloads/"))&&(!FileName.startsWith("/esploit.json"))&&(!FileName.startsWith("/esportal.json"))&&(!FileName.startsWith("/esprfidtool.json"))&&(!FileName.startsWith("/config.json"))) FileList += ""+""; + if((!FileName.startsWith("/payloads/"))&&(!FileName.startsWith("/esploit.json"))&&(!FileName.startsWith("/esportal.json"))&&(!FileName.startsWith("/esprfidtool.json"))&&(!FileName.startsWith("/config.json"))) FileList += ""+""; f.close(); } - FileList += "
Display File ContentsSize in BytesDownload FileDelete File
"+FileName+""+f.size()+"
"+FileName+""+f.size()+"DownloadDelete
"; + FileList += ""; server.send(200, "text/html", FileList); } @@ -1016,27 +1039,36 @@ void ViewLog(){ String webString = f.readString(); f.close(); ShowPL = String()+F( - "" - "<- BACK TO INDEX

" - "List Exfiltrated Data - Experimental TX Mode - Data Conversion Tools

" - "
" - "Binary: " - "
" - "Pulse Width: us " - "Data Interval: us " - "Delay Between Packets: us
" + "

View Log File

BACK TO INDEX

List Exfiltrated Data Experimental TX Mode Data Conversion Tools

Transmit Binary Data

" + "
" + "" + "Use commas to separate the binary for transmitting multiple packets (useful for sending multiple keypresses for imitating keypads)" + "" + "
" + "
" + "" + " us" + "
" + "
" + "" + " us" + "
" + "
" + "" + " us" + "
" "" + "" "" - "Use commas to separate the binary for transmitting multiple packets(useful for sending multiple keypresses for imitating keypads)
" "
" - " - " + "Download File Delete File" "
")
     +payload+
     F("\n"
     "Note: Preambles shown are only a guess based on card length and may not be accurate for every card format.\n"
     "-----\n")
     +webString+
-    F("
") + F("
") ; webString=""; server.send(200, "text/html", ShowPL); @@ -1073,29 +1105,10 @@ void setup() { server.on("/",[]() { FSInfo fs_info; SPIFFS.info(fs_info); - String total; - total=fs_info.totalBytes; - String used; - used=fs_info.usedBytes; - String freespace; - freespace=fs_info.totalBytes-fs_info.usedBytes; - server.send(200, "text/html", String()+F("ESP-RFID-Tool v")+version+F("
" - "
" - "by Corey Harding
" - "www.RFID-Tool.com
" - "www.LegacySecurityGroup.com / www.Exploit.Agency

" - "-----
" - "File System Info Calculated in Bytes
" - "Total: ")+total+" Free: "+freespace+" "+" Used: "+used+F("
-----
" - "List Exfiltrated Data
-
" - "Experimental TX Mode
-
" - "Data Conversion Tools
-
" - "Configure Settings
-
" - "Format File System
-
" - "Upgrade Firmware
-
" - "API Info
-
" - "Help" - "")); + String total = String(fs_info.totalBytes); + String used = String(fs_info.usedBytes); + String freespace = String(fs_info.totalBytes-fs_info.usedBytes); + server.send(200, "text/html", String()+F("")); }); server.onNotFound([]() { @@ -1105,17 +1118,17 @@ void setup() { server.on("/settings", handleSettings); server.on("/firmware", [](){ - server.send(200, "text/html", String()+F("<- BACK TO INDEX

Open Arduino IDE.
Pull down \"Sketch\" Menu then select \"Export Compiled Binary\".
On this page click \"Browse\", select the binary you exported earlier, then click \"Update\".
You may need to manually reboot the device to reconnect.
")); + server.send(200, "text/html", String()+F("
BACK TO INDEX

Firmware Upgrade Instructions:

1. Open Arduino IDE

2. Pull down \"Sketch\" Menu then select \"Export Compiled Binary\"

3. On this page click \"Browse\", select the binary you exported earlier, then click \"Update\"

4. You may need to manually reboot the device to reconnect

")); }); server.on("/restoredefaults", [](){ - server.send(200, "text/html", F("This will restore the device to the default configuration.

Are you sure?

YES - NO")); + server.send(200, "text/html", F("

Restore Default Configuration

This will restore the device to the default configuration.

Are you sure?

YESNO
")); }); server.on("/restoredefaults/yes", [](){ if(!server.authenticate(update_username, update_password)) return server.requestAuthentication(); - server.send(200, "text/html", F("<- BACK TO INDEX

Network
---
SSID: ESP-RFID-Tool

Administration
---
USER: admin PASS: rfidtool")); + server.send(200, "text/html", F("
BACK TO INDEX

Network

SSID: ESP-RFID-Tool

Administration

USER: admin

PASS: rfidtool

")); delay(50); loadDefaults(); ESP.restart(); @@ -1124,7 +1137,7 @@ void setup() { server.on("/deletelog", [](){ String deletelog; deletelog += server.arg(0); - server.send(200, "text/html", String()+F("This will delete the file: ")+deletelog+F(".

Are you sure?

YES - NO")); + server.send(200, "text/html", String()+F("

Delete File

This will delete the file: ")+deletelog+F("

Are you sure?

YESNO
")); }); server.on("/viewlog", ViewLog); @@ -1134,13 +1147,53 @@ void setup() { return server.requestAuthentication(); String deletelog; deletelog += server.arg(0); - if (!deletelog.startsWith("/payloads/")) server.send(200, "text/html", String()+F("<- BACK TO INDEX

List Exfiltrated Data

Deleting file: ")+deletelog); + if (!deletelog.startsWith("/payloads/")) server.send(200, "text/html", String()+F("
BACK TO INDEX

List Exfiltrated Data

Deleting file: ")+deletelog+F("

")); delay(50); SPIFFS.remove(deletelog); }); + server.on("/cardbeep", [](){ + server.send(200, "text/html", String()+F( + "Card Beeper\n" + "

Card Beeper

\n" + "\n\n\n")); + }); + server.on("/format", [](){ - server.send(200, "text/html", F("<- BACK TO INDEX

This will reformat the SPIFFS File System.

Are you sure?

YES - NO")); + server.send(200, "text/html", F("

Format File System

This will reformat the SPIFFS File System.

Are you sure?

YESNO
")); }); server.on("/logs", ListLogs); @@ -1148,7 +1201,7 @@ void setup() { server.on("/reboot", [](){ if(!server.authenticate(update_username, update_password)) return server.requestAuthentication(); - server.send(200, "text/html", F("<- BACK TO INDEX

Rebooting Device...")); + server.send(200, "text/html", F("
BACK TO INDEX

Rebooting Device...

")); delay(50); ESP.restart(); }); @@ -1156,7 +1209,7 @@ void setup() { server.on("/format/yes", [](){ if(!server.authenticate(update_username, update_password)) return server.requestAuthentication(); - server.send(200, "text/html", F("<- BACK TO INDEX

Formatting file system: This may take up to 90 seconds")); + server.send(200, "text/html", F("
BACK TO INDEX

Formatting file system

This may take up to 90 seconds

")); delay(50); // Serial.print("Formatting file system..."); SPIFFS.format(); @@ -1265,29 +1318,39 @@ void setup() { } server.send(200, "text/html", String()+F( - "<- BACK TO INDEX

") + "

Data Conversion Tools

BACK TO INDEX") +dataCONVERSION+ F( "
" + "

Convert ABA Binary Data to ASCII

" "
" - "Convert ABA Binary Data to ASCII:
" - "
" - "
" + "
" + "" + "" + "
" + "" "
" - "
" + "
" + "

Convert Binary Data to Hexadecimal

" "
" - "Convert Binary Data to Hexadecimal:
" - "For use with card cloning, typically includes both the preamble and card data(binary before and after the space in log).
" - "
" - "
" + "
" + "" + "For use with card cloning, typically includes both the preamble and card data (binary before and after the space in log)." + "" + "
" + "" "
" - "
" + "
" + "

Convert Hexadecimal Data to Binary

" "
" - "Convert Hexadecimal Data to Binary:
" - "In some situations you may want to add a leading zero to pad the output to come up with the correct number of bits.
" - "
" - "
" + "
" + "" + "In some situations you may want to add a leading zero to pad the output to come up with the correct number of bits." + "" + "
" + "" "
" + "
" ) ); @@ -1297,12 +1360,12 @@ void setup() { #include "api_server.h" server.on("/stoptx", [](){ - server.send(200, "text/html", F("This will kill any ongoing transmissions.

Are you sure?

YES - NO")); + server.send(200, "text/html", F("

Stop Transmission

This will kill any ongoing transmissions.

Are you sure?

YESNO
")); }); server.on("/stoptx/yes", [](){ TXstatus=0; - server.send(200, "text/html", F("<- BACK TO INDEX

<- BACK TO EXPERIMENTAL TX MODE

All transmissions have been stopped.")); + server.send(200, "text/html", F("
BACK TO INDEX

BACK TO EXPERIMENTAL TX MODE

All transmissions have been stopped.

")); }); server.on("/experimental", [](){ @@ -1354,7 +1417,7 @@ void setup() { } if (server.hasArg("bruteSTART")) { - server.send(200, "text/html", String()+"<- BACK TO INDEX

<- BACK TO EXPERIMENTAL TX MODE

Brute forcing "+pinBITS+"bit Wiegand Format PIN from "+(server.arg("bruteSTART"))+" to "+(server.arg("bruteEND"))+" with a "+pinHTMLDELAY+"ms delay between \"keypresses\"
This may take a while, your device will be busy until the sequence has been completely transmitted!
Please \"STOP CURRENT TRANSMISSION\" before attempting to use your device or simply wait for the transmission to finish.
You can view if the brute force attempt has completed by returning to the Experimental TX page and checking the status located under \"Transmit Status\"

"); + server.send(200, "text/html", String()+F("
BACK TO INDEX

BACK TO EXPERIMENTAL TX MODE

Brute forcing ")+pinBITS+F("bit Wiegand Format PIN

From ")+(server.arg("bruteSTART"))+F(" to ")+(server.arg("bruteEND"))+F(" with a ")+pinHTMLDELAY+F("ms delay between keypresses

This may take a while, your device will be busy until the sequence has been completely transmitted!

Please \"STOP CURRENT TRANSMISSION\" before attempting to use your device or simply wait for the transmission to finish.

You can view if the brute force attempt has completed by returning to the Experimental TX page and checking the status located under \"Transmit Status\"

STOP CURRENT TRANSMISSION
")); delay(50); } @@ -1623,26 +1686,14 @@ void setup() { dos=0; if ((server.arg("fuzzTimes"))=="dos") { dos=1; - server.send(200, "text/html", String()+ - "<- BACK TO INDEX

" - "<- BACK TO EXPERIMENTAL TX MODE

" - "Denial of Service mode active.
Transmitting D0 and D1 bits simultaneously until stopped." - "
This may take a while, your device will be busy until the sequence has been completely transmitted!" - "
Please \"STOP CURRENT TRANSMISSION\" before attempting to use your device or simply wait for the transmission to finish.
" - "You can view if the fuzzing attempt has completed by returning to the Experimental TX page and checking the status located under \"Transmit Status\"

" - ""); + server.send(200, "text/html", String()+F( + "
BACK TO INDEX

BACK TO EXPERIMENTAL TX MODE

Denial of Service mode active.

Transmitting D0 and D1 bits simultaneously until stopped.

This may take a while, your device will be busy until the sequence has been completely transmitted!

Please \"STOP CURRENT TRANSMISSION\" before attempting to use your device or simply wait for the transmission to finish.

You can view if the fuzzing attempt has completed by returning to the Experimental TX page and checking the status located under \"Transmit Status\"

STOP CURRENT TRANSMISSION
")); delay(50); } else { fuzzTimes=server.arg("fuzzTimes").toInt(); - server.send(200, "text/html", String()+ - "<- BACK TO INDEX

" - "<- BACK TO EXPERIMENTAL TX MODE

" - "Transmitting D0 and D1 bits simultaneously "+fuzzTimes+" times." - "
This may take a while, your device will be busy until the sequence has been completely transmitted!" - "
Please \"STOP CURRENT TRANSMISSION\" before attempting to use your device or simply wait for the transmission to finish.
" - "You can view if the fuzzing attempt has completed by returning to the Experimental TX page and checking the status located under \"Transmit Status\"

" - ""); + server.send(200, "text/html", String()+F( + "
BACK TO INDEX

BACK TO EXPERIMENTAL TX MODE

Transmitting D0 and D1 bits simultaneously ")+fuzzTimes+F(" times.

This may take a while, your device will be busy until the sequence has been completely transmitted!

Please \"STOP CURRENT TRANSMISSION\" before attempting to use your device or simply wait for the transmission to finish.

You can view if the fuzzing attempt has completed by returning to the Experimental TX page and checking the status located under \"Transmit Status\"

STOP CURRENT TRANSMISSION
")); delay(50); } @@ -1682,26 +1733,14 @@ void setup() { dos=0; if ((server.arg("fuzzTimes"))=="dos") { dos=1; - server.send(200, "text/html", String()+ - "<- BACK TO INDEX

" - "<- BACK TO EXPERIMENTAL TX MODE

" - "Denial of Service mode active.
Transmitting bits alternating between D0 and D1 until stopped." - "
This may take a while, your device will be busy until the sequence has been completely transmitted!" - "
Please \"STOP CURRENT TRANSMISSION\" before attempting to use your device or simply wait for the transmission to finish.
" - "You can view if the fuzzing attempt has completed by returning to the Experimental TX page and checking the status located under \"Transmit Status\"

" - ""); + server.send(200, "text/html", String()+F( + "
BACK TO INDEX

BACK TO EXPERIMENTAL TX MODE

Denial of Service mode active.

Transmitting bits alternating between D0 and D1 until stopped.

This may take a while, your device will be busy until the sequence has been completely transmitted!

Please \"STOP CURRENT TRANSMISSION\" before attempting to use your device or simply wait for the transmission to finish.

You can view if the fuzzing attempt has completed by returning to the Experimental TX page and checking the status located under \"Transmit Status\"

STOP CURRENT TRANSMISSION
")); delay(50); } else { fuzzTimes=server.arg("fuzzTimes").toInt(); - server.send(200, "text/html", String()+ - "<- BACK TO INDEX

" - "<- BACK TO EXPERIMENTAL TX MODE

" - "Transmitting "+fuzzTimes+" bits alternating between D0 and D1." - "
This may take a while, your device will be busy until the sequence has been completely transmitted!" - "
Please \"STOP CURRENT TRANSMISSION\" before attempting to use your device or simply wait for the transmission to finish.
" - "You can view if the fuzzing attempt has completed by returning to the Experimental TX page and checking the status located under \"Transmit Status\"

" - ""); + server.send(200, "text/html", String()+F( + "
BACK TO INDEX

BACK TO EXPERIMENTAL TX MODE

Transmitting ")+fuzzTimes+F(" bits alternating between D0 and D1.

This may take a while, your device will be busy until the sequence has been completely transmitted!

Please \"STOP CURRENT TRANSMISSION\" before attempting to use your device or simply wait for the transmission to finish.

You can view if the fuzzing attempt has completed by returning to the Experimental TX page and checking the status located under \"Transmit Status\"

STOP CURRENT TRANSMISSION
")); delay(50); } @@ -1739,8 +1778,6 @@ void setup() { wg.clear(); TXstatus=0; dos=0; - - //experimentalStatus=String()+"Transmitting alternating bits: "+binALT; binALT=""; } @@ -1771,19 +1808,19 @@ void setup() { if (pinHTML!="") { String currentPIN=pinHTML; - activeTX="Brute forcing PIN: "+currentPIN+"
"; + activeTX="Brute forcing PIN: "+currentPIN+"
STOP CURRENT TRANSMISSION"; currentPIN=""; } else if (dos==1) { - activeTX="Denial of Service mode active...
"; + activeTX="Denial of Service mode active...
STOP CURRENT TRANSMISSION"; } else { - activeTX="Transmitting...
"; + activeTX="Transmitting...
STOP CURRENT TRANSMISSION"; } } else { - activeTX="INACTIVE
"; + activeTX="INACTIVE
NOTHING TO STOP"; } server.send(200, "text/html", @@ -1792,100 +1829,143 @@ void setup() { "" "" "" + "" "Experimental TX Mode" + "" "" "" - )+experimentalStatus+"

" - +F( - "Transmit Status: ")+activeTX+F("

" - "<- BACK TO INDEX
" - "

" + "

" "

Experimental TX Mode

" + "BACK TO INDEX" + )+experimentalStatus+F("

Transmit Status:

")+activeTX+F("
" + "
" + "

Warning: This mode is highly experimental, use at your own risk!

" + "

Note: Timings for the Wiegand Data Pulse Width and Wiegand Data Interval may be changed on the settings page.

" + "
" "
" - "" - "Warning: This mode is highly experimental, use at your own risk!
" - "Note: Timings for the Wiegand Data Pulse Width and Wiegand Data Interval may be changed on the settings page." - "
" - "
" - "
" - "
" + "

Transmit Binary Data

" "
" - "Binary Data:
" - "Typically no need to include preamble
" - "
" - "
" + "
" + "" + "Typically no need to include preamble" + "" + "
" + "" "
" - "
" "
" - "
" + "

Transmit PIN

" "
" - "Transmit PIN:
" - "Available keys 0-9, * or A, # or B, F1 or C, F2 or D, F3 or E, F4 or F
" - "PIN:
" - "Delay between \"keypresses\": ms
" - " 4bit Wiegand PIN Format " - " 8bit Wiegand PIN Format
" - "
" + "
" + "" + "Available keys 0-9, * or A, # or B, F1 or C, F2 or D, F3 or E, F4 or F" + "" + "
" + "
" + "" + " ms" + "
" + "
" + "
" + "
" + "" + "
" + "" "
" - "
" "
" - "
" + "

Bruteforce PIN

" "
" - "Bruteforce PIN:
" - "Delay between \"keypresses\": ms
" - "Delay between entering complete PINs: ms
" - "PIN begins with character(s):
" - "PIN start position:
" - "PIN end position:
" - "PIN ends with character(s):
" - "NOTE: The advanced timing settings listed below override the \"Delay between entering complete PINs\" setting(listed above) when the conditions listed below are met.
" - "Number of failed PIN attempts(X) before a delay:
" - "Delay in seconds(Y) after [X] failed PINs: s
" - "Multiply delay [Y] by after every failed pin attempts
" - " 4bit Wiegand PIN Format " - " 8bit Wiegand PIN Format
" - "

" - "
" + "
" + "" + " ms" + "
" + "
" + "" + " ms" + "
" + "
" + "" + "" + "
" + "
" + "" + "" + "
" + "
" + "" + "" + "
" + "
" + "" + "" + "
" + "
" + "NOTE: The advanced timing settings listed below override the \"Delay between entering complete PINs\" setting (listed above) when the conditions listed below are met." + "
" + "
" + "" + "" + "
" + "
" + "" + " s" + "
" + "
" + "" + "Multiply delay [Y] by after every failed pin attempts" + "
" + "
" + "
" + "
" + "" + "
" + "" + "" "
" - "
" - "Fuzzing:

" + "

Fuzzing

" "
" - "Number of bits:" - "
" - //" 0, must not be empty \" minlength=\"1\" size=\"32\">
" - " Transmit a bit simultaneously on D0 and D1 (X bits per each line)
" - " Transmit X bits alternating between D0 and D1 each bit (01010101,etc)
" - "
" + "
" + "" + "" + "
" + "
" + "
" + "
" + "" + "
" + "" "
" - "
" "
" - "
" - "Denial Of Service Mode:

" + "

Denial Of Service Mode

" "
" - "Type of Attack:" - "
" - " Transmit a bit simultaneously on D0 and D1 until stopped
" - " Transmit bits alternating between D0 and D1 each bit (01010101,etc) until stopped
" - "
" + "" + "
" + "" + "
" + "
" + "" + "
" + "" "
" - "
" "
" - "
" - "Push Button for Door Open:
" - "Connect \"Push to Open\" wire from the reader to the RX pin(GPIO3) on the programming header on ESP-RFID-Tool.
" - "Warning! Selecting the wrong trigger signal type may cause damage to the connected hardware.

" + "

Push Button for Door Open

" + "
" + "

Connect \"Push to Open\" wire from the reader to the RX pin (GPIO3) on the programming header on ESP-RFID-Tool.

" + "

Warning! Selecting the wrong trigger signal type may cause damage to the connected hardware.

" + "
" "
" - "Time in ms to push the door open button:" - " 0, must not be empty\" minlength=\"1\" size=\"32\">
" - "Does the wire expect a High or Low signal to open the door:" - " Low Signal[Ground] " - " High Signal[3.3V]
" - "
" + "
" + "" + " 0, must not be empty\" minlength=\"1\" style=\"max-width:200px\">" + "
" + "
" + "" + "
" + "
" + "" + "
" + "" "
" - "
" - "
" - "
" - "

" + "
" "" "" ) @@ -1904,8 +1984,6 @@ void setup() { WiFiClient client; client.setNoDelay(1); -// Serial.println("Web Server Started"); - MDNS.begin("ESP"); httpUpdater.setup(&httpServer, update_path, update_username, update_password); @@ -1917,7 +1995,6 @@ void setup() { ftpSrv.begin(String(ftp_username),String(ftp_password)); } -//Start RFID Reader pinMode(LED_BUILTIN, OUTPUT); // LED if (ledenabled==1){ digitalWrite(LED_BUILTIN, LOW); @@ -1927,9 +2004,6 @@ void setup() { } } -// - -//Do It! /////////////////////////////////////////////////////// // LOOP function @@ -1948,9 +2022,6 @@ void loop() } } -//Serial.print("Free heap-"); -//Serial.println(ESP.getFreeHeap(),DEC); - if(wg.available()) { wg.pause(); // pause Wiegand pin interrupts LogWiegand(wg); diff --git a/Source Code/esprfidtool/version.h b/Source Code/esprfidtool/version.h index 2fecc8d..f5e2464 100644 --- a/Source Code/esprfidtool/version.h +++ b/Source Code/esprfidtool/version.h @@ -1,2 +1,2 @@ -String version = "1.2.1"; -String APIversion = "1.0.4"; +String version = "1.3.0"; +String APIversion = "2.0.0";