Skip to content

Commit

Permalink
fixed no-internet-connection and made core python3 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
vdbaan committed Feb 28, 2019
1 parent 2ac3efd commit 8f90346
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
26 changes: 13 additions & 13 deletions ptf
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,20 @@ if __name__ == "__main__":
# create automatic launcher
create_launcher()

# pull in the framework
import src.framework

# if we want to skip going into module
if "--update-all" in sys.argv[1:]:
if "-y" in sys.argv[1:]:
src.framework.handle_prompt("use modules/install_update_all", True)
else:
src.framework.handle_prompt("use modules/install_update_all")
elif "--update-installed" in sys.argv[1:]:
src.framework.handle_prompt("use modules/update_installed")
# pull in the framework
import src.framework

# if we want to skip going into module
if "--update-all" in sys.argv[1:]:
if "-y" in sys.argv[1:]:
src.framework.handle_prompt("use modules/install_update_all", True)
else:
# or just ask what you want
src.framework.mainloop()
src.framework.handle_prompt("use modules/install_update_all")
elif "--update-installed" in sys.argv[1:]:
src.framework.handle_prompt("use modules/update_installed")
else:
# or just ask what you want
src.framework.mainloop()

except KeyboardInterrupt:
print("\n")
Expand Down
17 changes: 12 additions & 5 deletions src/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,18 @@ class bcolors:

# custom parser for zaproxy
def zaproxy():
file = urllib.urlopen('https://raw.githubusercontent.com/zaproxy/zap-admin/master/ZapVersions.xml')
data = file.readlines()
file.close()
for url in data:
if "Linux.tar.gz" in url and "<url>" in url: return url.rstrip().replace("<url>", "").replace("</url>", "").strip()
if sys.version_info > (3,0):
file = urllib.request.urlopen('https://raw.githubusercontent.com/zaproxy/zap-admin/master/ZapVersions.xml')
data = file.readlines()
file.close()
for url in data:
if b'Linux.tar.gz' in url and b'<url>' in url: return url.decode('utf-8').replace("<url>", "").replace("</url>", "").strip()
else:
file = urllib.urlopen('https://raw.githubusercontent.com/zaproxy/zap-admin/master/ZapVersions.xml')
data = file.readlines()
file.close()
for url in data:
if "Linux.tar.gz" in url and "<url>" in url: return url.rstrip().replace("<url>", "").replace("</url>", "").strip()


# get the main SET path
Expand Down

0 comments on commit 8f90346

Please sign in to comment.