The Penetration Testers Framework (PTF) is a way for modular support for up-to-date tools.

Related tags

Testing ptf
Overview

The PenTesters Framework (PTF)

A TrustedSec Project - Copyright 2021

Written by: David Kennedy (@HackingDave)

https://www.trustedsec.com

Twitter: @TrustedSec, @HackingDave

The PenTesters Framework (PTF) is a Python script designed for Debian/Ubuntu/ArchLinux based distributions to create a similar and familiar distribution for Penetration Testing. As pentesters, we've been accustom to the /pentest/ directories or our own toolsets that we want to keep up-to-date all of the time. We have those "go to" tools that we use on a regular basis, and using the latest and greatest is important.

PTF attempts to install all of your penetration testing tools (latest and greatest), compile them, build them, and make it so that you can install/update your distribution on any machine. Everything is organized in a fashion that is cohesive to the Penetration Testing Execution Standard (PTES) and eliminates a lot of things that are hardly used. PTF simplifies installation and packaging and creates an entire pentest framework for you. Since this is a framework, you can configure and add as you see fit. We commonly see internally developed repos that you can use as well as part of this framework. It's all up to you.

The ultimate goal is for community support on this project. We want new tools added to the github repository. Submit your modules. It's super simple to configure and add them and only takes a few minute.

Installation

PTF requires python-pexpect in order to work appropriately.

Run the following command below:

pip install -r requirements.txt
./ptf

Instructions:

First check out the config/ptf.config file which contains the base location of where to install everything. By default this will install in the /pentest directory. Once you have that configured, move to running PTF by typing ./ptf (or python ptf).

This will put you in a Metasploitesque type shell which has a similar look and feel for consistency. Show modules, use , etc. are all accepted commands. First things first, always type help or ? to see a full list of commands.

For a video tutorial on how to use PTF, check out our Vimeo page here: https://vimeo.com/137133837

Update EVERYTHING!

If you want to install and/or update everything, simply do the following:

./ptf
use modules/install_update_all
yes

This will install all of the tools inside of PTF. If they are already installed, this will iterate through and update everything for you automatically.

You can also individually install each module, then use the use modules/update_installed which will only update what you've previously installed.

For example:

./ptf
use modules/update_installed

This will only update previous ones you've installed.

You can also show options to change information about the modules.

If you only want to install only for example exploitation tools, you can run:

./ptf
use modules/exploitation/install_update_all

This will only install the exploitation modules. You can do this for any module category.

Customize your own installed tools

You can install only the tools you want to by going to the modules/custom_list/list.txt section. Modify the list.txt file and add the tools you only want to install or update.

Example list.txt file:

modules/exploitation/metasploit modules/post-exploitation/unicorn

Then when in PTF:

./ptf
use modules/custom_list/list
yes

This allows you to carry your module configuration over and only install the tools that you want and keep them updated.

You can also simply specify a module without using the category:

./ptf
use trevorc2
yes

Modules:

First, head over to the modules/ directory, inside of there are sub directories based on the Penetration Testing Execution Standard (PTES) phases. Go into those phases and look at the different modules. As soon as you add a new one, for example testing.py, it will automatically be imported next time you launch PTF. There are a few key components when looking at a module that must be completed.

Below is a sample module

AUTHOR="David Kennedy (ReL1K)"

DESCRIPTION="This module will install/update the Browser Exploitation Framework (BeEF)"

INSTALL_TYPE="GIT"

REPOSITORY_LOCATION="https://github.com/beefproject/beef"

X64_LOCATION="https://github.com/something_thats_x64_instead_of_x86

INSTALL_LOCATION="beef"

DEBIAN="ruby1.9.3,sqlite3,ruby-sqlite3"

ARCHLINUX = "arch-module,etc"

BYPASS_UPDATE="NO"

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

LAUNCHER="beef"

TOOL_DEPEND="modules/exploitation/metasploit"

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

Note in modules, you can specify after commands {INSTALL_LOCATION}. This will append where you want the install location to go when using after commands.

You can also specify {PTF_LOCATION} which will pull the base path for your PTF installation.

You also have the ability for repository locations to specify both a 32 bit and 64 bit location. Repository location should always be the x86 download path. To add a 64 bit path for a tool, specify X64_LOCATION and give it a URL. When PTF launches it will automatically detect the architecture and attempt to use the x64 link instead of the x86.

Note that ArchLinux packages are also supported, it needs to be specified for both DEBIAN and ARCH in order for it to be properly installed on either platform in the module

GITLAB Support

