diff --git a/BlueDucky.py b/BlueDucky.py index fc968ee..5565c3d 100644 --- a/BlueDucky.py +++ b/BlueDucky.py @@ -1,15 +1,9 @@ -import binascii -import bluetooth -import sys -import time +import binascii, bluetooth, sys, time, datetime, logging from multiprocessing import Process from pydbus import SystemBus from enum import Enum -import datetime -import logging -from utils.menu_functions import (main_menu, read_duckyscript, - run, restart_bluetooth_daemon, get_target_address) +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 child_processes = [] @@ -673,4 +667,4 @@ if __name__ == "__main__": try: main() finally: - terminate_child_processes() + terminate_child_processes() \ No newline at end of file diff --git a/utils/__pycache__/menu_functions.cpython-311.pyc b/utils/__pycache__/menu_functions.cpython-311.pyc new file mode 100644 index 0000000..c70b873 Binary files /dev/null and b/utils/__pycache__/menu_functions.cpython-311.pyc differ diff --git a/utils/__pycache__/register_device.cpython-311.pyc b/utils/__pycache__/register_device.cpython-311.pyc new file mode 100644 index 0000000..9943e78 Binary files /dev/null and b/utils/__pycache__/register_device.cpython-311.pyc differ diff --git a/utils/menu_functions.py b/utils/menu_functions.py index e07a1ba..2501b55 100644 --- a/utils/menu_functions.py +++ b/utils/menu_functions.py @@ -1,11 +1,5 @@ -import os +import os, bluetooth,re, subprocess, time, curses import logging as log -import bluetooth -import re -import subprocess -import time -import platform - def get_target_address(): target_address = input("\nWhat is the target address? Leave blank and we will scan for you: ") @@ -89,6 +83,23 @@ def save_devices_to_file(devices, filename='known_devices.txt'): for addr, name in devices: file.write(f"{addr},{name}\n") +def get_yes_no(): + stdscr = curses.initscr() + curses.cbreak() + stdscr.keypad(1) + + while True: + key = stdscr.getch() + if key == ord('y'): + response = 'yes' + break + elif key == ord('n'): + response = 'no' + break + + curses.endwin() + return response + # Function to scan for devices def scan_for_devices(): main_menu() @@ -109,13 +120,11 @@ def scan_for_devices(): print("\nAttempting to scan now...") nearby_devices = bluetooth.discover_devices(duration=8, lookup_names=True, flush_cache=True, lookup_class=True) device_list = [] - if len(nearby_devices) == 0: print("\nNo nearby devices found.") else: print("\nFound {} nearby device(s):".format(len(nearby_devices))) for idx, (addr, name, _) in enumerate(nearby_devices): - print(f"{idx + 1}: Device Name: {name}, Address: {addr}") device_list.append((addr, name)) # Save the scanned devices only if they are not already in known devices @@ -123,6 +132,8 @@ def scan_for_devices(): if new_devices: known_devices += new_devices save_devices_to_file(known_devices) + for idx, (addr, name) in enumerate(new_devices): + print(f"{idx + 1}: Device Name: {name}, Address: {addr}") return device_list def print_menu():