From 3ebb8d191497b49af31bb43bb9f22f67d10ed552 Mon Sep 17 00:00:00 2001 From: CarrotRub <95135114+CarrotRub@users.noreply.github.com> Date: Sun, 7 Apr 2024 17:55:23 +0200 Subject: [PATCH] Enhanced payload selection to support multiple options. Allow selection of payloads based on multiple files that are inside the folder "payloads/" --- BlueDucky.py | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/BlueDucky.py b/BlueDucky.py index e18e171..f5b0465 100644 --- a/BlueDucky.py +++ b/BlueDucky.py @@ -2,6 +2,7 @@ import binascii, bluetooth, sys, time, datetime, logging, argparse from multiprocessing import Process from pydbus import SystemBus from enum import Enum +import os from utils.menu_functions import (main_menu, read_duckyscript, run, restart_bluetooth_daemon, get_target_address) from utils.register_device import register_hid_profile, agent_loop @@ -637,8 +638,31 @@ def main(): if not target_address: log.info("No target address provided. Exiting.") return + + script_directory = os.path.dirname(os.path.realpath(__file__)) + payload_folder = os.path.join(script_directory, 'payloads/') # Specify the relative path to the payloads folder. + payloads = os.listdir(payload_folder) - duckyscript = read_duckyscript() + print("\nAvailable payloads:") + for idx, payload_file in enumerate(payloads, 1): # Check and enumerate the files inside the payload folder. + print(f"{idx}: {payload_file}") + + payload_choice = input("\nEnter the number of the payload you want to load: ") + selected_payload = None + + try: + payload_index = int(payload_choice) - 1 + selected_payload = os.path.join(payload_folder, payloads[payload_index]) + except (ValueError, IndexError): + print("Invalid payload choice. No payload selected.") + + if selected_payload is not None: + print(f"Selected payload: {selected_payload}") + duckyscript = read_duckyscript(selected_payload) + else: + print("No payload selected.") + + if not duckyscript: log.info("Payload file not found. Exiting.") return @@ -672,4 +696,4 @@ if __name__ == "__main__": try: main() finally: - terminate_child_processes() \ No newline at end of file + terminate_child_processes()