MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / BluetoothPentest

Class BluetoothPentest

actions/ble_pentest.py:44–927  ·  view source on GitHub ↗

Advanced Bluetooth penetration testing capabilities Extends basic Bluetooth functionality with offensive security features

Source from the content-addressed store, hash-verified

42
43
44class BluetoothPentest:
45 """
46 Advanced Bluetooth penetration testing capabilities
47 Extends basic Bluetooth functionality with offensive security features
48 """
49
50 def __init__(self, logger=None):
51 self.logger = logger or logging.getLogger(__name__)
52 self.running = False
53 self.discovered_beacons = {}
54 self.tracked_devices = {}
55 self.exfiltrated_data = {}
56 self.attack_results = {}
57
58 # Check for required dependencies
59 if not HAS_PYBLUEZ:
60 self.logger.warning("PyBluez not installed. Some features will be limited.")
61 self.logger.info("Install with: pip install pybluez")
62
63 self.logger.info("BluetoothPentest module initialized")
64
65 # ============================================================================
66 # BEACON TRACKING (iBeacon, Eddystone, etc.)
67 # ============================================================================
68
69 def start_beacon_tracking(self, duration: int = 60) -> Dict[str, Any]:
70 """
71 Track Bluetooth beacons (iBeacon, Eddystone, AltBeacon)
72 Useful for tracking people/devices via beacon advertisements
73
74 Args:
75 duration: How long to track in seconds
76
77 Returns:
78 Dictionary of discovered beacons with their data
79 """
80 self.logger.info(f"Starting beacon tracking for {duration} seconds...")
81
82 beacons = {}
83 start_time = time.time()
84
85 try:
86 # Use hcitool and hcidump to capture BLE advertisements
87 # This requires root/sudo privileges
88
89 # Start hcidump in background to capture advertisements
90 hcidump_cmd = ['hcidump', '--raw']
91 proc = subprocess.Popen(
92 hcidump_cmd,
93 stdout=subprocess.PIPE,
94 stderr=subprocess.PIPE,
95 text=True
96 )
97
98 self.logger.info("Capturing BLE advertisements...")
99
100 # Parse hcidump output for beacon data
101 while time.time() - start_time < duration:

Callers 3

webapp_modern.pyFile · 0.90
__init__Method · 0.85
ble_pentest.pyFile · 0.85

Calls

no outgoing calls

Tested by 1

__init__Method · 0.68