Skip to content
This repository was archived by the owner on Sep 4, 2022. It is now read-only.

Commit eb1b80a

Browse files
Write error/debug to stdout
to avoid putting garbage into json
1 parent b32435c commit eb1b80a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ubnt_discovery.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import argparse
1010
import json
1111
from random import randint
12+
import sys
1213

1314
from scapy.all import (
1415
Ether, IP, UDP, Raw,
@@ -160,7 +161,7 @@ def ubntDiscovery(iface):
160161

161162
if __name__ == '__main__':
162163
args = parse_args()
163-
print("\nDiscovery in progress...")
164+
sys.stderr.write("\nDiscovery in progress...\n")
164165
RadioList = ubntDiscovery(args.interface)
165166
found_radios = len(RadioList)
166167
if args.output_format == 'text':
@@ -175,6 +176,6 @@ def ubntDiscovery(iface):
175176
print(" ESSID : " + Radio['essid'])
176177
print(" MAC Address : " + Radio['mac'])
177178
else:
178-
print("\nNo radios discovered\n")
179+
sys.stderr.write("\n\nNo radios discovered\n")
179180
elif args.output_format == 'json':
180181
print(json.dumps(RadioList, indent=2))

0 commit comments

Comments
 (0)