Skip to content

Commit

Permalink
scoped main program
Browse files Browse the repository at this point in the history
  • Loading branch information
tpltnt committed Jan 14, 2018
1 parent b44e71c commit d3d5cc3
Showing 1 changed file with 55 additions and 54 deletions.
109 changes: 55 additions & 54 deletions ptf
Original file line number Diff line number Diff line change
Expand Up @@ -40,57 +40,58 @@ def check_internet():
return 0


# some OS doesn't have /usr/local/bin create them if not
if not os.path.isdir("/usr/local/bin/"): os.makedirs("/usr/local/bin/")

if os.geteuid() != 0:
print("\nThe Pentesters Framework (PTF) - by David Kennedy (ReL1K)")
print("\nThis needs to be run as root. Please sudo it up! Exiting...")
exit()

try:

# Bypass network check with argument
if not "--no-network-connection" in sys.argv[1:]:
# check internet connection
if check_internet() == 0:
print_warning("Unable to detect Internet connection. Needed for PTF.")
print_warning("We will now exit PTF. Launch again when you got a connection.")
print_warning("You can also run ptf with the --no-network-connection argument to bypass the network check.")
sys.exit()

# try to update ourself first
print_status("Trying to update myself first.. Then starting framework.")
subprocess.Popen("git pull", shell=True).wait()

# create automatic launcher
create_launcher()

# pull in the core library
from src.core import *

# 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")
else:
# or just ask what you want
src.framework.mainloop()

except KeyboardInterrupt:
print("\n")
print_status("Exiting PTF - the easy pentest platform creation framework.")
exit()
sys.exit()

except Exception as e:
print_error("[!] DANGER WILL ROBINSON. DANGER WILL ROBINSON. Error has occurred.")
print_error("[!] It's not possible its due to my coding skillz, it must be you? :-)")
print_error(("[!] Printing that error. Get that error. You get it: " + str(e)))
if __name__ == "__main__":
# some OS doesn't have /usr/local/bin create them if not
if not os.path.isdir("/usr/local/bin/"):
os.makedirs("/usr/local/bin/")

if os.geteuid() != 0:
print("\nThe Pentesters Framework (PTF) - by David Kennedy (ReL1K)")
print("\nThis needs to be run as root. Please sudo it up! Exiting...")
exit()

try:
# Bypass network check with argument
if not "--no-network-connection" in sys.argv[1:]:
# check internet connection
if check_internet() == 0:
print_warning("Unable to detect Internet connection. Needed for PTF.")
print_warning("We will now exit PTF. Launch again when you got a connection.")
print_warning("You can also run ptf with the --no-network-connection argument to bypass the network check.")
sys.exit()

# try to update ourself first
print_status("Trying to update myself first.. Then starting framework.")
subprocess.Popen("git pull", shell=True).wait()

# create automatic launcher
create_launcher()

# pull in the core library
from src.core import *

# 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")
else:
# or just ask what you want
src.framework.mainloop()

except KeyboardInterrupt:
print("\n")
print_status("Exiting PTF - the easy pentest platform creation framework.")
exit()
sys.exit()

except Exception as e:
print_error("[!] DANGER WILL ROBINSON. DANGER WILL ROBINSON. Error has occurred.")
print_error("[!] It's not possible its due to my coding skillz, it must be you? :-)")
print_error(("[!] Printing that error. Get that error. You get it: " + str(e)))

0 comments on commit d3d5cc3

Please sign in to comment.