forked from trustedsec/ptf
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathptf
More file actions
executable file
·74 lines (61 loc) · 2.48 KB
/
ptf
File metadata and controls
executable file
·74 lines (61 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env python
#######################################################################################
# The PenTesters Framework (PTF) - Automatic Penetration Testing Platform Creation
# Written by: David Kennedy (ReL1K)
# Twitter: @TrustedSec
# Website: https://www.trustedsec.com
#######################################################################################
import sys
import subprocess
import os
import socket
# create launcher
def create_launcher():
if not os.path.isfile("/usr/local/bin/ptf"):
print "[*] Creating an automatic launcher for PTF, you can now call command 'ptf' from anywhere in nix."
cwd = os.getcwd()
filewrite = file("/usr/local/bin/ptf", "w")
filewrite.write("#!/bin/sh\ncd %s\nchmod +x ptf\n./ptf" % (cwd))
filewrite.close()
subprocess.Popen("chmod +x /usr/local/bin/ptf", shell=True).wait()
# check for an Internet connection
def check_internet():
try:
print "[*] Checking for an Internet connection..."
rhost = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
rhost.connect(('google.com', 0))
rhost.settimeout(2)
return 1
except Exception:
return 0
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 ("[!] Unable to detect Internet connection. Needed for PTF.")
print ("[!] We will now exit PTF. Launch again when you got a connection.")
print ("[!] You can also run ptf with the --no-network-connection argument to bypass the network check.")
sys.exit()
# try to update ourself first
print "[*] 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
except KeyboardInterrupt:
print "\n"
print "[*] Exiting PTF - the easy pentest platform creation framework."
exit()
sys.exit()
except Exception, e:
print ("[!] DANGER WILL ROBINSON. DANGER WILL ROBINSON. Error has occured.")
print ("[!] It's not possible its due to my coding skillz, it must be you? :-)")
print ("[!] Printing that error. Get that error. You get it: " + str(e))