This is the ./HAVOC REST API library Package
Project description
Havoc.sh provides on-demand, cloud hosted attack infrastructure that is API based, automation friendly, massively scalable, collaborative and reportable. This Python3 library provides the base functionality for interacting with the havoc.sh REST API.
The basics
To install the havoc library:
pip install havoc
To use the havoc library:
import havoc
api_region='<aws-region>' # The AWS region for your havoc.sh deployment
api_domain_name='<domain-name>' # The domain name for your havoc.sh REST API
api_key='<api-key>' # The API key for your havoc.sh user
secret='<secret>' # The secret that accompanies your API key
Setup the connection:
h = havoc.Connect(api_region, api_domain_name, api_key, secret)
Post a request to the REST API:
uri='<uri>' # The full URI including domain-name and api-endpoint for the REST API call you want to make
payload='<payload>' # The python dictionary containing the instructions for the REST API call you want to make
h.post(uri, payload)
Examples
Managing task types
List task types:
uri='https://havoc-my-campaign-api.example.com/manage'
payload = {
'resource': 'task_type',
'command': 'list'
}
h.post(uri, payload)
Manage portgroups
List portgroups:
uri='https://havoc-my-campaign-api.example.com/manage'
payload = {
'resource': 'portgroup',
'command': 'list'
}
h.post(uri, payload)
Get portgroup details:
portgroup_name = 'web'
uri='https://havoc-my-campaign-api.example.com/manage'
payload = {
'resource': 'portgroup',
'command': 'get',
'detail': {
'portgroup_name': portgroup_name
}
}
h.post(uri, payload)
Create a portgroup:
uri='https://havoc-my-campaign-api.example.com/manage'
payload = {
'resource': 'portgroup',
'command': 'create',
'detail': {
'portgroup_name': 'web',
'portgroup_description': 'standard web ports'
}
}
h.post(uri, payload)
Add a rule to a portgroup:
portgroup_name = 'web'
uri='https://havoc-my-campaign-api.example.com/manage'
payload = {
'resource': 'portgroup',
'command': 'update',
'detail': {
'portgroup_name': portgroup_name,
'portgroup_action': 'add',
'ip_ranges': [
{
'CidrIp': '1.2.3.4/32'
}
],
'port': 80,
'ip_protocol': 'tcp'
}
}
h.post(uri, payload)
Remove a rule from a portgroup:
portgroup_name = 'web'
uri='https://havoc-my-campaign-api.example.com/manage'
payload = {
'resource': 'portgroup',
'command': 'update',
'detail': {
'portgroup_name': portgroup_name,
'portgroup_action': 'remove',
'ip_ranges': [
{
'CidrIp': '1.2.3.4/32'
}
],
'port': 80,
'ip_protocol': 'tcp'
}
}
h.post(uri, payload)
Delete a portgroup:
portgroup_name = 'web'
uri='https://havoc-my-campaign-api.example.com/manage'
payload = {
'resource': 'portgroup',
'command': 'delete',
'detail': {
'portgroup_name': portgroup_name
}
}
h.post(uri, payload)
Manage tasks
List tasks:
uri='https://havoc-my-campaign-api.example.com/manage'
payload = {
'resource': 'task',
'command': 'list'
}
h.post(uri, payload)
Force kill a task:
task_name = 'nmap-test'
uri='https://havoc-my-campaign-api.example.com/manage'
payload = {
'resource': 'task',
'command': 'kill',
'detail': {
'task_name': task_name
}
}
h.post(uri, payload)
Run and interact with tasks
Execute an NMAP task:
uri='https://havoc-my-campaign-api.example.com/task_control'
payload = {
'action': 'execute',
'detail': {
'task_type': 'nmap',
'task_name': 'nmap-test',
'end_time': 'None'
}
}
h.post(uri, payload)
Run a basic NMAP Port Scan for port 80:
task_name = 'nmap-test'
target = '<IP address to scan>'
uri='https://havoc-my-campaign-api.example.com/task_control'
payload={
'action': 'interact',
'detail': {
'task_name': task_name,
'instruct_instance': 'nmap1',
'instruct_command': 'run_scan',
'instruct_args': {
'options': '-A -T4 -Pn -p 80',
'target': target
}
}
}
h.post(uri, payload)
Kill an NMAP task:
task_name = 'nmap-test'
uri='https://havoc-my-campaign-api.example.com/task_control'
payload = {
'action': 'interact',
'detail': {
'task_name': task_name,
'instruct_command': 'terminate'
}
}
h.post(uri, payload)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file havoc-1.0.2.tar.gz
.
File metadata
- Download URL: havoc-1.0.2.tar.gz
- Upload date:
- Size: 22.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2efd2c812087dba1483ec71cac436bcb87d59c2b20377f2df310249030b0e4e1 |
|
MD5 | 208f6f080abb491c6603d0fd9c5a87ba |
|
BLAKE2b-256 | 59a2f37533df08a405c34484c58b04441f455ebe9d67ccd5b73f34d5870ff465 |
File details
Details for the file havoc-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: havoc-1.0.2-py3-none-any.whl
- Upload date:
- Size: 21.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52c3b9394f65ba51ede258eb8f1aa3403a7451a69eaee804f39674e99abeb315 |
|
MD5 | 5fa8242869c81643f8c4ec72c820331b |
|
BLAKE2b-256 | 4a66dcd6e4b898acd568d2e9afcc3244690b8c23e3ce3a4810bb04c81d472e08 |