Legion is an open source, easy-to-use, super-extensible and semi-automated network penetration testing tool that aids in discovery, reconnaissance and exploitation of information systems.
The Legion repository is moving to https://github.com/hackman238/legion. All future releases, updates, etc will occur from there. Big improvements on the way! This repo under this organiztion will no longer be maintained.
Legion, a fork of SECFORCE’s Sparta, is an open source, easy-to-use, super-extensible, and semi-automated network
penetration testing framework that aids in discovery, reconnaissance, and exploitation of information systems.
Install NMAP 7.93 using the following:
sudo apt install snapd -y
sudo systemctl enable --now snapd.apparmor
sudo systemctl start snapd
sudo snap install nmap
sudo mv /usr/bin/nmap /usr/bin/nmap-7.92
sudo ln -s /snap/bin/nmap /usr/bin/nmap
Then verify the version is 7.93 with:
nmap -v
Update the apparmor profile:
vi /var/lib/snapd/apparmor/profiles/snap.nmap.nmap
Goto line 300, create new line and add in:
owner @{HOME}/.local/share/legion/tmp/** rw,
/etc/ssl/kali.cnf r,
Reboot
RunIt script (docker/runIt.sh
) supports:
It is possible to run the docker image on any Linux distribution, however, different distributions have different hoops
to jump through to get a docker app to be able to connect to the X server. Everyone is welcome to try to figure those
hoops out and create a PR for runIt.
We can only promise correct operation on Ubuntu 20.04 using the traditional installation at this time. While it should
work on ParrotOS, Kali, and others, until we have Legion packaged and placed into the repos for each of these distros,
it is musical chairs in regard to platform updates changing and breaking dependencies. Native a native package exists and is
included by default on Kali.
Two installation methods available:
It is preferable to use the Docker method over a traditional installation. This is because of all the dependency
requirements and the complications that occur in environments which differ from a clean, non-default installation.
NOTE: Docker versions of Legion are unlikely to work when run as root or under a root X!
Docker method includes support for various environments, choose the one that works for you.
Assumes Docker and X11 are installed and set up (including running Docker commands as a non-root user).
It is critical to follow all the instructions for running as a non-root user. Skipping any of them will result in
complications getting Docker to communicate with the X server.
See detailed instructions to set up Docker here and enable running containers as non-root users
and granting Docker group SSH rights here.
Within Terminal:
git clone https://github.com/GoVanguard/legion.git
cd legion/docker
chmod +x runIt.sh
./runIt.sh
Assumes Docker and X11 are installed and set up.
Replace X.X.X.X
with the IP address of the remote running X11.
Within Terminal:
git clone https://github.com/GoVanguard/legion.git
cd legion/docker
chmod +x runIt.sh
./runIt.sh X.X.X.X
Assumes:
See detailed Docker instructions here
Replace X.X.X.X
with the IP address with which Xming has registered itself. Right click Xming in system tray -> View
log and see IP next to “XdmcpRegisterConnection: newAddress”
Within Terminal:
git clone https://github.com/GoVanguard/legion.git
cd legion/docker
sudo chmod +x runIt.sh
sudo ./runIt.sh X.X.X.X
Why? Don’t do this. 😃
Not yet in runIt.sh
script. Possible to set up using socat
.
See instructions here
To install Docker components typically needed and add set up the environment for Docker, under a term, run:
sudo apt-get update
sudo apt-get install -y docker.io python3-pip -y
sudo groupadd docker
pip install --user docker-compose
To enable non-root users to run Docker commands, under a term, run:
sudo usermod -aG docker $USER
sudo chmod 666 /var/run/docker.sock
sudo xhost +local:docker
The order is important for port reservation reasons. If you have WSL, HyperV, or Docker Desktop installed then please
uninstall those features before proceeding.
netsh int ipv4 add excludedportrange protocol=tcp startport=2375 numberofports=1
dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All
dism.exe /Online /Enable-Feature /FeatureName:Microsoft-Windows-Subsystem-Linux
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce python-pip -y
sudo apt autoremove
sudo usermod -aG docker $USER
pip install --user docker-compose
echo "export DOCKER_HOST=tcp://localhost:2375" >> ~/.bashrc && source ~/.bashrc
docker images
Please use the Docker image where possible! It’s becoming very difficult to support all the various platforms and
their own quirks.
Assumes Ubuntu, Kali or Parrot Linux is being used with Python 3.6 installed.
Within Terminal:
git clone https://github.com/GoVanguard/legion.git
cd legion
sudo chmod +x startLegion.sh
sudo ./startLegion.sh
To run all test cases, execute the following in root directory:
python -m unittest
The configuration of selected ports and associated terminal actions can be easily modified by editing the legion.conf file.
[StagedNmapSettings] defines what ports will be scanned in sequential order as well as any NSE scripts that will be called.
[SchedulerSettings] defines what actions will occur automatically based upon port scan results.
sudoedit /root/.local/share/legion/legion.conf
Legion is licensed under the GNU General Public License v3.0. Take a look at the
LICENSE for more information.
smbenum.sh
is credited to Bernardo Damele A.G.