Skip to content

Commit

Permalink
Airgraph-ng: Fixed downloading OUI file with Python3
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-X- committed Dec 1, 2020
1 parent 2451425 commit 8259703
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions scripts/airgraph-ng/airgraphviz/libOuiParse.py
Expand Up @@ -25,7 +25,7 @@
import re
import sys
if sys.version_info[0] >= 3:
import urllib.request, urllib.parse, urllib.error
import requests
else:
import urllib
import os
Expand Down Expand Up @@ -178,7 +178,12 @@ def ouiUpdate(self):
"""
try:
print(("Getting OUI file from %s to %s" %(self.ouiTxtUrl, path)))
urllib.request.urlretrieve(self.ouiTxtUrl, path + "oui.txt")
if sys.version_info[0] == 2:
urllib.request.urlretrieve(self.ouiTxtUrl, path + "oui.txt")
else:
response = requests.get(self.ouiTxtUrl)
with open(path + "oui.txt", "wb") as file:
bytes_written = file.write(response.content)
print("Completed Successfully")
except Exception as error:
print(("Could not download file:\n %s\n Exiting airgraph-ng" %(error)))
Expand Down

0 comments on commit 8259703

Please sign in to comment.