mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-30 20:43:02 +02:00
yanger: Allow to read back SSIDs encoded with utf-8
This commit is contained in:
@@ -97,7 +97,7 @@ def main():
|
||||
common.LOG.warning("Unsupported model %s", args.model)
|
||||
sys.exit(1)
|
||||
|
||||
print(json.dumps(yang_data, indent=2))
|
||||
print(json.dumps(yang_data, indent=2, ensure_ascii=False))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -122,9 +122,15 @@ def parse_wpa_scan_result(scan_output):
|
||||
|
||||
flags = parts[3].strip()
|
||||
ssid = parts[4].strip() if len(parts) > 4 else ""
|
||||
try:
|
||||
ssid = ssid.encode().decode('unicode_escape').encode('latin-1').decode('utf-8')
|
||||
except (UnicodeDecodeError, UnicodeEncodeError):
|
||||
pass
|
||||
# Strip control chars (terminal injection risk from rogue APs)
|
||||
ssid = ''.join(c for c in ssid if c.isprintable())
|
||||
|
||||
# Skip hidden SSIDs (empty or null-filled)
|
||||
if not ssid or ssid.isspace() or '\\x00' in ssid:
|
||||
if not ssid or ssid.isspace():
|
||||
continue
|
||||
|
||||
encryption = extract_encryption(flags)
|
||||
|
||||
Reference in New Issue
Block a user