You can create your own modules and PTF also supports gitlab access. Instead of specifying git, wget, etc., simply specify gitlab and point to your own internal gitlab tools for modules.

BYPASS UPDATES:

When using traditional git or svn as a main method, what will happen after a module is installed is it will just go and grab the latest version of the tool. With after commands, normally when installing, you may need to run the after commands after each time you update. If you specify bypass updates to YES (BYPASS_UPDATE="YES"), each time the tool is run, it will check out the latest version and still run after commands. If this is marked to no, it will only git pull the latest version of the system. For FILE options, it is recommended to always use BYPASS_UPDATE="YES" so that it will overwrite the files each time.

After Commands:

After commands are commands that you can insert after an installation. This could be switching to a directory and kicking off additional commands to finish the installation. For example in the BEEF scenario, you need to run ruby install-beef afterwards. Below is an example of after commands using the {INSTALL_LOCATION} flag.

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, for Metasploit you may want msfconsole, msfvenom, etc. In order to add multiple launchers, simply put a , between them. For example LAUNCHER="msfconsole,msfvenom". This would create launchers for both.

Automatic Command Line

You can also just run ./ptf --update-all and it will automatically update everything for you without having to go into the framework.

Running Unattended

If you're running ptf in an automatic build, you can use a heredoc so you don't have to interactively type the modules you wish to install. Example:

./ptf <
   
   

TOOL DEPENDS

Some tools such as Veil, SET, etc. require tools such as the Metasploit Framework. You can add in the module TOOL_DEPEND="modules/exploitation/metasploit,module/exploitation/set" and multiple other tools if there is a tool required to be installed prior to installing the tool. This will force PTF to install the required tool first, then install the module that requires it. Example:

TOOL_DEPEND="modules/exploitation/metasploit"

This will install Metasploit first or ensured its installed first prior to installing the application.

IGNORE Modules or Categories

