Skip to content

Commit

Permalink
Release 1.2.1 - Add TX Mode to API 1.0.4
Browse files Browse the repository at this point in the history
* Add TX mode to API
  * Fine tune TX data interval now that setting is in microseconds(via API only)
  * TX multiple packets(limited by devices RAM)
* TX directly from log file view
  • Loading branch information
exploitagency committed Mar 25, 2018
1 parent c17c795 commit 7050176
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 20 deletions.
9 changes: 4 additions & 5 deletions Source Code/esprfidtool/api.h
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -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);
Expand Down
30 changes: 18 additions & 12 deletions Source Code/esprfidtool/api_server.h
Original file line number Diff line number Diff line change
@@ -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());
Expand All @@ -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.<br>"
"<small>Usage: [server]/api/tx/bin?binary=[binary]&pulsewidth=[delay_us]&interval=[delay_ms]&wait=[delay_us_between_packets]</small><br>"
"<small>Usage: [server]/api/tx/bin?binary=[binary]&pulsewidth=[delay_us]&interval=[delay_us]&wait=[delay_us_between_packets]</small><br>"
"<small>Use commas to separate the binary for transmitting multiple packets(useful for sending multiple keypresses for imitating keypads)</small><br>"
"<small>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</small><br>"
));
Expand All @@ -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", [](){
Expand All @@ -75,8 +81,8 @@ server.on("/api/help", [](){
"<b><a href=\"/api/listlogs?prettify=1\">/api/listlogs</a></b><br>"
"<small>Usage: [server]/api/listlogs</small><br>"
"<br>"
"<b><a href=\"/api/tx/bin?binary=0001&pulsewidth=40&interval=2&prettify=1\">/api/tx/bin</a></b><br>"
"<small>Usage: [server]/api/tx/bin?binary=[binary]&pulsewidth=[delay_us]&interval=[delay_ms]&wait=[delay_us_between_packets]</small><br>"
"<b><a href=\"/api/tx/bin?binary=0001&pulsewidth=40&interval=2000&prettify=1\">/api/tx/bin</a></b><br>"
"<small>Usage: [server]/api/tx/bin?binary=[binary]&pulsewidth=[delay_us]&interval=[delay_us]&wait=[delay_us_between_packets]</small><br>"
"<small>Use commas to separate the binary for transmitting multiple packets(useful for sending multiple keypresses for imitating keypads)</small><br>"
"<small>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</small><br>"
"<br>"
Expand Down
24 changes: 23 additions & 1 deletion Source Code/esprfidtool/esprfidtool.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,29 @@ void ViewLog(){
File f = SPIFFS.open(payload, "r");
String webString = f.readString();
f.close();
ShowPL = String()+F("<html><head></head><body><a href=\"/\"><- BACK TO INDEX</a><br><br><a href=\"/logs\">List Exfiltrated Data</a> - <a href=\"/experimental\">Experimental TX Mode</a> - <a href=\"/data-convert\">Data Conversion Tools</a><br><br><a href=\"")+payload+"\"><button>Download File</button><a> - <a href=\"/deletelog?payload="+payload+"\"><button>Delete File</button></a><br><br><small>Note: Preambles shown are only a guess based on card length and may not be accurate for every card format.</small><br><pre>"+payload+"\n-----\n"+webString+"</pre></body></html>";
ShowPL = String()+F(
"<html><head></head><body>"
"<a href=\"/\"><- BACK TO INDEX</a><br><br>"
"<a href=\"/logs\">List Exfiltrated Data</a> - <a href=\"/experimental\">Experimental TX Mode</a> - <a href=\"/data-convert\">Data Conversion Tools</a><br><br>"
"<FORM action=\"/api/tx/bin\" id=\"api_tx\" method=\"get\" target=\"_blank\">"
"<small>Binary: </small><INPUT form=\"api_tx\" type=\"text\" name=\"binary\" value=\"\" pattern=\"[01,]{1,}\" required title=\"Allowed characters(0,1,\",\"), must not be empty\" minlength=\"1\" size=\"52\"> "
"<INPUT form=\"api_tx\" type=\"submit\" value=\"Transmit\"><br>"
"<small>Pulse Width: </small><INPUT form=\"api_tx\" type=\"number\" name=\"pulsewidth\" value=\"40\" minlength=\"1\" min=\"0\" size=\"8\"><small>us</small> "
"<small>Data Interval: </small><INPUT form=\"api_tx\" type=\"number\" name=\"interval\" value=\"2000\" minlength=\"1\" min=\"0\" size=\"8\"><small>us</small> "
"<small>Delay Between Packets: </small><INPUT form=\"api_tx\" type=\"number\" name=\"wait\" value=\"100000\" minlength=\"1\" min=\"0\" size=\"8\"><small>us</small><br>"
"<INPUT form=\"api_tx\" type=\"hidden\" name=\"prettify\" id=\"prettify\" value=\"1\">"
"</FORM>"
"<small>Use commas to separate the binary for transmitting multiple packets(useful for sending multiple keypresses for imitating keypads)</small><br>"
"<hr>"
"<a href=\"")+payload+F("\"><button>Download File</button><a><small> - </small><a href=\"/deletelog?payload=")+payload+F("\"><button>Delete File</button></a>"
"<pre>")
+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("</pre></body></html>")
;
webString="";
server.send(200, "text/html", ShowPL);
}
Expand Down
4 changes: 2 additions & 2 deletions Source Code/esprfidtool/version.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
String version = "1.2.0";
String APIversion = "1.0.3";
String version = "1.2.1";
String APIversion = "1.0.4";

0 comments on commit 7050176

Please sign in to comment.