Enhanced payload selection to support multiple options.

Allow selection of payloads based on multiple files that are inside the folder "payloads/"
This commit is contained in:
CarrotRub 2024-04-07 17:55:23 +02:00 committed by GitHub
parent bf1fa2e816
commit 3ebb8d1914
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 26 additions and 2 deletions

View File

@ -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()
terminate_child_processes()