Skip to content

Commit 22e32d4

Browse files
committed
added badusb support in the webui (pr3y#107)
1 parent 7a7e9f3 commit 22e32d4

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/modules/others/webInterface.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ String listFiles(FS fs, bool ishtml, String folder, bool isLittleFS) {
132132
//if (String(foundfile.name()).substring(String(foundfile.name()).lastIndexOf('.') + 1).equalsIgnoreCase("bin")) returnText+= "<i class=\"gg-arrow-up-r\" onclick=\"startUpdate(\'" + String(foundfile.path()) + "\')\"></i>&nbsp&nbsp\n";
133133
if (String(foundfile.name()).substring(String(foundfile.name()).lastIndexOf('.') + 1).equalsIgnoreCase("sub")) returnText+= "<i class=\"gg-arrow-up-r\" onclick=\"sendSubFile(\'" + String(foundfile.path()) + "\')\"></i>&nbsp&nbsp\n";
134134
if (String(foundfile.name()).substring(String(foundfile.name()).lastIndexOf('.') + 1).equalsIgnoreCase("ir")) returnText+= "<i class=\"gg-arrow-up-r\" onclick=\"sendIrFile(\'" + String(foundfile.path()) + "\')\"></i>&nbsp&nbsp\n";
135+
#if defined(USB_as_HID)
136+
if (String(foundfile.name()).substring(String(foundfile.name()).lastIndexOf('.') + 1).equalsIgnoreCase("txt")) returnText+= "<i class=\"gg-arrow-up-r\" onclick=\"sendBadusbFile(\'" + String(foundfile.path()) + "\')\"></i>&nbsp&nbsp\n";
137+
#endif
135138
returnText += "<i class=\"gg-rename\" onclick=\"renameFile(\'" + String(foundfile.path()) + "\', \'" + String(foundfile.name()) + "\')\"></i>&nbsp&nbsp\n";
136139
returnText += "<i class=\"gg-trash\" onclick=\"downloadDeleteButton(\'" + String(foundfile.path()) + "\', \'delete\')\"></i></td></tr>\n\n";
137140
} else {

src/modules/others/webInterface.h

+14
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,20 @@ function sendSubFile(filePath) {
448448
listFilesButton(actualFolder, fs, true);
449449
}
450450

451+
function sendBadusbFile(filePath) {
452+
if(!confirm("Confirm executing the selected DuckyScript on the machine connected via USB?")) return;
453+
var actualFolder = document.getElementById("actualFolder").value;
454+
var fs = document.getElementById("actualFS").value;
455+
const ajax5 = new XMLHttpRequest();
456+
const formdata5 = new FormData();
457+
formdata5.append("cmnd", "badusb tx_from_file " + filePath);
458+
ajax5.open("POST", "/cm", false);
459+
ajax5.send(formdata5);
460+
document.getElementById("status").innerHTML = ajax5.responseText;
461+
var fs = document.getElementById("actualFS").value;
462+
listFilesButton(actualFolder, fs, true);
463+
}
464+
451465
function downloadDeleteButton(filename, action) {
452466
var fs = document.getElementById("actualFS").value;
453467
var urltocall = "/file?name=" + filename + "&action=" + action + "&fs=" + fs;

0 commit comments

Comments
 (0)