Autopen is a very modular tool that automates the execution of scans during a penetration test.

Related tags

Networkingautopen
Overview

Autopen

Autopen is a very modular tool that automates the execution of scans during a penetration test. A Nmap scan result in the form of an XML file is required as the basis for the modules to be executed. This XML file can be passed as an argument. If no scan result is provided, autopen can perform the Nmap scan by itself.

Using multithreading, several scans are executed simultaneously. The use of different modules can be adapted on the fly by using module names, port numbers or IP addresses as a filter. Autopen is well suited to test a given user password combination on many machines and different services.

The core is the modules.json file, which contains the syntax of the executable commands. Variables can also be stored in this configuration file, which are automatically included in the arguments of Argparse.

Requirements

  • Python 3

Furthermore all modules specified in the configuration file are considered as dependencies.
If a module is not installed, an error is issued and the next module is executed.

Install

The setup script will only read the absolute path of the script location and insert this path into the modules.json file.

bash setup.sh

Configuration

The modules.json file contains all modules that can be executed by autopen.
The modules have the following structure:

[optional ] > 2>&1", "port": "portNumber1, portNumber2, [...]" }, ">
{
    "name": "nameOfModule",
    "riskLevel": "riskLevelAsInteger",
    "syntax": "commandSyntax 
     
       [optional 
      
       ] > 
       
         2>&1",
    "port": "portNumber1, portNumber2, [...]"
},

       
      
     

name, risklevel, port

The configuration can be extended as desired.
However, it should be noted that the modules cannot have the same name.

Each module requires a risk level between 1 to 5.
The higher the level, the higher the probability that the module can cause damage.

It is necessary to specify port numbers for the modules.
If a module is always applicable, a wildcard * can also be stored instead a port number.
In this case, the module will be executed once for each host and each port.

