Double Print Fix

This commit is contained in:
Kriyos 2024-02-05 15:22:13 -05:00
parent ccd82d5a3e
commit 940f9e3cc8
5 changed files with 27 additions and 18 deletions

View File

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

4
known_devices.txt Normal file
View File

@ -0,0 +1,4 @@
9C:74:03:8D:90:E0,连朕的手机作甚
AC:C0:48:2B:40:7C,OnePlus Nord N30 5G
F8:94:C2:88:DB:D1,PARASITE
40:1A:58:F7:68:FE,DESKTOP-COM4FUC

Binary file not shown.

Binary file not shown.

View File

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