havoc


Namehavoc JSON
Version 1.0.2 PyPI version JSON
download
home_pagehttps://havoc.sh/
SummaryThis is the ./HAVOC REST API library Package
upload_time2023-12-05 22:51:53
maintainer
docs_urlNone
authorTom D'Aquino
requires_python>=3.7, <4
license
keywords ./havoc rest api library
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            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)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://havoc.sh/",
    "name": "havoc",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7, <4",
    "maintainer_email": "",
    "keywords": "./HAVOC REST API library",
    "author": "Tom D'Aquino",
    "author_email": "tom@havoc.sh",
    "download_url": "https://files.pythonhosted.org/packages/59/a2/f37533df08a405c34484c58b04441f455ebe9d67ccd5b73f34d5870ff465/havoc-1.0.2.tar.gz",
    "platform": null,
    "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.\n\n### The basics\n\nTo install the havoc library:\n\n```\npip install havoc\n```\n\nTo use the havoc library:\n \n```\nimport havoc\n\napi_region='<aws-region>' # The AWS region for your havoc.sh deployment\napi_domain_name='<domain-name>' # The domain name for your havoc.sh REST API\napi_key='<api-key>' # The API key for your havoc.sh user\nsecret='<secret>' # The secret that accompanies your API key\n```\n\nSetup the connection:\n\n```\nh = havoc.Connect(api_region, api_domain_name, api_key, secret)\n```\n\nPost a request to the REST API:\n```\nuri='<uri>' # The full URI including domain-name and api-endpoint for the REST API call you want to make\npayload='<payload>' # The python dictionary containing the instructions for the REST API call you want to make\nh.post(uri, payload)\n```\n\n### Examples\n\n#### Managing task types\nList task types:\n```\nuri='https://havoc-my-campaign-api.example.com/manage'\npayload = {\n    'resource': 'task_type',\n    'command': 'list'\n}\nh.post(uri, payload)\n```\n\n#### Manage portgroups\nList portgroups:\n```\nuri='https://havoc-my-campaign-api.example.com/manage'\npayload = {\n    'resource': 'portgroup',\n    'command': 'list'\n}\nh.post(uri, payload)\n```\n\nGet portgroup details:\n```\nportgroup_name = 'web'\nuri='https://havoc-my-campaign-api.example.com/manage'\npayload = {\n    'resource': 'portgroup',\n    'command': 'get',\n    'detail': {\n        'portgroup_name': portgroup_name\n    }\n}\nh.post(uri, payload)\n```\n\nCreate a portgroup:\n```\nuri='https://havoc-my-campaign-api.example.com/manage'\npayload = {\n    'resource': 'portgroup',\n    'command': 'create',\n    'detail': {\n        'portgroup_name': 'web',\n        'portgroup_description': 'standard web ports'\n    }\n}\nh.post(uri, payload)\n```\n\nAdd a rule to a portgroup:\n```\nportgroup_name = 'web'\nuri='https://havoc-my-campaign-api.example.com/manage'\npayload = {\n    'resource': 'portgroup',\n    'command': 'update',\n    'detail': {\n        'portgroup_name': portgroup_name,\n        'portgroup_action': 'add',\n        'ip_ranges': [\n            {\n                'CidrIp': '1.2.3.4/32'\n            }\n        ],\n        'port': 80,\n        'ip_protocol': 'tcp'\n    }\n}\nh.post(uri, payload)\n```\n\nRemove a rule from a portgroup:\n```\nportgroup_name = 'web'\nuri='https://havoc-my-campaign-api.example.com/manage'\npayload = {\n    'resource': 'portgroup',\n    'command': 'update',\n    'detail': {\n        'portgroup_name': portgroup_name,\n        'portgroup_action': 'remove',\n        'ip_ranges': [\n            {\n                'CidrIp': '1.2.3.4/32'\n            }\n        ],\n        'port': 80,\n        'ip_protocol': 'tcp'\n    }\n}\nh.post(uri, payload)\n```\n\nDelete a portgroup:\n```\nportgroup_name = 'web'\nuri='https://havoc-my-campaign-api.example.com/manage'\npayload = {\n    'resource': 'portgroup',\n    'command': 'delete',\n    'detail': {\n        'portgroup_name': portgroup_name\n    }\n}\nh.post(uri, payload)\n```\n\n#### Manage tasks\nList tasks:\n```\nuri='https://havoc-my-campaign-api.example.com/manage'\npayload = {\n    'resource': 'task',\n    'command': 'list'\n}\nh.post(uri, payload)\n```\n\nForce kill a task:\n```\ntask_name = 'nmap-test'\nuri='https://havoc-my-campaign-api.example.com/manage'\npayload = {\n    'resource': 'task',\n    'command': 'kill',\n    'detail': {\n        'task_name': task_name\n    }\n}\nh.post(uri, payload)\n```\n\n#### Run and interact with tasks\nExecute an NMAP task:\n```\nuri='https://havoc-my-campaign-api.example.com/task_control'\npayload = {\n    'action': 'execute',\n    'detail': {\n        'task_type': 'nmap',\n        'task_name': 'nmap-test',\n        'end_time': 'None'\n    }\n}\nh.post(uri, payload)\n```\n\nRun a basic NMAP Port Scan for port 80:\n```\ntask_name = 'nmap-test'\ntarget = '<IP address to scan>'\nuri='https://havoc-my-campaign-api.example.com/task_control'\npayload={\n    'action': 'interact',\n    'detail': {\n        'task_name': task_name,\n        'instruct_instance': 'nmap1',\n        'instruct_command': 'run_scan',\n        'instruct_args': {\n            'options': '-A -T4 -Pn -p 80',\n            'target': target\n        }\n    }\n}\nh.post(uri, payload)\n```\n\nKill an NMAP task:\n```\ntask_name = 'nmap-test'\nuri='https://havoc-my-campaign-api.example.com/task_control'\npayload = {\n    'action': 'interact',\n    'detail': {\n        'task_name': task_name,\n        'instruct_command': 'terminate'\n    }\n}\nh.post(uri, payload)\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "This is the ./HAVOC REST API library Package",
    "version": "1.0.2",
    "project_urls": {
        "Bug Tracker": "https://github.com/havocsh/havoc-pkg/issues",
        "Documentation": "https://github.com/havocsh/havoc-pkg/blob/main/README.md",
        "Homepage": "https://havoc.sh/",
        "Source Code": "https://github.com/havocsh/havoc-pkg"
    },
    "split_keywords": [
        "./havoc",
        "rest",
        "api",
        "library"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4a66dcd6e4b898acd568d2e9afcc3244690b8c23e3ce3a4810bb04c81d472e08",
                "md5": "5fa8242869c81643f8c4ec72c820331b",
                "sha256": "52c3b9394f65ba51ede258eb8f1aa3403a7451a69eaee804f39674e99abeb315"
            },
            "downloads": -1,
            "filename": "havoc-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5fa8242869c81643f8c4ec72c820331b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7, <4",
            "size": 21365,
            "upload_time": "2023-12-05T22:51:51",
            "upload_time_iso_8601": "2023-12-05T22:51:51.911808Z",
            "url": "https://files.pythonhosted.org/packages/4a/66/dcd6e4b898acd568d2e9afcc3244690b8c23e3ce3a4810bb04c81d472e08/havoc-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "59a2f37533df08a405c34484c58b04441f455ebe9d67ccd5b73f34d5870ff465",
                "md5": "208f6f080abb491c6603d0fd9c5a87ba",
                "sha256": "2efd2c812087dba1483ec71cac436bcb87d59c2b20377f2df310249030b0e4e1"
            },
            "downloads": -1,
            "filename": "havoc-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "208f6f080abb491c6603d0fd9c5a87ba",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7, <4",
            "size": 22738,
            "upload_time": "2023-12-05T22:51:53",
            "upload_time_iso_8601": "2023-12-05T22:51:53.481000Z",
            "url": "https://files.pythonhosted.org/packages/59/a2/f37533df08a405c34484c58b04441f455ebe9d67ccd5b73f34d5870ff465/havoc-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-05 22:51:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "havocsh",
    "github_project": "havoc-pkg",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "havoc"
}
        
Elapsed time: 0.15275s