Skip to main content

Infosec machines API created in Python

Project description

infosecmachines

Python License Status

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_counts it'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.

Author

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

infosecmachines-0.0.1.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

infosecmachines-0.0.1-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

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

Hashes for infosecmachines-0.0.1.tar.gz
Algorithm Hash digest
SHA256 898acee13a0ebca5f38cf7d51b53ada8968793bc85b13a2a37c054d97598c1a6
MD5 10bde7a27b0f15028d16052ab7e84a62
BLAKE2b-256 f72027d1a511e4e6ef1b93eabb2cabb0535b84083e7248d768a93bdf0e4435d4

See more details on using hashes here.

File details

Details for the file infosecmachines-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for infosecmachines-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1acb457bdc1baf1ab88e498bf5772bc4fc57f1e2757197711789a5c589c79d2a
MD5 545be90f30c6a058a9b463451d556687
BLAKE2b-256 8808afd975ec9f4b16e5b1385d614c7b64a28ad0cfa45c9f8cd7195329f9ff32

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page