From d1b8129d0dabcd301a042c4da21f8e5e59b65751 Mon Sep 17 00:00:00 2001
From: llorencroma <52706876+llorencroma@users.noreply.github.com>
Date: Fri, 18 Jul 2025 09:49:23 +0200
Subject: [PATCH] add button to download all filtered shells
---
 index.html   |  3 +++
 js/script.js | 44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)
diff --git a/index.html b/index.html
index 9f94b85..e953fd8 100644
--- a/index.html
+++ b/index.html
@@ -244,6 +244,9 @@ 
Listener
                             Show Advanced
                         
                          +                        
                     
                     
                 
diff --git a/js/script.js b/js/script.js
index 42f918a..e0716c5 100644
--- a/js/script.js
+++ b/js/script.js
@@ -166,6 +166,45 @@ const rsg = {
         }
     },
 
+    downloadAllShells: () => {
+        const filteredItems = filterCommandData(
+            rsgData.reverseShellCommands,
+            {
+                filterOperatingSystem: rsg.filterOperatingSystem,
+                filterText: rsg.filterText,
+                commandType: rsg.commandType
+            }
+        );
+
+        if (filteredItems.length === 0) {
+            return;
+        }
+
+        let content = '';
+
+        filteredItems.forEach((item, index) => {
+            const tempSelectedValue = rsg.selectedValues[rsg.commandType];
+            rsg.selectedValues[rsg.commandType] = item.name;
+            const command = rsg.insertParameters(item.command, (text) => text);
+            rsg.selectedValues[rsg.commandType] = tempSelectedValue;
+            
+            content += command;
+            if (index < filteredItems.length - 1) {
+                content += '\n-----\n';
+            }
+        });
+
+        const blob = new Blob([content], { type: 'text/plain' });
+        const url = URL.createObjectURL(blob);
+        const a = document.createElement('a');
+        a.href = url;
+        a.download = `reverse-shells-${rsg.filterOperatingSystem}-${rsg.commandType}.txt`;
+        document.body.appendChild(a);
+        a.click();
+        document.body.removeChild(a);
+        URL.revokeObjectURL(url);
+    },
+
     escapeHTML: (text) => {
         let element = document.createElement('p');
         element.textContent = text;
@@ -545,6 +584,11 @@ for (const Dbutton of downloadButton) {
     });
 }
 
+// Add event listener for download all shells button
+document.getElementById("download-all-shells").addEventListener("click", () => {
+    rsg.downloadAllShells();
+});
+
 // autoCopySwitch.addEventListener("change", () => {
 //     setLocalStorage(autoCopySwitch, "auto-copy", "checked");
 // });
+                        
                     
                     
                 
diff --git a/js/script.js b/js/script.js
index 42f918a..e0716c5 100644
--- a/js/script.js
+++ b/js/script.js
@@ -166,6 +166,45 @@ const rsg = {
         }
     },
 
+    downloadAllShells: () => {
+        const filteredItems = filterCommandData(
+            rsgData.reverseShellCommands,
+            {
+                filterOperatingSystem: rsg.filterOperatingSystem,
+                filterText: rsg.filterText,
+                commandType: rsg.commandType
+            }
+        );
+
+        if (filteredItems.length === 0) {
+            return;
+        }
+
+        let content = '';
+
+        filteredItems.forEach((item, index) => {
+            const tempSelectedValue = rsg.selectedValues[rsg.commandType];
+            rsg.selectedValues[rsg.commandType] = item.name;
+            const command = rsg.insertParameters(item.command, (text) => text);
+            rsg.selectedValues[rsg.commandType] = tempSelectedValue;
+            
+            content += command;
+            if (index < filteredItems.length - 1) {
+                content += '\n-----\n';
+            }
+        });
+
+        const blob = new Blob([content], { type: 'text/plain' });
+        const url = URL.createObjectURL(blob);
+        const a = document.createElement('a');
+        a.href = url;
+        a.download = `reverse-shells-${rsg.filterOperatingSystem}-${rsg.commandType}.txt`;
+        document.body.appendChild(a);
+        a.click();
+        document.body.removeChild(a);
+        URL.revokeObjectURL(url);
+    },
+
     escapeHTML: (text) => {
         let element = document.createElement('p');
         element.textContent = text;
@@ -545,6 +584,11 @@ for (const Dbutton of downloadButton) {
     });
 }
 
+// Add event listener for download all shells button
+document.getElementById("download-all-shells").addEventListener("click", () => {
+    rsg.downloadAllShells();
+});
+
 // autoCopySwitch.addEventListener("change", () => {
 //     setLocalStorage(autoCopySwitch, "auto-copy", "checked");
 // });