Infosec machines API created in Python
Project description
infosecmachines
A Python client for interacting with infosecmachines.io.
This library provides a simple and intuitive API to search, filter, and retrieve information about infosec training machines.
🚀 Features
- Easy integration with infosecmachines.io.
- Synchronous and asynchronous clients.
- Search by platform, difficulty, IP, writeups, and more.
- Retrieve random machines or all available machines.
- Pythonic interface with proper exception handling.
📦 Installation
# Using git
git clone https://github.com/SelfDreamer/Infosecmachines
cd Infosecmachines
python3 -m venv .venv
source .venv/bin/activate # This is on UNIX, on PowerShell Windows will be \.venv\scripts\Activate.ps1
pip3 install -r requirements.txt
# Using pip
python3 -m venv .venv
source .venv/bin/activate
pip install infosecmachines
⚡ Quick Start
from infosecmachines import Client
# Create a client
client = Client()
# The initial request
client.initial_request()
# Search by machine name
machine = client.search_machine("Nocturnal")
print(machine)
# Get all available machines
machines = client.get_all_machines(return_type='Normal')
print(len(machines))
Asynchronous Client
import asyncio
from infosecmachines import AsyncClient
async def main():
client = AsyncClient()
await client.initial_request()
machine = await client.search_machine("Blue")
print(machine)
if __name__ == '__main__':
asyncio.run(main=main())
📚 API Overview
-
Client.search_machine(name: str) -> tuple[dict, ...] -
Client.search_platform(platform: str) -> tuple[str, ...] -
Client.search_difficulty(difficulty: str) -> tuple[str, ...] -
Client.search_ip(adress: str) -> tuple[dict[str, ...], ...] -
Client.search_writeup(machine: str) -> tuple[Writeup, ...] -
Client.get_all_machines() -> tuple[str, ...] -
Client.get_random_machine() -> str -
Client.search_techniques(techniques: tuple[str, ...], return_type: Literal['Generator', 'Normal']) -> Generator[str, None, None] | tuple[str, ...] -
Client.search_certificates(certificates: tuple[str, ...], return_type: Literal['Generator', 'Normal']) -> Generator[str, None, None] | tuple[str, ...] -
Client.advanced_search(objects: tuple[str, ...], return_type: Literal['Generator', 'Normal']) -> Generator[str, None, None] | tuple[str, ...] -
Client.machine_counts -> dict
[!NOTE]
machine_countsit's a property
Exceptions
InitialRequestException– Raised when the initial request is missing or fails.InitialRequestAsyncException- Raised when in the async client the request is missing.
Example
import infosecmachines as info
client = info.Client()
# Raise InitialRequestException because the initial request is missing
try:
results = client.search_machine("Tentacle")
except InitialRequestException as err:
print(f"Error ocurried: {err}")
exit(1)
print(results[0]['name'])
🤝 Contributing
Contributions are welcome! Please fork the repo and submit a pull request with clear commit messages.
🙌 Acknowledgements
- infosecmachines.io for providing the platform.
- Inspired by common patterns from Python API clients.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file infosecmachines-0.0.1.tar.gz.
File metadata
- Download URL: infosecmachines-0.0.1.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
898acee13a0ebca5f38cf7d51b53ada8968793bc85b13a2a37c054d97598c1a6
|
|
| MD5 |
10bde7a27b0f15028d16052ab7e84a62
|
|
| BLAKE2b-256 |
f72027d1a511e4e6ef1b93eabb2cabb0535b84083e7248d768a93bdf0e4435d4
|
File details
Details for the file infosecmachines-0.0.1-py3-none-any.whl.
File metadata
- Download URL: infosecmachines-0.0.1-py3-none-any.whl
- Upload date:
- Size: 17.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1acb457bdc1baf1ab88e498bf5772bc4fc57f1e2757197711789a5c589c79d2a
|
|
| MD5 |
545be90f30c6a058a9b463451d556687
|
|
| BLAKE2b-256 |
8808afd975ec9f4b16e5b1385d614c7b64a28ad0cfa45c9f8cd7195329f9ff32
|