Configure authentication for ZAP scanning
()
| 18186 | def wardriving_bluetooth(): |
| 18187 | """Get discovered Bluetooth devices.""" |
| 18188 | try: |
| 18189 | engine = _get_wardriving_engine() |
| 18190 | session_id = request.args.get('session_id') |
| 18191 | raw_limit = request.args.get('limit') |
| 18192 | limit = _safe_int(raw_limit, None, min_v=1, max_v=5000) if raw_limit is not None else None |
| 18193 | offset = _safe_int(request.args.get('offset'), 0, min_v=0) |
| 18194 | sort_by = request.args.get('sort', 'best_rssi') |
| 18195 | order = request.args.get('order', 'DESC') |
| 18196 | if session_id and (not engine.session or engine.session.session_id != session_id): |
| 18197 | from wardriving import WardrivingSession |
| 18198 | session = WardrivingSession(engine.data_dir, session_id=session_id) |
| 18199 | elif engine.session: |
| 18200 | session = engine.session |
| 18201 | else: |
| 18202 | return jsonify({'devices': [], 'total': 0}) |
| 18203 | devices = session.get_bluetooth_devices(limit=limit, offset=offset, sort_by=sort_by, order=order) |
| 18204 | # total is the whole count (a limited fetch returns fewer), so the app |
| 18205 | # can show "N of M" and know there is more behind the live slice. |
| 18206 | total = session.get_stats().get('bluetooth_devices', len(devices)) |
| 18207 | return jsonify({'devices': devices, 'total': total}) |
| 18208 | except Exception as e: |
| 18209 | return jsonify({'error': str(e)}), 500 |
| 18210 | |
| 18211 | |
| 18212 | @app.route('/api/wardriving/cells') |
| 18213 | def wardriving_cells(): |
| 18214 | """Get discovered cell towers.""" |
| 18215 | try: |
| 18216 | engine = _get_wardriving_engine() |
| 18217 | session_id = request.args.get('session_id') |
| 18218 | if session_id and (not engine.session or engine.session.session_id != session_id): |
| 18219 | from wardriving import WardrivingSession |
| 18220 | session = WardrivingSession(engine.data_dir, session_id=session_id) |
| 18221 | elif engine.session: |
| 18222 | session = engine.session |
| 18223 | else: |
| 18224 | return jsonify({'towers': [], 'total': 0}) |
nothing calls this directly
no test coverage detected