Update BlueDucky.py
This commit is contained in:
parent
3775ce04d7
commit
58730500fb
10
BlueDucky.py
10
BlueDucky.py
|
@ -91,7 +91,7 @@ class PairingAgent:
|
||||||
try:
|
try:
|
||||||
log.debug("Terminating agent process...")
|
log.debug("Terminating agent process...")
|
||||||
self.agent.kill()
|
self.agent.kill()
|
||||||
time.sleep(0.25)
|
time.sleep(2)
|
||||||
log.debug("Agent process terminated.")
|
log.debug("Agent process terminated.")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.error(f"Error terminating agent process: {e}")
|
log.error(f"Error terminating agent process: {e}")
|
||||||
|
@ -231,7 +231,7 @@ class L2CAPClient:
|
||||||
def send_keyboard_report(self, *args):
|
def send_keyboard_report(self, *args):
|
||||||
self.send(self.encode_keyboard_input(*args))
|
self.send(self.encode_keyboard_input(*args))
|
||||||
|
|
||||||
def send_keypress(self, *args, delay=0.004):
|
def send_keypress(self, *args, delay=0.0001):
|
||||||
if args:
|
if args:
|
||||||
log.debug(f"Attempting to send... {args}")
|
log.debug(f"Attempting to send... {args}")
|
||||||
self.send(self.encode_keyboard_input(*args))
|
self.send(self.encode_keyboard_input(*args))
|
||||||
|
@ -361,9 +361,6 @@ def process_duckyscript(client, duckyscript, current_line=0, current_position=0)
|
||||||
except AttributeError as e:
|
except AttributeError as e:
|
||||||
log.warning(f"Attribute error: {e} - Unsupported character '{char}' in Duckyscript")
|
log.warning(f"Attribute error: {e} - Unsupported character '{char}' in Duckyscript")
|
||||||
|
|
||||||
client.send_keypress() # Release after each key press
|
|
||||||
client.send_keypress()
|
|
||||||
|
|
||||||
elif any(mod in line for mod in ["SHIFT", "ALT", "CTRL", "GUI", "COMMAND", "WINDOWS"]):
|
elif any(mod in line for mod in ["SHIFT", "ALT", "CTRL", "GUI", "COMMAND", "WINDOWS"]):
|
||||||
# Process modifier key combinations
|
# Process modifier key combinations
|
||||||
components = line.split()
|
components = line.split()
|
||||||
|
@ -381,8 +378,6 @@ def process_duckyscript(client, duckyscript, current_line=0, current_position=0)
|
||||||
log.warning(f"Invalid combination format: {line}")
|
log.warning(f"Invalid combination format: {line}")
|
||||||
elif line.startswith("ENTER"):
|
elif line.startswith("ENTER"):
|
||||||
client.send_keypress(Key_Codes.ENTER)
|
client.send_keypress(Key_Codes.ENTER)
|
||||||
client.send_keypress() # Release after each key press
|
|
||||||
client.send_keypress()
|
|
||||||
# After processing each line, reset current_position to 0 and increment current_line
|
# After processing each line, reset current_position to 0 and increment current_line
|
||||||
current_position = 0
|
current_position = 0
|
||||||
current_line += 1
|
current_line += 1
|
||||||
|
@ -605,6 +600,7 @@ def main():
|
||||||
try:
|
try:
|
||||||
hid_interrupt_client = setup_and_connect(connection_manager, target_address)
|
hid_interrupt_client = setup_and_connect(connection_manager, target_address)
|
||||||
process_duckyscript(hid_interrupt_client, duckyscript, current_line, current_position)
|
process_duckyscript(hid_interrupt_client, duckyscript, current_line, current_position)
|
||||||
|
time.sleep(2)
|
||||||
break # Exit loop if successful
|
break # Exit loop if successful
|
||||||
except ReconnectionRequiredException as e:
|
except ReconnectionRequiredException as e:
|
||||||
log.info("Reconnection required. Attempting to reconnect...")
|
log.info("Reconnection required. Attempting to reconnect...")
|
||||||
|
|
Loading…
Reference in New Issue