The IGNORE_THESE_MODULES= config option can be found under config/ptf.config in the PTF root directory. This will ignore modules and not install them - everything is comma separated and based on name - example: modules/exploitation/metasploit,modules/exploitation/set or entire module categories, like /modules/code-audit/*,/modules/reporting/*

IGNORE Modules from Update/Install All

The IGNORE_UPDATE_ALL_MODULES= config option can be found under config/ptf.config in the PTF root directory. This will ignore modules only when doing install_update_all which are used when you want to install all tools. This could be for large applications that take substantial time, ones that require user interaction, or open up a number of ports and protocols on the system. This works very similar in the IGNORE_THESE_MODULES, except that they can be manually installed and updated through the modules/update_installed. These are comma deliminated, so for example modules/exploitation/tool1,modules/exploitation/tool2, when running install_update_all, this would not install the tools unless you went to use modules/exploitation/tool1 and installed via that method.

INCLUDE_ONLY_THESE_MODULES

The INCLUDE_ONLY_THESE_MODULES in the config option under config/ptf.config will only install and include specific modules that are specified here. This is good for baselining the tools that you want and install only them.

LAUNCH PTF WITH NO BANNER

You can launch PTF with no banner message if you want. Simply specify:

./ptf --no-banner

or 

./ptf -nb

CHECK FOR INSTALLED PROGRAMS THROUGH PTF

You can check to see what applications you've already installed through PTF by typing the following:

ptf>show installed
Comments
  • Unable to install metasploit on Ubuntu 16.04 and 17.04 :

    Unable to install metasploit on Ubuntu 16.04 and 17.04 : "E: Unable to locate package metasploit-framework"

    ptf is unable to install metasploit on my Ubuntu 16.04 and 17.04, because it can't locate the package metasploit-framework. It gives me this error :

    E: Unable to locate package metasploit-framework

    So there is clearly a problem with this metasploit repository.

    opened by sidahmed-malaoui 31
  • ASCII codec can't encode characters

    ASCII codec can't encode characters

    On Debian 9 I'm getting an odd error when trying to start PTF

    root@pentestframework:~/ptf# ./ptf 
    [*] You can always type ./ptf --no-network-connection to skip the Internet check..
    [*] Checking for an Internet connection...
    [*] Trying to update myself first.. Then starting framework.
    Already up-to-date.
    [!] [!] DANGER WILL ROBINSON. DANGER WILL ROBINSON. Error has occurred.
    [!] [!] It's not possible its due to my coding skillz, it must be you? :-)
    [!] [!] Printing that error. Get that error. You get it: ['ascii' codec can't encode characters in position 36-47: ordinal not in range(128)]
    
    opened by mubix 14
  • issue when trying to install

    issue when trying to install

    i get the following issue when i try to install (screenshot). i got most of the way through it, and believe it is something i run into sometimes where i have to manually select the directory. it is possible that it stems from a cup of coffee on the motherboard, as it will not install an os either, but the fix is generally me hardcoding the directory into the script or whatever. i juat cannot seem to locate this one. if you could point me to the correct file, i can fix it. thanx so much and i look foward to trying the tool out. ptf_error

    opened by sfzombie13 13
  • msf install

    msf install

    When installing metasploit module from inside ptf, I am receiving the output located below. I have attempted to change the mkdir command to just cp the file, but still receive the getcwd() error. From the looks of it the metasploit directory just gets removed when the module is run and hits the After Commands portion. I have removed metasploit, postgresql and ptf and started again on an Ubuntu 16 x64 machine, but still no success. Should I be focusing on the After Commands or trying to find old remnants of metasploit that may be causing this issue?

    [_] Sending after command: mkdir /root/.msf4 cp /opt/database.yml /root/.msf4/ mkdir: cannot create directory '/root/.msf4': File exists mkdir: cannot create directory '/opt/database.yml': File exists mkdir: cannot create directory '/root/.msf4/': File exists [_] Sending after command: rm -rf /pentest/exploitation/metasploit 2> /dev/null [_] Sending after command: rm -rf /usr/local/bin/msf_ sh: 0: getcwd() failed: No such file or directory [_] Completed running after commands routine.. [_] Running updatedb to tidy everything up.

    opened by mkannan22 12
  • Bettercap is no longer available in the repository of evilsocket

    Bettercap is no longer available in the repository of evilsocket

    Bettercap official repository has moved from https://github.com/evilsocket/bettercap to https://github.com/bettercap/bettercap , so it's better to change it inside PTF.

    opened by sidahmed-malaoui 10
  • Fluxion repo taken off GitHub

    Fluxion repo taken off GitHub

    This affects https://github.com/trustedsec/ptf/blob/f3b9902a25cbfdc8de992d61222ac0bc80570dd2/modules/wireless/fluxion.py.

    Looks like some copies exist on GitHub, but A) I'm not sure if they're actually legit copies and B) I'm not sure if you want to switch to one of them.

    The author mentioned more info in one of those copies: https://github.com/wi-fi-analyzer/fluxion/issues/3

    And kinda-sorta complained about another copy: https://github.com/MuhammadOmar125/fluxion/issues/1

    opened by jeffmcjunkin 10
  • HowTo: Uninstall/Remove PTF?

    HowTo: Uninstall/Remove PTF?

    Can anyone help me out to completely remove the PTF, lot's of configuration on my apache server is broken after installation, ptf works fine, updated all modules and tested it but now I need to roll-back my apache2 state so if anyone can explain shortly how to completely remove it, would be gratefull.

    cheers komodo

    opened by komodev 9
  • John the Ripper only runs as root, needs system-wide install

    John the Ripper only runs as root, needs system-wide install

    See https://github.com/magnumripper/JohnTheRipper/blob/bleeding-jumbo/doc/README-DISTROS

    Instead of the painful build chain with fallbacks in the above documentation, I ran the following command:

    ./configure CPPFLAGS='-DJOHN_SYSTEMWIDE -DJOHN_SYSTEMWIDE_EXEC="\"/usr/local/bin\"" -DJOHN_SYSTEMWIDE_HOME="\"/usr/local/share/john\""'  &&
    make -s clean && make -sj`nproc` strip &&
    rm -rf ../run/*.dSYM &&
    sudo mv ../run/{john,john-*,*2john,unshadow,unique,undrop,unafs,base64conv,tgtsnarf,mkvcalcproba,genmkvpwd,calc_stat,raw2dyna,cprepair,SIPdump} /usr/local/bin &&
    sudo mkdir -p /usr/local/share/john &&
    sudo cp -a ../run/* /usr/local/share/john &&
    sudo mv /usr/local/share/john/*.{pl,py,rb} /usr/local/share/john/{relbench,benchmark-unify,mailer,makechr} /usr/local/bin
    

    It's based on the above, but without the fallback options, building with nproc instead of a static 8 threads, and building for the native architecture.

    This supports running as a limited user (not a huge deal) and means we don't have to pushd to the run directory in a wrapper script (and therefore we can use relative paths).

    jeff@desktop:/tmp$ ls -l hash pwlist.txt 
    -rw-rw-r-- 1 jeff jeff   686 May  2 11:36 hash
    -rw-rw-r-- 1 jeff jeff 10498 May  2 11:41 pwlist.txt
    jeff@desktop:/tmp$ john hash -w:pwlist.txt
    john: /usr/local/cuda-8.0/targets/x86_64-linux/lib/libOpenCL.so.1: no version information available (required by john)
    Warning: detected hash type "netntlmv2", but the string is also recognized as "ntlmv2-opencl"
    Use the "--format=ntlmv2-opencl" option to force loading these as that type instead
    Using default input encoding: UTF-8
    Loaded 1 password hash (netntlmv2, NTLMv2 C/R [MD4 HMAC-MD5 32/64])
    Will run 32 OpenMP threads
    Press 'q' or Ctrl-C to abort, almost any other key for status
    <redacted>          (Administrator)
    1g 0:00:00:00 DONE (2017-05-02 11:41) 50.00g/s 50000p/s 50000c/s 50000C/s arizonA1..28961020
    Use the "--show" option to display all of the cracked passwords reliably
    Session completed
    
    opened by jeffmcjunkin 8
  • module import error

    module import error

    hey there, when i run the framework.py it says

    Traceback (most recent call last):
      File "framework.py", line 7, in <module>
        from src.core import *
    ImportError: No module named src.core
    

    instead using from src.core import * why don't you just use from core import * ? after change the import section into from core import * it's runs like what i thought

    opened by vck 8
  • revive `use` without category names

    revive `use` without category names

    Hey 👋

    efa0cd5b2b89e255469fe6d22c4aee0651e098b2ea93bcb1547abb0872c74830c5b6a781cb29804f broke the small feature that we introduced in c3e8a9d9c79f3dda28793cc40bbde1b98374a3eb. The feature allowed the user to omit the category name, so I could type use crackmapexec instead of use modules/post-exploitation/crackmapexec.

    Here's the result now:

    ptf> use crackmapexec
    [!] [!] DANGER WILL ROBINSON. DANGER WILL ROBINSON. Error has occurred.
    [!] [!] It's not possible its due to my coding skillz, it must be you? :-)
    [!] [!] Printing that error. Get that error. You get it: module not found
    

    If I revert efa0cd5b2b89e255469fe6d22c4aee0651e098b2ea93bcb1547abb0872c74830c5b6a781cb29804f, it works again. Would you be willing to accept a patch to revive the feature and immortalize it in the docs?

    It's okay to say no.

    Thanks a lot for the recent quar-time updates by the way.

    🐼

    Edit: fixed commitish

    opened by ypcrts 7
  • Re: Wafw00f issue

    Re: Wafw00f issue

    Re Open

    It seems that ptf> use modules/install_update_all, broke the wafw00f install in Kali Linux Rolling.

    The only way or running wafw00f successfully is going to:

    /pentest/intelligence-gathering/waffit/wafw00f/ and running main.py

    ls on the folder:

    /pentest/intelligence-gathering/waffit/wafw00f# ls -ltrn total 48 drwxr-xr-x 2 0 0 4096 jul 28 00:39 tests drwxr-xr-x 2 0 0 4096 jul 28 00:39 plugins -rw-r--r-- 1 0 0 628 jul 28 00:39 manager.py -rwxr-xr-x 1 0 0 20390 jul 28 00:39 main.py drwxr-xr-x 2 0 0 4096 jul 28 00:39 lib -rw-r--r-- 1 0 0 46 jul 28 00:39 init.py drwxr-xr-x 2 0 0 4096 jul 28 00:39 bin -rw-r--r-- 1 0 0 177 jul 28 00:39 init.pyc

    If I run it using the command wafw00f directly in that folder or any folder the error I get is:

    /pentest/intelligence-gathering/waffit/wafw00f# wafw00f Traceback (most recent call last): File "/usr/local/bin/wafw00f", line 4, in import('pkg_resources').run_script('wafw00f==0.9.4', 'wafw00f') File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 2928, in @_call_aside File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 2914, in _call_aside f(_args, *_kwargs) File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 2941, in _initialize_master_working_set working_set = WorkingSet._build_master() File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 637, in _build_master return cls._build_from_requirements(requires) File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 650, in _build_from_requirements dists = ws.resolve(reqs, Environment()) File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 829, in resolve raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The 'pluginbase==0.3' distribution was not found and is required by wafw00f

    opened by niemant 7
  • zaproxy contains log4j exploit code

    zaproxy contains log4j exploit code

    2022-09-20 06_23_49-Window The version of ZAP installed is behind the master branch that addressed this

    References: https://www.blumira.com/analysis-log4shell-local-trigger/ https://www.lunasec.io/docs/blog/log4j-zero-day-update-on-cve-2021-45046/

    https://github.com/zaproxy/zaproxy/pull/6979. https://github.com/zaproxy/zaproxy/issues/6980

    Unsure what magic was done, image but the magic needs updating to the most recent URL to pull a newer version via wget.

    opened by BustedSec 0
Owner
trustedsec
trustedsec
A Modular Penetration Testing Framework

fsociety A Modular Penetration Testing Framework Install pip install fsociety Update pip install --upgrade fsociety Usage usage: fsociety [-h] [-i] [-

fsociety-team 802 Dec 31, 2022
fsociety Hacking Tools Pack – A Penetration Testing Framework

Fsociety Hacking Tools Pack A Penetration Testing Framework, you will have every script that a hacker needs. Works with Python 2. For a Python 3 versi

Manisso 8.2k Jan 3, 2023
Python tools for penetration testing

pyTools_PT python tools for penetration testing Please don't use these tool for illegal purposes. These tools is meant for penetration testing for leg

Gourab 1 Dec 1, 2021
Automated Penetration Testing Framework

Automated Penetration Testing Framework

OWASP 2.1k Jan 1, 2023
RAT-el is an open source penetration test tool that allows you to take control of a windows machine.

To prevent RATel from being detected by antivirus, please do not upload the payload to TOTAL VIRUS. Each month I will test myself if the payload gets detected by antivirus. So you’ll have a photo every month to prove RAtel’s discretion.

null 218 Dec 16, 2022
WEB PENETRATION TESTING TOOL 💥

N-WEB ADVANCE WEB PENETRATION TESTING TOOL Features ?? Admin Panel Finder Admin Scanner Dork Generator Advance Dork Finder Extract Links No Redirect H

null 56 Dec 23, 2022
Active Directory Penetration Testing methods with simulations

AD penetration Testing Project By Ruben Enkaoua - GL4Di4T0R Based on the TCM PEH course (Heath Adams) Index 1 - Setting Up the Lab Intallation of a Wi

GL4DI4T0R 3 Aug 12, 2021
PyBuster A directory busting tool for web application penetration tester, written in python

PyBuster A directory busting tool for web application penetration tester, written in python. Supports custom wordlist,recursive search. Screenshots Pr

Anukul Pandey 4 Jan 30, 2022
Penetration testing

Penetration testing

null 3 Jan 11, 2022
Baseball Discord bot that can post up-to-date scores, lineups, and home runs.

Sunny Day Discord Bot Baseball Discord bot that can post up-to-date scores, lineups, and home runs. Uses webscraping techniques to scrape baseball dat

Benjamin Hammack 1 Jun 20, 2022
The pytest framework makes it easy to write small tests, yet scales to support complex functional testing

The pytest framework makes it easy to write small tests, yet scales to support complex functional testing for applications and libraries. An example o

pytest-dev 9.6k Jan 2, 2023
Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source.

Mockoon Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source. It has been built wi

mockoon 4.4k Dec 30, 2022
Pytest support for asyncio.

pytest-asyncio: pytest support for asyncio pytest-asyncio is an Apache2 licensed library, written in Python, for testing asyncio code with pytest. asy

pytest-dev 1.1k Jan 2, 2023
Python 3 wrapper of Microsoft UIAutomation. Support UIAutomation for MFC, WindowsForm, WPF, Modern UI(Metro UI), Qt, IE, Firefox, Chrome ...

Python 3 wrapper of Microsoft UIAutomation. Support UIAutomation for MFC, WindowsForm, WPF, Modern UI(Metro UI), Qt, IE, Firefox, Chrome ...

yin kaisheng 1.6k Dec 29, 2022
This package is a python library with tools for the Molecular Simulation - Software Gromos.

This package is a python library with tools for the Molecular Simulation - Software Gromos. It allows you to easily set up, manage and analyze simulations in python.

null 14 Sep 28, 2022
Avocado is a set of tools and libraries to help with automated testing.

Welcome to Avocado Avocado is a set of tools and libraries to help with automated testing. One can call it a test framework with benefits. Native test

Ana Guerrero Lopez 1 Nov 19, 2021
A collection of benchmarking tools.

Benchmark Utilities About A collection of benchmarking tools. PYPI Package Table of Contents Using the library Installing and using the library Manual

Kostas Georgiou 2 Jan 28, 2022
Generic automation framework for acceptance testing and RPA

Robot Framework Introduction Installation Example Usage Documentation Support and contact Contributing License Introduction Robot Framework is a gener

Robot Framework 7.7k Jan 7, 2023