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

Function legacy_netkb_json

webapp_modern.py:14187–14220  ·  view source on GitHub ↗

Legacy endpoint for network knowledge base JSON - now uses SQLite database

()

Source from the content-addressed store, hash-verified

14185 # Parse channels (list of ints)
14186 raw_channels = personality.get('channels', [])
14187 if isinstance(raw_channels, list):
14188 channels_str = ', '.join(str(c) for c in raw_channels)
14189 else:
14190 channels_str = str(raw_channels)
14191
14192 config = {
14193 'main.name': str(main.get('name', 'pwnagotchi')),
14194 'main.whitelist': whitelist_str,
14195 'personality.advertise': bool(personality.get('advertise', False)),
14196 'personality.deauth': bool(personality.get('deauth', True)),
14197 'personality.associate': bool(personality.get('associate', True)),
14198 'personality.min_rssi': int(personality.get('min_rssi', -200)),
14199 'personality.channels': channels_str,
14200 'ui.invert': bool(ui.get('invert', False)),
14201 'ui.display.enabled': bool(ui_display.get('enabled', True)),
14202 'ui.display.type': str(ui_display.get('type', 'waveshare_4')),
14203 'ui.display.rotation': int(ui_display.get('rotation', 180)),
14204 'ui.web.enabled': bool(ui_web.get('enabled', True)),
14205 'ui.web.address': str(ui_web.get('address', '0.0.0.0')),
14206 'ui.web.username': str(ui_web.get('username', 'ragnar')),
14207 'ui.web.password': str(ui_web.get('password', 'ragnar')),
14208 'ui.web.port': int(ui_web.get('port', 8080)),
14209 'main.plugins.grid.enabled': bool(plugins.get('grid', {}).get('enabled', False)),
14210 'main.plugins.fix_services.enabled': bool(plugins.get('fix_services', {}).get('enabled', False)),
14211 'main.plugins.auto-tune.enabled': bool(plugins.get('auto-tune', {}).get('enabled', True)),
14212 'main.plugins.webcfg.enabled': bool(plugins.get('webcfg', {}).get('enabled', True)),
14213 'main.plugins.memtemp.enabled': bool(plugins.get('memtemp', {}).get('enabled', False)),
14214 }
14215
14216 return jsonify({'success': True, 'config': config})
14217 except Exception as e:
14218 logger.error(f"Error reading Pwnagotchi config: {e}")
14219 return jsonify({'success': False, 'error': str(e)}), 500
14220
14221
14222@app.route('/api/pwnagotchi/config', methods=['POST'])
14223def save_pwnagotchi_config():

Callers

nothing calls this directly

Calls 4

get_all_hostsMethod · 0.80
errorMethod · 0.80
getMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected