Git Product home page Git Product logo

legion's Introduction

LEGION - Automatic Enumeration Tool

Legion is based in the Pentesting Methodology that you can find in book.hacktricks.xyz.

Legion is a tool that uses several well-known opensource tools to automatically, semi-automatically or manually enumerate the most frequent found services running in machines that you could need to pentest.

Basically, the goal of Legion is to extract all the information that you can from each opened network service, so you don't have to write and execute the same commands in a terminal every time you find that service. Some actions are repeated by more than one tool, this is done to be sure that all the possible information is correctly extracted.

asciicast

Installation

Installation of Legion

git clone https://github.com/carlospolop/legion.git /opt/legion
cd /opt/legion/git
./install.sh
ln -s /opt/legion/legion.py /usr/bin/legion

For pentesting oracle services you should install manually some dependencies: https://book.hacktricks.xyz/pentesting/1521-1522-1529-pentesting-oracle-listener/oracle-pentesting-requirements-installation

Docker

To have a nice experience with legion you can also build a container image using docker or podman, just typing the following commands:

docker build -t legion .

And start the container:

docker run -it legion bash

You will have a ready-to-use legion container image (To execute legion inside the container run ./legion.py).

Or you can just download the dockerhub container with:

docker pull carlospolop/legion:latest

Protocols Supported

You can get a list using the command protos

Brute force

All the protocols included in Legion that could be brute force, can be brute force using Legion. To see if a service can be brute forced and which command line will be used to do so (by default "hydra" is implemented, if hydra was not available metasploit or nmap will be used) set the protocol and the set the intensity to "3".

Example of brute forcing ssh:

Internal Commands

Use the help internal command to get info about what each command does.

Automatic Scan

Just lauch the internal command startGeneral and the 'General' will start scanning ports and services automatically.

Semi-Automatic Scan

You can set all the options properly and launch several commands to scan one service. You can do this using the command run.

Manual Scan

You can execute just one command using exec <name>. For example: exec http_slqmap

Some services have on demand commands, this commands can only be executed using this internal command (exec).

Options

domain

Set the domain of the DNS or of the user that you want to use

extensions

Comma separeted list of possible extensions (to brute force files in a web server)

host

It is the host that you want to attack (valid IP and domains)

Example:

set host 127.0.0.1
set host some.domain.com

intensity

There are 3 intensities:

  • 1: Basic checks executed
  • 2: All checks executed (Default)
  • 3: Brute force (check for availability)

ipv6

Ipv6 address of the victim, could be usefull for some commands

notuse

You can set a list (separated by commands) of commands that you don't want to use. For example, if you don't want modules from metasploit to be executed:set notuse msf.

password

Set here the password of the username you want to use.

path

Web server file path

plist

Set here the path to a list of passwords (by default LEGION has its own list)

port

The port where the service is running. If "0", then the default port of the service will be used (you can see this information using info)

proto

It is the protocol that you want to attack

Example:

set proto http

reexec

Set True if you want already executed commands to be executed again (by default is set to False).

ulist

Set a value here if you want to brute force a list of usernames (by default LEGION has its own list of usernames)

username

Set the username of the user that you want to use/brute-force(by default to brute-force a list of users is used).

verbose

If True the output of the command will be displayed as soon as it ends. If False it won't.

If True the output of info will show where each parameter is used, for example:

If False the output of info will show the values of the parameters, for example:

workdir

Is the directory where the info of the victim is storaged. By default it is $HOME/.legion

By Polop(TM)

legion's People

Contributors

alegrey91 avatar carlospolop avatar et7f3 avatar ls4cfk avatar nuno-andre avatar somethinggeneric avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

legion's Issues

This sounds good, but I don't dedicate much time to legion as I support other programs more. Could you submit a PR?

          This sounds good, but I don't dedicate much time to legion as I support other programs more. Could you submit a PR?

Originally posted by @carlospolop in #12 (comment)
Hi @carlospolop,

I noticed you mentioned that you don't dedicate much time to Legion as you support other programs more. It's important to prioritize your efforts where they are needed most. I understand that contributing to open-source projects can be a balancing act.

Build legion docker failed on macOS

In docker file used apt command and it is not available on MAC

 > [4/6] RUN apt-get install -y         cewl         curl         davtest         dirb         dnsrecon         dnsutils         enum4linux         exploitdb         finger         git         hydra         ike-scan         metasploit-framework         nbtscan         netcat         nfs-common         nikto         nmap         ntp         oscanner         python2         python3         python3-ldapdomaindump         python3-pip         smbclient         smbmap         snmp         sqlmap         sslscan         sslyze         wafw00f         whatweb:
#8 0.210 Reading package lists...
#8 0.919 Building dependency tree...
#8 1.051 Reading state information...
#8 1.055 Package netcat is a virtual package provided by:
#8 1.055   netcat-traditional 1.10-47
#8 1.055   netcat-openbsd 1.218-5
#8 1.055
#8 1.061 E: Package 'netcat' has no installation candidate

Create Dockerfile for legion

I think could be really comfortable create a Dockerfile for legion to have a ready-to-run container out of the box.
If you want, I can take care of it.

Enum4LinuxPy

Hi!
As the original enum4linus is dead and not being updated at all (including errors), I think Legion should utilize the Python based version of it, that supports much more actions:
https://github.com/0v3rride/Enum4LinuxPy

Thanks for this great tool!
Dviros

Output while exiting legion

Hey there,

This is a very good tool. I'm having a strange behavior, after the scan on a host finishes and I quit legion some output (from the scans) appears:

Screenshot from 2019-09-17 12-38-33

Feature Selection

Hey mate,
Will it possible to select the specific feature per scan and to do a "test run" to make sure that all the dependencies are working?

Thanks
Dvir

nikto and other tools are missing from Docker build

Using the Dockerfile results in a container that is missing:

  • nitko
  • cmsmap
  • wafw00f
  • whatweb

Example:

# cat https_cmsmap_443.err
/bin/sh: 1: cmsmap: not found

It also seems like a wordlist is missing:

# cat http_medium_dirsearch_80.out
The wordlist file does not exist

Subnet Scanning

Hey mate,
Is it possible to add support to Subnet scanning or a target list from file?

Thanks again,
Dvir

How can I run legion using the command line?

Hello there,

I've been trying to run legion without getting into the console.

So far, I managed to set the host but not able to run it, I don't know if it's possible.

My attempt:

legion --host host.domain -i 2 -r startGeneral

That's my idea of how to run it, but it doesn't work. I also tried:

legion --host host.domain -i 2 -r

Gives me the error
TypeError: main_run() missing 1 required positional argument: 'exec'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.