Skip to content

Commit

Permalink
Add auto launchers
Browse files Browse the repository at this point in the history
  • Loading branch information
TrustedSec committed Aug 12, 2015
1 parent 0d1c0d8 commit f1e69b1
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 6 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ BYPASS_UPDATE="NO"

AFTER_COMMANDS="cd {INSTALL_LOCATION},ruby install-beef"

LAUNCHER="beef"

###Module Development:

All of the fields are pretty easy, on the repository locations, you can use GIT, SVN or FILE. Fill in the depends, and where you want the install location to be. PTF will take where the python file is located (for example exploitation) and move it to what you specify in the PTF config (located under config). By default it installs all your tools to /pentest/PTES_PHASE/TOOL_FOLDER
Expand All @@ -75,6 +77,12 @@ AFTER_COMMANDS="cp config/dict/rockyou.txt {INSTALL_LOCATION}"

For AFTER_COMMANDS that do self install (don't need user interaction).

###Automatic Launchers

The flag LAUNCHER= in modules is optional. If you add LAUNCHER="setoolkit" for example, PTF will automatically create a launcher for the tool under /usr/local/bin/. In the setoolkit example, when run - PTF will automatically create a file under /usr/local/bin/setoolkit so you can launch SET from anywhere by simply typing setoolkit. All files will still be installed under the appropriate categories, for example /pentest/exploitation/setoolkit however an automatic launcher will be created.

You can have multiple launchers for an application - for example Metasploit you may want msfconsole, msfvenom, etc. etc. In order to add multiple ones, simply put a "," between them. For example LAUNCHER="msfconsole,msfvenom". This would create launchers for both.

#TODO:

* Support other operating systems aside from Kali, Ubuntu, Debian
4 changes: 4 additions & 0 deletions modules/av-bypass/shellter.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@

# COMMANDS TO RUN AFTER
AFTER_COMMANDS="cd {INSTALL_LOCATION},unzip -j -o shellter.zip,rm shellter.zip,echo '#/bin/sh' > shellter.sh,echo 'wine shellter.exe' >> shellter.sh,chmod +x shellter.sh"

# THIS WILL CREATE AN AUTOMATIC LAUNCHER FOR THE TOOL
LAUNCHER="shellter"

3 changes: 3 additions & 0 deletions modules/exploitation/beef.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@

# COMMANDS TO RUN AFTER
AFTER_COMMANDS="cd {INSTALL_LOCATION},gem install bundler,bundle install"

# THIS WILL CREATE AN AUTOMATIC LAUNCHER FOR THE TOOL
LAUNCHER="beef"
4 changes: 4 additions & 0 deletions modules/exploitation/metasploit.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@

# COMMANDS TO RUN AFTER
AFTER_COMMANDS="cd {INSTALL_LOCATION},curl -L https://get.rvm.io | bash -s -- --ignore-dotfiles --autolibs=0 --ruby,source /etc/profile.d/rvm.sh,rvm gemset use global,gem outdated,gem update,rvm use [email protected] --create,gem install rails,rvm gemset use rails4.0,gem install bundler,bundle install"

# THIS WILL CREATE AN AUTOMATIC LAUNCHER FOR THE TOOL
LAUNCHER="msfconsole,msfbinscan,msfpescan,msfvenom,msfd,msfelfscan,msfupdate,msfrpcd,msfrpc,msfrop"

3 changes: 3 additions & 0 deletions modules/exploitation/ridenum.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@

# COMMANDS TO RUN AFTER
AFTER_COMMANDS=""

# THIS WILL CREATE AN AUTOMATIC LAUNCHER FOR THE TOOL
LAUNCHER="ridenum"
3 changes: 3 additions & 0 deletions modules/exploitation/set.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@

# COMMANDS TO RUN AFTER
AFTER_COMMANDS=""

# THIS WILL CREATE AN AUTOMATIC LAUNCHER FOR THE TOOL
LAUNCHER="setoolkit"
4 changes: 4 additions & 0 deletions modules/post-exploitation/unicorn.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@

# COMMANDS TO RUN AFTER
AFTER_COMMANDS=""

# THIS WILL CREATE AN AUTOMATIC LAUNCHER FOR THE TOOL
LAUNCHER="unicorn"

3 changes: 1 addition & 2 deletions ptf
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@ if os.geteuid() != 0:

try:
# Bypass network check with argument
if not "--no-network-check" in sys.argv[1:]:
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.")
print ("[!] You can also run ptf with the --no-network-connection agument to bypass the network check.")
sys.exit()

# try to update ourself first
Expand Down
16 changes: 16 additions & 0 deletions readme/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
~~~~~~~~~~~~~~~~~
version 0.9.6
~~~~~~~~~~~~~~~~~

* fixed --no-network-connection when launching ptf
* removed duplicate print statement for PTF check
* added new module variable called launcher - this will allow you to create automatic launchers in /usr/local/bin when installation completes so you can launch a tool from anywhere - this is an optional flag
* added launcher to SET
* added launcher to Metasploit
* added launcher to BeEF
* added launcher to Responder
* added checks for launcher to see if filetype exists for .rb, .py, .sh, and .pl
* added launcher to unicorn
* added launcher to shellter
* added ability to specify exe, if exe specified, will launch wine

~~~~~~~~~~~~~~~~~
version 0.9.5
~~~~~~~~~~~~~~~~~
Expand Down
59 changes: 57 additions & 2 deletions src/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def count_modules():
return counter

# version information
grab_version = "0.9.3"
grab_version = "0.9.6"

# banner
banner = bcolors.RED + r"""
Expand Down Expand Up @@ -243,6 +243,62 @@ def after_commands(filename,install_location):
after_commands(commands)
print_status("Completed running after commands routine..")

# launcher - create launcher under /usr/local/bin
def launcher(filename, install_location):
launcher = module_parser(filename, "LAUNCHER")
if launcher != "":
# create a launcher if it doesn't exist
if "," in launcher: launcher = launcher.split(",")
for launchers in launcher:
# means theres only one command
if len(launchers) == 1: launchers = launcher

if not os.path.isfile("/usr/local/bin/" + launchers):

# base launcher filename
point = ""

# make sure the actual launcher is there with known filetypes
if os.path.isfile(install_location + "/" + launchers):
# specific launcher file
point = "./" + launchers
file_point = launchers

# check for Python
if os.path.isfile(install_location + "/" + launchers + ".py"):
point = "./" + launchers + ".py"
file_point = launchers + ".py"

# check for Ruby
if os.path.isfile(install_location + "/" + launchers + ".rb"):
point = "./" + launchers + ".rb"
file_point = launchers + ".rb"

# check for Perl - ew Perl. Ew ew ew ew ew ew =)
if os.path.isfile(install_location + "/" + launchers + ".pl"):
point = "./" + launchers + ".pl"
file_point = launchers + ".pl"

# check for bash
if os.path.isfile(install_location + "/" + launchers + ".sh"):
point = "./" + launchers + ".sh"
file_point = launchers + ".sh"

# check of executable, then flag wine
if os.path.isfile(install_location + "/" + launchers + ".exe"):
point = "wine " + launchers + ".exe"
file_point = launchers + ".exe"

# if we found filetype
if point != "":
filewrite = file("/usr/local/bin/" + launchers, "w")
filewrite.write("#!/bin/sh\ncd %s\nchmod +x %s\n%s" % (install_location,file_point,point))
filewrite.close()
subprocess.Popen("chmod +x /usr/local/bin/%s" % (launchers), shell=True).wait()
print_status("Created automatic launcher, you can run the tool from anywhere by typing: " + launchers)

# just need to do this once
if len(launchers) == 1: break

# search functionality here
def search(term):
Expand All @@ -268,5 +324,4 @@ def search(term):
for modules in module_files:
print modules


else: print_warning("Search found no results.")
15 changes: 13 additions & 2 deletions src/framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ def use_module(module, all_trigger):
if prompt != "update":
after_commands(filename,install_location)

# check launcher
launcher(filename, install_location)

if install_type.lower() == "svn":
print_status("Updating the tool, be patient while git pull is initiated.")

Expand All @@ -158,9 +161,13 @@ def use_module(module, all_trigger):
if prompt != "update":
after_commands(filename,install_location)

# check launcher
launcher(filename, install_location)

if not os.path.isdir(install_location):
print_error("The tool was not found in the install location. Try running install first!")


# if we want to install it
if prompt.lower() == "install":
# grab the OS type, DEBIAN, CUSTOM, ETC
Expand All @@ -184,13 +191,15 @@ def use_module(module, all_trigger):
proc = subprocess.Popen("git clone %s %s" % (repository_location, install_location), stderr=subprocess.PIPE, shell=True).wait()
print_status("Finished Installing! Enjoy the tool located under: " + install_location)
after_commands(filename,install_location)
launcher(filename, install_location)

# if we are using svn
if install_type.lower() == "svn":
print_status("SVN was the selected method for installation... Using SVN to install.")
proc = subprocess.Popen("svn co %s %s" % (repository_location, install_location), stderr=subprocess.PIPE, shell=True).wait()
print_status("Finished Installing! Enjoy the tool located under: " + install_location)
after_commands(filename,install_location)
launcher(filename, install_location)

# if we are using file
if install_type.lower() == "file":
Expand All @@ -199,14 +208,16 @@ def use_module(module, all_trigger):
proc = subprocess.Popen('curl -A "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30" -o %s%s %s' % (install_location, repository_file, repository_location), stderr=subprocess.PIPE, shell=True).wait()
print_status("Finished Installing! Enjoy the tool located under: " + install_location)
after_commands(filename,install_location)

launcher(filename, install_location)

# if we are using wget
if install_type.lower() == "wget":
print_status("WGET was the selected method for installation because it plays better that curl -l with Sourceforge.")
proc = subprocess.Popen("cd %s && wget -q %s" % (install_location, repository_location), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).wait()
print_status("Finished Installing! Enjoy the tool located under: " + install_location)
after_commands(filename,install_location)

launcher(filename, install_location)

# if we update all we need to break out until finished
if int(all_trigger) == 1: break

Expand Down

0 comments on commit f1e69b1

Please sign in to comment.