Skip to content

Commit

Permalink
added badusb support in the webui (pr3y#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
eadmaster committed Aug 4, 2024
1 parent 7a7e9f3 commit 22e32d4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/modules/others/webInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ String listFiles(FS fs, bool ishtml, String folder, bool isLittleFS) {
//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";
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";
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";
#if defined(USB_as_HID)
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";
#endif
returnText += "<i class=\"gg-rename\" onclick=\"renameFile(\'" + String(foundfile.path()) + "\', \'" + String(foundfile.name()) + "\')\"></i>&nbsp&nbsp\n";
returnText += "<i class=\"gg-trash\" onclick=\"downloadDeleteButton(\'" + String(foundfile.path()) + "\', \'delete\')\"></i></td></tr>\n\n";
} else {
Expand Down
14 changes: 14 additions & 0 deletions src/modules/others/webInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,20 @@ function sendSubFile(filePath) {
listFilesButton(actualFolder, fs, true);
}

function sendBadusbFile(filePath) {
if(!confirm("Confirm executing the selected DuckyScript on the machine connected via USB?")) return;
var actualFolder = document.getElementById("actualFolder").value;
var fs = document.getElementById("actualFS").value;
const ajax5 = new XMLHttpRequest();
const formdata5 = new FormData();
formdata5.append("cmnd", "badusb tx_from_file " + filePath);
ajax5.open("POST", "/cm", false);
ajax5.send(formdata5);
document.getElementById("status").innerHTML = ajax5.responseText;
var fs = document.getElementById("actualFS").value;
listFilesButton(actualFolder, fs, true);
}

function downloadDeleteButton(filename, action) {
var fs = document.getElementById("actualFS").value;
var urltocall = "/file?name=" + filename + "&action=" + action + "&fs=" + fs;
Expand Down

0 comments on commit 22e32d4

Please sign in to comment.