-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved package to pyproject.toml + Added GitHub Actions + Cleaned up u…
…nused imports
- Loading branch information
Showing
89 changed files
with
5,533 additions
and
5,334 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
[run] | ||
cover_pylib = false | ||
source = sploitkit | ||
omit = | ||
/home/travis/virtualenv/* | ||
*/site-packages/* | ||
tests/* | ||
|
||
[report] | ||
exclude_lines = | ||
pragma: no cover | ||
class IPAddressField | ||
class MACAddressField | ||
class Trigger | ||
[run] | ||
cover_pylib = false | ||
source = sploitkit | ||
omit = | ||
*/site-packages/* | ||
tests/* | ||
|
||
[report] | ||
exclude_lines = | ||
pragma: no cover | ||
class IPAddressField | ||
class MACAddressField | ||
class Trigger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# This workflow will deploy the Python package to PyPi.org | ||
|
||
name: deploy | ||
|
||
env: | ||
package: sploitkit | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- '**/VERSION.txt' | ||
workflow_run: | ||
workflows: ["build"] | ||
types: [completed] | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Cleanup README | ||
run: | | ||
sed -ri 's/^(##*)\s*:.*:\s*/\1 /g' README.md | ||
awk '{if (match($0,"## Supporters")) exit; print}' README.md > README | ||
mv -f README README.md | ||
- run: python3 -m pip install --upgrade build && python3 -m build | ||
- name: Upload ${{ env.package }} to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
verbose: true | ||
verify_metadata: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | ||
|
||
name: build | ||
|
||
env: | ||
package: sploitkit | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
python-version: ["3.8", "3.9", "3.10", "3.11"] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install pandoc | ||
run: sudo apt-get install -y pandoc | ||
- name: Install ${{ env.package }} | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install pytest pytest-cov pytest-pythonpath coverage | ||
pip install -r requirements.txt | ||
pip install . | ||
- name: Test ${{ env.package }} with pytest | ||
run: | | ||
pytest --cov=$package | ||
coverage: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
env: | ||
cov_badge_path: docs/coverage.svg | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11 | ||
- name: Install pandoc | ||
run: sudo apt-get install -y pandoc notification-daemon | ||
- name: Install ${{ env.package }} | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install pytest pytest-cov pytest-pythonpath | ||
pip install -r requirements.txt | ||
pip install . | ||
- name: Make coverage badge for ${{ env.package }} | ||
run: | | ||
pip install genbadge[coverage] | ||
pytest --cov=$package --cov-report=xml | ||
genbadge coverage -i coverage.xml -o $cov_badge_path | ||
- name: Verify Changed files | ||
uses: tj-actions/verify-changed-files@v12 | ||
id: changed_files | ||
with: | ||
files: ${{ env.cov_badge_path }} | ||
- name: Commit files | ||
if: steps.changed_files.outputs.files_changed == 'true' | ||
run: | | ||
git config --local user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --local user.name "github-actions[bot]" | ||
git add $cov_badge_path | ||
git commit -m "Updated coverage.svg" | ||
- name: Push changes | ||
if: steps.changed_files.outputs.files_changed == 'true' | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{ secrets.github_token }} | ||
branch: ${{ github.ref }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,7 +67,6 @@ target/ | |
.idea | ||
.vagrant | ||
.test | ||
testsploit | ||
.pytest_cache | ||
tmp | ||
TODO | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
version: 2 | ||
mkdocs: | ||
configuration: mkdocs.yml | ||
formats: all | ||
python: | ||
version: 3.6 | ||
install: | ||
- requirements: docs/requirements.txt | ||
version: 2 | ||
|
||
mkdocs: | ||
configuration: docs/mkdocs.yml | ||
|
||
python: | ||
install: | ||
- requirements: docs/requirements.txt |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,89 @@ | ||
<p align="center"><img src="https://github.com/dhondta/python-sploitkit/raw/master/docs/logo.png"></p> | ||
<h1 align="center">SploitKit <a href="https://twitter.com/intent/tweet?text=SploitKit%20-%20Devkit%20for%20building%20Metasploit-like%20consoles.%0D%0APython%20library%20for%20easilly%20building%20framework%20consoles%20in%20a%20Metasploit-like%20style%20with%20a%20comprehensive%20API.%0D%0Ahttps%3a%2f%2fgithub%2ecom%2fdhondta%2fpython-sploitkit%0D%0A&hashtags=python,programming,devkit,framework,console,ctftools"><img src="https://img.shields.io/badge/Tweet--lightgrey?logo=twitter&style=social" alt="Tweet" height="20"/></a></h1> | ||
<h3 align="center">Make a Metasploit-like console.</h3> | ||
|
||
[![PyPi](https://img.shields.io/pypi/v/sploitkit.svg)](https://pypi.python.org/pypi/sploitkit/) | ||
[![Read The Docs](https://readthedocs.org/projects/python-sploitkit/badge/?version=latest)](https://python-sploitkit.readthedocs.io/en/latest/?badge=latest) | ||
[![Build Status](https://travis-ci.com/dhondta/python-sploitkit.svg?branch=master)](https://travis-ci.com/dhondta/python-sploitkit) | ||
[![Coverage Status](https://coveralls.io/repos/github/dhondta/python-sploitkit/badge.svg?branch=master)](https://coveralls.io/github/dhondta/python-sploitkit?branch=master) | ||
[![Python Versions](https://img.shields.io/pypi/pyversions/sploitkit.svg)](https://pypi.python.org/pypi/sploitkit/) | ||
[![Requirements Status](https://requires.io/github/dhondta/python-sploitkit/requirements.svg?branch=master)](https://requires.io/github/dhondta/python-sploitkit/requirements/?branch=master) | ||
[![Known Vulnerabilities](https://snyk.io/test/github/dhondta/python-sploitkit/badge.svg?targetFile=requirements.txt)](https://snyk.io/test/github/dhondta/python-sploitkit?targetFile=requirements.txt) | ||
[![License](https://img.shields.io/pypi/l/sploitkit.svg)](https://pypi.python.org/pypi/sploitkit/) | ||
[![Donate](https://img.shields.io/badge/donate-paypal-orange.svg)](https://www.paypal.me/dhondta) | ||
|
||
|
||
This toolkit is aimed to easilly build framework consoles in a Metasploit-like style. It provides a comprehensive interface to define CLI commands, modules and models for its storage database. | ||
|
||
``` | ||
pip install sploitkit | ||
``` | ||
|
||
## :sunglasses: Usage | ||
|
||
From this point, `main.py` has the following code: | ||
|
||
```python | ||
#!/usr/bin/python3 | ||
from sploitkit import FrameworkConsole | ||
|
||
|
||
class MySploitConsole(FrameworkConsole): | ||
#TODO: set your console attributes | ||
pass | ||
|
||
|
||
if __name__ == '__main__': | ||
MySploitConsole( | ||
"MySploit", | ||
#TODO: configure your console settings | ||
).start() | ||
``` | ||
|
||
And you can run it from the terminal: | ||
|
||
![](https://github.com/dhondta/python-sploitkit/tree/master/docs/img/my-sploit-start.png) | ||
|
||
## :ballot_box_with_check: Features | ||
|
||
Sploitkit provides a base set of entities (consoles, commands, modules, models). | ||
|
||
Multiple base console levels already exist (for detailed descriptions, see [the console section](../console/index.html)): | ||
|
||
- [`FrameworkConsole`](https://github.com/dhondta/python-sploitkit/blob/master/sploitkit/core/console.py): the root console, started through `main.py` | ||
- [`ProjectConsole`](https://github.com/dhondta/python-sploitkit/blob/master/sploitkit/base/commands/project.py): the project console, for limiting the workspace to a single project, invoked through the `select [project]` command | ||
- [`ModuleConsole`](https://github.com/dhondta/python-sploitkit/blob/master/sploitkit/base/commands/module.py): the module console, started when a module is invoked through the `use [module]` command | ||
|
||
This framework provides more than 20 base commands, distributed in sets of functionalities (for detailed descriptions, see [the command section](../command/index.html)): | ||
|
||
- [*general*](https://github.com/dhondta/python-sploitkit/blob/master/sploitkit/base/commands/general.py): commands for every level (e.g. `help`, `show`, `set`) | ||
- [*module*](https://github.com/dhondta/python-sploitkit/blob/master/sploitkit/base/commands/module.py): base module-level commands (e.g. `use`, `run`, `show`) | ||
- [*project*](https://github.com/dhondta/python-sploitkit/blob/master/sploitkit/base/commands/project.py): base project-level commands (e.g. `select`, `load`, `archive`) | ||
- [*recording*](https://github.com/dhondta/python-sploitkit/blob/master/sploitkit/base/commands/recording.py): recording commands, for managing `.rc` files (`record`, `replay`) | ||
- [*root*](https://github.com/dhondta/python-sploitkit/blob/master/sploitkit/base/commands/root.py): base root-level commands (`help`) | ||
- [*utils*](https://github.com/dhondta/python-sploitkit/blob/master/sploitkit/base/commands/utils.py): utility commands (`shell`, `pydbg`, `memory`) | ||
|
||
It also holds some base models for its storage: | ||
|
||
- [*users*](https://github.com/dhondta/python-sploitkit/blob/master/sploitkit/base/models/notes.py): for user-related data (`User`, `Email`, `Password`) | ||
- [*systems*](https://github.com/dhondta/python-sploitkit/blob/master/sploitkit/base/models/systems.py): for system-related data (`Host`, `Port`, `Service`) | ||
- [*organization*](https://github.com/dhondta/python-sploitkit/blob/master/sploitkit/base/models/organization.py): for organization-related data (`Organization`, `Unit`, `Employee`) | ||
- [*notes*](https://github.com/dhondta/python-sploitkit/blob/master/sploitkit/base/models/notes.py): for linking notes to users, hosts or organizations | ||
|
||
No module is provided with the framework as it is case-specific. | ||
|
||
## :pencil2: Customization | ||
|
||
Sploitkit defines multiple types of entities for various purposes. The following entities can be subclassed: | ||
|
||
- [`Console`](https://github.com/dhondta/python-sploitkit/blob/master/sploitkit/core/console.py): a new console for a new level of interaction (e.g. [`ProjectConsole`](https://github.com/dhondta/python-sploitkit/blob/master/sploitkit/base/commands/project.py)) ; the "`root`" level is owned by the [`FrameworkConsole`](https://github.com/dhondta/python-sploitkit/blob/master/sploitkit/core/console.py), [`Console`](https://github.com/dhondta/python-sploitkit/blob/master/sploitkit/core/console.py) shall be used to create new subconsoles, to be called by commands from the root console (see an example [here](https://github.com/dhondta/python-sploitkit/blob/master/sploitkit/base/commands/module.py) for the module-level commands with [`ModuleConsole(Console)` and `Use(Command)`](https://github.com/dhondta/python-sploitkit/blob/master/sploitkit/base/commands/module.py)) | ||
- [`Command`](https://github.com/dhondta/python-sploitkit/blob/master/sploitkit/core/command.py): a new command associated with any or defined consoles using the `level` attribute | ||
- [`Module`](https://github.com/dhondta/python-sploitkit/blob/master/sploitkit/core/module.py): a new module associated to a console | ||
- [`Model`, `BaseModel`, `StoreExtension`](https://github.com/dhondta/python-sploitkit/blob/master/sploitkit/core/model.py): respectively for new models, their association tables and store additional methods (e.g. [`User(Model)`, `Email(Model)`, `UserEmail(BaseModel)`, `UsersStorage(StoreExtension)`](https://github.com/dhondta/python-sploitkit/blob/master/sploitkit/base/models/users.py)) | ||
|
||
|
||
## :clap: Supporters | ||
|
||
[![Stargazers repo roster for @dhondta/python-sploitkit](https://reporoster.com/stars/dark/dhondta/python-sploitkit)](https://github.com/dhondta/python-sploitkit/stargazers) | ||
|
||
[![Forkers repo roster for @dhondta/python-sploitkit](https://reporoster.com/forks/dark/dhondta/python-sploitkit)](https://github.com/dhondta/python-sploitkit/network/members) | ||
|
||
<p align="center"><a href="#"><img src="https://img.shields.io/badge/Back%20to%20top--lightgrey?style=social" alt="Back to top" height="20"/></a></p> | ||
<p align="center"><img src="https://github.com/dhondta/python-sploitkit/raw/main/docs/pages/img/logo.png"></p> | ||
<h1 align="center">SploitKit <a href="https://twitter.com/intent/tweet?text=SploitKit%20-%20Devkit%20for%20building%20Metasploit-like%20consoles.%0D%0APython%20library%20for%20easilly%20building%20framework%20consoles%20in%20a%20Metasploit-like%20style%20with%20a%20comprehensive%20API.%0D%0Ahttps%3a%2f%2fgithub%2ecom%2fdhondta%2fpython-sploitkit%0D%0A&hashtags=python,programming,devkit,framework,console,ctftools"><img src="https://img.shields.io/badge/Tweet--lightgrey?logo=twitter&style=social" alt="Tweet" height="20"/></a></h1> | ||
<h3 align="center">Make a Metasploit-like console.</h3> | ||
|
||
[![PyPi](https://img.shields.io/pypi/v/sploitkit.svg)](https://pypi.python.org/pypi/sploitkit/) | ||
[![Read The Docs](https://readthedocs.org/projects/python-sploitkit/badge/?version=latest)](https://python-sploitkit.readthedocs.io/en/latest/?badge=latest) | ||
[![Build Status](https://github.com/dhondta/python-sploitkit/actions/workflows/python-package.yml/badge.svg)](https://github.com/dhondta/python-sploitkit/actions/workflows/python-package.yml) | ||
[![Coverage Status](https://raw.githubusercontent.com/dhondta/python-sploitkit/main/docs/coverage.svg)](#) | ||
[![Python Versions](https://img.shields.io/pypi/pyversions/sploitkit.svg)](https://pypi.python.org/pypi/sploitkit/) | ||
[![Known Vulnerabilities](https://snyk.io/test/github/dhondta/python-sploitkit/badge.svg?targetFile=requirements.txt)](https://snyk.io/test/github/dhondta/python-sploitkit?targetFile=requirements.txt) | ||
[![License](https://img.shields.io/pypi/l/sploitkit.svg)](https://pypi.python.org/pypi/sploitkit/) | ||
|
||
|
||
This toolkit is aimed to easilly build framework consoles in a Metasploit-like style. It provides a comprehensive interface to define CLI commands, modules and models for its storage database. | ||
|
||
``` | ||
pip install sploitkit | ||
``` | ||
|
||
## :sunglasses: Usage | ||
|
||
From this point, `main.py` has the following code: | ||
|
||
```python | ||
#!/usr/bin/python3 | ||
from sploitkit import FrameworkConsole | ||
|
||
|
||
class MySploitConsole(FrameworkConsole): | ||
#TODO: set your console attributes | ||
pass | ||
|
||
|
||
if __name__ == '__main__': | ||
MySploitConsole( | ||
"MySploit", | ||
#TODO: configure your console settings | ||
).start() | ||
``` | ||
|
||
And you can run it from the terminal: | ||
|
||
![](https://github.com/dhondta/python-sploitkit/tree/main/docs/pages/img/my-sploit-start.png) | ||
|
||
## :ballot_box_with_check: Features | ||
|
||
Sploitkit provides a base set of entities (consoles, commands, modules, models). | ||
|
||
Multiple base console levels already exist (for detailed descriptions, see [the console section](../console/index.html)): | ||
|
||
- [`FrameworkConsole`](https://github.com/dhondta/python-sploitkit/blob/main/sploitkit/core/console.py): the root console, started through `main.py` | ||
- [`ProjectConsole`](https://github.com/dhondta/python-sploitkit/blob/main/sploitkit/base/commands/project.py): the project console, for limiting the workspace to a single project, invoked through the `select [project]` command | ||
- [`ModuleConsole`](https://github.com/dhondta/python-sploitkit/blob/main/sploitkit/base/commands/module.py): the module console, started when a module is invoked through the `use [module]` command | ||
|
||
This framework provides more than 20 base commands, distributed in sets of functionalities (for detailed descriptions, see [the command section](../command/index.html)): | ||
|
||
- [*general*](https://github.com/dhondta/python-sploitkit/blob/main/sploitkit/base/commands/general.py): commands for every level (e.g. `help`, `show`, `set`) | ||
- [*module*](https://github.com/dhondta/python-sploitkit/blob/main/sploitkit/base/commands/module.py): base module-level commands (e.g. `use`, `run`, `show`) | ||
- [*project*](https://github.com/dhondta/python-sploitkit/blob/main/sploitkit/base/commands/project.py): base project-level commands (e.g. `select`, `load`, `archive`) | ||
- [*recording*](https://github.com/dhondta/python-sploitkit/blob/main/sploitkit/base/commands/recording.py): recording commands, for managing `.rc` files (`record`, `replay`) | ||
- [*root*](https://github.com/dhondta/python-sploitkit/blob/main/sploitkit/base/commands/root.py): base root-level commands (`help`) | ||
- [*utils*](https://github.com/dhondta/python-sploitkit/blob/main/sploitkit/base/commands/utils.py): utility commands (`shell`, `pydbg`, `memory`) | ||
|
||
It also holds some base models for its storage: | ||
|
||
- [*users*](https://github.com/dhondta/python-sploitkit/blob/main/sploitkit/base/models/notes.py): for user-related data (`User`, `Email`, `Password`) | ||
- [*systems*](https://github.com/dhondta/python-sploitkit/blob/main/sploitkit/base/models/systems.py): for system-related data (`Host`, `Port`, `Service`) | ||
- [*organization*](https://github.com/dhondta/python-sploitkit/blob/main/sploitkit/base/models/organization.py): for organization-related data (`Organization`, `Unit`, `Employee`) | ||
- [*notes*](https://github.com/dhondta/python-sploitkit/blob/main/sploitkit/base/models/notes.py): for linking notes to users, hosts or organizations | ||
|
||
No module is provided with the framework as it is case-specific. | ||
|
||
## :pencil2: Customization | ||
|
||
Sploitkit defines multiple types of entities for various purposes. The following entities can be subclassed: | ||
|
||
- [`Console`](https://github.com/dhondta/python-sploitkit/blob/main/sploitkit/core/console.py): a new console for a new level of interaction (e.g. [`ProjectConsole`](https://github.com/dhondta/python-sploitkit/blob/main/sploitkit/base/commands/project.py)) ; the "`root`" level is owned by the [`FrameworkConsole`](https://github.com/dhondta/python-sploitkit/blob/main/sploitkit/core/console.py), [`Console`](https://github.com/dhondta/python-sploitkit/blob/main/sploitkit/core/console.py) shall be used to create new subconsoles, to be called by commands from the root console (see an example [here](https://github.com/dhondta/python-sploitkit/blob/main/sploitkit/base/commands/module.py) for the module-level commands with [`ModuleConsole(Console)` and `Use(Command)`](https://github.com/dhondta/python-sploitkit/blob/main/sploitkit/base/commands/module.py)) | ||
- [`Command`](https://github.com/dhondta/python-sploitkit/blob/main/sploitkit/core/command.py): a new command associated with any or defined consoles using the `level` attribute | ||
- [`Module`](https://github.com/dhondta/python-sploitkit/blob/main/sploitkit/core/module.py): a new module associated to a console | ||
- [`Model`, `BaseModel`, `StoreExtension`](https://github.com/dhondta/python-sploitkit/blob/main/sploitkit/core/model.py): respectively for new models, their association tables and store additional methods (e.g. [`User(Model)`, `Email(Model)`, `UserEmail(BaseModel)`, `UsersStorage(StoreExtension)`](https://github.com/dhondta/python-sploitkit/blob/main/sploitkit/base/models/users.py)) | ||
|
||
|
||
## :clap: Supporters | ||
|
||
[![Stargazers repo roster for @dhondta/python-sploitkit](https://reporoster.com/stars/dark/dhondta/python-sploitkit)](https://github.com/dhondta/python-sploitkit/stargazers) | ||
|
||
[![Forkers repo roster for @dhondta/python-sploitkit](https://reporoster.com/forks/dark/dhondta/python-sploitkit)](https://github.com/dhondta/python-sploitkit/network/members) | ||
|
||
<p align="center"><a href="#"><img src="https://img.shields.io/badge/Back%20to%20top--lightgrey?style=social" alt="Back to top" height="20"/></a></p> |
Oops, something went wrong.