> 2>&1", "port": "445" }, { "name": "netcat", "riskLevel": "1", "syntax": "timeout 60 nc -nv > 2>&1", "port": "*" }, ">
{
    "name": "crackmapexec",
    "riskLevel": "1",
    "syntax": "crackmapexec smb 
       
         > 
        
          2>&1",
    "port": "445"
},
{
    "name": "netcat",
    "riskLevel": "1",
    "syntax": "timeout 60 nc -nv 
          
          
            > 
           
             2>&1", "port": "*" }, 
           
          
         
        
       

syntax - absolute path

If tools are not included in the environment path variables, absolute paths can also be specified.

-u -p > 2>&1", "port": "445" }, ">
{
    "name": "lsassy",
    "riskLevel": "2",
    "syntax": "/usr/bin/lsassy -d 
       
         -u 
        
          -p 
          
          
            > 
           
             2>&1", "port": "445" }, 
           
          
         
        
       

syntax - variables

Strings inside <...> are interpreted as variables.
The syntax must always end with an > 2>&1 so that the output can be written to a file.
Additionally the variable must always be included inside the syntax.

Furthermore it is possible to include custom variables. Custom variables are added to the arguments of Argparse. Camelcase notation sets the abbreviations for the Argparse's arguments.

Modules with custom variables are only executed if all occurring in the syntax are given by the user.
One exceptional variable that does not have to be passed explicitly when autopen is called is the variable . This variable is read from the Nmap scan result.
For example, the following module would add the values domain (-d) and userList (-ul) to the Argparse's arguments.

-U -w 30 -v -t > 2>&1", "port":"25" }, ">
{
    "name": "smtp-enum-user",
    "riskLevel": "1",
    "syntax": "smtp-user-enum -M VRFY -D 
      
        -U 
       
         -w 30 -v -t 
        
          > 
         
           2>&1",
    "port":"25"
},

         
        
       
      

Help

usage: autopen.py [-h] [-e] [-v] -o OUTPUT [-t TIMEOUT] (-ti TARGETIP | -xf XMLFILE) [-rl RISKLEVEL] [-ta THREADAMOUNT] [-em [EXCLUDEMODULES ...]] [-im [INCLUDEMODULES ...]] [-ii [INCLUDEIPS ...]]
                  [-ei [EXCLUDEIPS ...]] [-ip [INCLUDEPORTS ...]] [-ep [EXCLUDEPORTS ...]] [-d DOMAIN] [-dci DOMAINCONTROLERIP] [-p PASSWORD] [-u USER] [-ul USERLIST] [-upf USERPASSFILE]

Automatic Pentesting.
Please dont be evil.

Basic usage:
Print matching modules for a given nmap xml file:
./autopen.py -o /tmp/output -xf nmap-result.xml

Scan targets (top 1000 ports) and execute matching modules:
./autopen.py -o /tmp/output -ti 192.168.0.0/24 -e

Exclude ip addresses:
./autopen.py -o /tmp/output -xf nmap-result.xml -ei 192.168.1.1 192.168.3.4 -e

Only execute modules for given ip address and exclude ports:
./autopen.py -o /tmp/output -xf nmap-result.xml -ii 192.168.1.4 -ep 80 443 -e

Exclude all modules that have one of the given substrings in their name:
./autopen.py -o /tmp/output -xf nmap-result.xml -im smb netcat -e

Only execute modules that contains at least one given substring in ther name:
./autopen.py -o /tmp/output -xf nmap-result.xml -im hydra -e

Execute modules with higher risk level, use more threads and increase timeout:
./autopen.py -o /tmp/output -xf nmap-result.xml -rl 4 -ta 8 -t 900

optional arguments:
  -h, --help            show this help message and exit
  -e, --execute         execute matching commands
  -v, --verbose         print full command
  -o OUTPUT, --output OUTPUT
                        path to output directory
  -t TIMEOUT, --timeout TIMEOUT
                        maximal time that a single thread is allowed to run in seconds (default 600)
  -ti TARGETIP, --targetIp TARGETIP
                        initiate nmap scan for given ip addresses (use nmap ip address notation)
  -xf XMLFILE, --xmlFile XMLFILE
                        full path to xml nmap file
  -rl RISKLEVEL, --riskLevel RISKLEVEL
                        set maximal riskLevel for modules (possible values 1-5, 2 is default)
  -ta THREADAMOUNT, --threadAmount THREADAMOUNT
                        the amount of parallel running threads (default 5)
  -em [EXCLUDEMODULES ...], --exludeModules [EXCLUDEMODULES ...]
                        modules that will be excluded (exclude ovewrites include)
  -im [INCLUDEMODULES ...], --includeModules [INCLUDEMODULES ...]
                        modules that will be included
  -ii [INCLUDEIPS ...], --includeIps [INCLUDEIPS ...]
                        filter by including ipv4 addresses
  -ei [EXCLUDEIPS ...], --excludeIps [EXCLUDEIPS ...]
                        filter by excluding ipv4 addresses
  -ip [INCLUDEPORTS ...], --includePorts [INCLUDEPORTS ...]
                        filter by including port number
  -ep [EXCLUDEPORTS ...], --excludePorts [EXCLUDEPORTS ...]
                        filter by excluding port number
  -d DOMAIN, --domain DOMAIN
  -dci DOMAINCONTROLERIP, --domainControlerIp DOMAINCONTROLERIP
  -p PASSWORD, --password PASSWORD
  -u USER, --user USER
  -ul USERLIST, --userList USERLIST
  -upf USERPASSFILE, --userPassFile USERPASSFILE

Demo

Result Structure

output
├── dirsearch
│   ├── dirsearch-192.168.2.175-80
│   └── dirsearch-192.168.2.175-8080
├── hydra-ftp-default-creds
│   └── hydra-ftp-default-creds-192.168.2.175-21
├── hydra-ssh-default-creds
│   └── hydra-ssh-default-creds-192.168.2.175-22
├── netcat
│   ├── netcat-192.168.2.175-21
│   ├── netcat-192.168.2.175-22
│   ├── netcat-192.168.2.175-80
│   └── netcat-192.168.2.175-8080
├── nmap
│   ├── 192.168.2.175-p-sT.gnmap
│   ├── 192.168.2.175-p-sT.nmap
│   └── 192.168.2.175-p-sT.xml
├── ssh-audit
│   └── ssh-audit-192.168.2.175-22
└── whatweb
    └── whatweb-192.168.2.175-80

Currently included Modules

Sources

Linkedin Connection Automation

Why spend an hour+ a week, connecting with the correct people on LinkedIn when you can go for lunch and let your computer do the hard work?

1 Nov 29, 2021
Bittensor - an open, decentralized, peer-to-peer network that functions as a market system for the development of artificial intelligence

At Bittensor, we are creating an open, decentralized, peer-to-peer network that functions as a market system for the development of artificial intelligence.

Opentensor 169 Dec 30, 2022
A pure python implementation of multicast DNS service discovery

python-zeroconf Documentation. This is fork of pyzeroconf, Multicast DNS Service Discovery for Python, originally by Paul Scott-Murphy (https://github

Jakub Stasiak 483 Dec 29, 2022
Python implementation of the IPv8 layer provide authenticated communication with privacy

Python implementation of the IPv8 layer provide authenticated communication with privacy

203 Oct 26, 2022
a decompilation of NAP36 the widevine removal software for amz and nf used by p2p groups until it stoped working due to it using expired cdm keys

NAP36 a decompilation of NAP36 the widevine removal software for amz and nf used by p2p groups until it stoped working due to it useing expired cdm ke

9 Aug 29, 2021
Truetool - A TrueCharts automatic and bulk update utility

truetool A easy tool for frequently used TrueNAS SCALE CLI utilities. Previously

TrueCharts 125 Jan 04, 2023
An HTML interface for finetuning the sync map output from aeneas

finetuneas 3.0 finetuneas is a simple HTML interface for fine tuning sync maps output by aeneas Version 3.0 Easier adjusting time: following cells wil

Firat Özdemir 50 Mar 12, 2022
User-friendly packet captures

capture-packets: User-friendly packet captures Please read before using All network traffic occurring on your machine is captured (unless you specify

Seth Michael Larson 2 Feb 05, 2022
Exfiltrate files using the HTTP protocol version ("HTTP/1.0" is a 0 and "HTTP/1.1" is a 1)

http-protocol-exfil Use the HTTP protocol version to send a file bit by bit ("HTTP/1.0" is a 0 and "HTTP/1.1" is a 1). It uses GET requests so the Blu

Ricardo Ruiz 23 Apr 30, 2022
FIRM-AFL is the first high-throughput greybox fuzzer for IoT firmware.

FIRM-AFL is the first high-throughput greybox fuzzer for IoT firmware. FIRM-AFL addresses two fundamental problems in IoT fuzzing

356 Dec 23, 2022
A Python server and client app that tracks player session times and server status

MC Outpost A Python server and client application that tracks player session times and server status About MC Outpost provides a session graph and ser

Grant Scrits 0 Jul 23, 2021
A repo with study material, exercises, examples, etc for Devnet SPAUTO

MPLS in the SDN Era -- DevNet SPAUTO All of the study notes have now been moved to use auto-generated documentation to build a static site with Githu

Hugo Tinoco 67 Nov 16, 2022
PySocks lets you send traffic through SOCKS proxy servers.

PySocks lets you send traffic through SOCKS proxy servers. It is a modern fork of SocksiPy with bug fixes and extra features. Acts as a drop-i

1.1k Dec 07, 2022
A simple tool to get information about IP

IP Info Tool Just a simple tool to get IP's information, it uses requests module to gather information about IP, if you dont have much knowledge about

0 Dec 01, 2021
MQTT Explorer - MQTT Subscriber client to explore topic hierarchies

mqtt-explorer MQTT Explorer - MQTT Subscriber client to explore topic hierarchies Overview The MQTT Explorer subscriber client is designed to explore

Gambit Communications, Inc. 4 Jun 19, 2022
Simple local RPG turn-based to play while learn something using the anki system

Simple local RPG turn-based to play while learn something using the anki system

Raphael Kieling 5 Aug 02, 2022
Easy-to-use sync library for handy proxy parse

Proxy Parser About Synchronous library, for convenient and fast parsing of proxies from different sources. Uses Scrapy as a parser. At the moment the

Michael Mironov 2 Nov 22, 2022
Tool for pretty printing and optimizing Lightning Network channels.

Suez Tool for pretty printing and optimizing Lightning Network channels. Installation Install poetry poetry install poetry run ./suez Channel fee poli

Pavol Rusnak 69 Nov 03, 2022
Asyncer, async and await, focused on developer experience

Asyncer, async and await, focused on developer experience. Documentation: https:

Sebastián Ramírez 895 Dec 28, 2022
Use Raspberry Pi and CircuitSetup's power monitor hardware to publish electrical usage to MQTT

This repo has code and notes for whole home electrical power monitoring using a Raspberry Pi and CircuitSetup modules. Beyond just collecting data, it

Eric Tsai 10 Jul 25, 2022