diff --git a/Source Code/esprfidtool/api.h b/Source Code/esprfidtool/api.h index 69cdf69..952d0fe 100644 --- a/Source Code/esprfidtool/api.h +++ b/Source Code/esprfidtool/api.h @@ -1,4 +1,4 @@ -void apiTX(String apiBIN, int apitxdelayus, int apitxdelayms, int wait) { +void apiTX(String apiBIN, int apipulsewidth, int apidatainterval, int wait) { wg.pause(); digitalWrite(DATA0, HIGH); pinMode(DATA0,OUTPUT); @@ -7,22 +7,21 @@ void apiTX(String apiBIN, int apitxdelayus, int apitxdelayms, int wait) { for (int i=0; i<=apiBIN.length(); i++) { if (apiBIN.charAt(i) == '0') { digitalWrite(DATA0, LOW); - delayMicroseconds(apitxdelayus); + delayMicroseconds(apipulsewidth); digitalWrite(DATA0, HIGH); } else if (apiBIN.charAt(i) == '1') { digitalWrite(DATA1, LOW); - delayMicroseconds(apitxdelayus); + delayMicroseconds(apipulsewidth); digitalWrite(DATA1, HIGH); } if (apiBIN.charAt(i) == ',') { delayMicroseconds(wait); } else { - delay(apitxdelayms); + delayMicroseconds(apidatainterval); } } - yield(); apiBIN=""; pinMode(DATA0, INPUT); pinMode(DATA1, INPUT); diff --git a/Source Code/esprfidtool/api_server.h b/Source Code/esprfidtool/api_server.h index aa66efb..bb0c9f1 100644 --- a/Source Code/esprfidtool/api_server.h +++ b/Source Code/esprfidtool/api_server.h @@ -1,17 +1,17 @@ server.on("/api/tx/bin", [](){ String api_binary=""; - int api_txdelayus=txdelayus; - int api_txdelayms=txdelayms; + int api_pulsewidth=txdelayus; + int api_datainterval=(txdelayms*1000); int prettify=0; int api_wait=100000; if (server.hasArg("binary")) { api_binary=(server.arg("binary")); } if (server.hasArg("pulsewidth")) { - api_txdelayus=(server.arg("pulsewidth").toInt()); + api_pulsewidth=(server.arg("pulsewidth").toInt()); } if (server.hasArg("interval")) { - api_txdelayms=(server.arg("interval").toInt()); + api_datainterval=(server.arg("interval").toInt()); } if (server.hasArg("wait")) { api_wait=(server.arg("wait").toInt()); @@ -29,16 +29,22 @@ server.on("/api/tx/bin", [](){ apitxbin["API"] = APIversion; JsonObject& apitxbinary = apitxbin.createNestedObject("Transmission"); - apitxbinary["Bit Count"]=api_binary.length(); + int commacount=0; + for (int commalook=0; commalook<=api_binary.length(); commalook++) { + if (api_binary.charAt(commalook)==',') { + commacount++; + } + } + apitxbinary["Bit Count"]=api_binary.length()-commacount; apitxbinary["Binary"]=api_binary; - apitxbinary["Wiegand Data Pulse Width"]=String()+api_txdelayus+"us"; - apitxbinary["Wiegand Data Interval"]=String()+api_txdelayms+"ms"; + apitxbinary["Wiegand Data Pulse Width"]=String()+api_pulsewidth+"us"; + apitxbinary["Wiegand Data Interval"]=String()+api_datainterval+"us"; apitxbinary["Delay Between Packets"]=String()+api_wait+"us"; if (api_binary=="") { server.send(200, "text/html", F( "Binary to tx not specified.
" - "Usage: [server]/api/tx/bin?binary=[binary]&pulsewidth=[delay_us]&interval=[delay_ms]&wait=[delay_us_between_packets]
" + "Usage: [server]/api/tx/bin?binary=[binary]&pulsewidth=[delay_us]&interval=[delay_us]&wait=[delay_us_between_packets]
" "Use commas to separate the binary for transmitting multiple packets(useful for sending multiple keypresses for imitating keypads)
" "Example to TX Pin Code 1337# waiting 100,000us between packets(keypresses): /api/tx/bin?binary=11100001,11000011,11000011,10000111,01001011&wait=100000&prettify=1
" )); @@ -53,9 +59,9 @@ server.on("/api/tx/bin", [](){ } server.send(200, "application/json", API_Response); delay(50); - apiTX(api_binary,api_txdelayus,api_txdelayms,api_wait); + jsonAPIbuffer.clear(); + apiTX(api_binary,api_pulsewidth,api_datainterval,api_wait); } - jsonAPIbuffer.clear(); }); server.on("/api/help", [](){ @@ -75,8 +81,8 @@ server.on("/api/help", [](){ "/api/listlogs
" "Usage: [server]/api/listlogs
" "
" - "/api/tx/bin
" - "Usage: [server]/api/tx/bin?binary=[binary]&pulsewidth=[delay_us]&interval=[delay_ms]&wait=[delay_us_between_packets]
" + "/api/tx/bin
" + "Usage: [server]/api/tx/bin?binary=[binary]&pulsewidth=[delay_us]&interval=[delay_us]&wait=[delay_us_between_packets]
" "Use commas to separate the binary for transmitting multiple packets(useful for sending multiple keypresses for imitating keypads)
" "Example to TX Pin Code 1337# waiting 100,000us between packets(keypresses): /api/tx/bin?binary=11100001,11000011,11000011,10000111,01001011&wait=100000&prettify=1
" "
" diff --git a/Source Code/esprfidtool/esprfidtool.ino b/Source Code/esprfidtool/esprfidtool.ino index bd7a71f..ed08978 100644 --- a/Source Code/esprfidtool/esprfidtool.ino +++ b/Source Code/esprfidtool/esprfidtool.ino @@ -1015,7 +1015,29 @@ void ViewLog(){ File f = SPIFFS.open(payload, "r"); String webString = f.readString(); f.close(); - ShowPL = String()+F("<- BACK TO INDEX

List Exfiltrated Data - Experimental TX Mode - Data Conversion Tools

-

Note: Preambles shown are only a guess based on card length and may not be accurate for every card format.
"+payload+"\n-----\n"+webString+"
"; + 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
" + "" + "
" + "Use commas to separate the binary for transmitting multiple packets(useful for sending multiple keypresses for imitating keypads)
" + "
" + " - " + "
")
+    +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("
") + ; webString=""; server.send(200, "text/html", ShowPL); } diff --git a/Source Code/esprfidtool/version.h b/Source Code/esprfidtool/version.h index aa7a360..2fecc8d 100644 --- a/Source Code/esprfidtool/version.h +++ b/Source Code/esprfidtool/version.h @@ -1,2 +1,2 @@ -String version = "1.2.0"; -String APIversion = "1.0.3"; +String version = "1.2.1"; +String APIversion = "1.0.4";