
Un pacchetto Python viene utilizzato per eseguire i test di Atomic Red Team (Atomics) attraverso molteplici ambienti di sistemi operativi.
(Novità?)
atomic-operator consente ai professionisti della sicurezza di testare le loro capacità di rilevamento e difesa rispetto alle tecniche prescritte definite in atomic-red-team. Utilizzando un framework di test come atomic-operator, puoi identificare sia le tue capacità difensive che le lacune nella copertura difensiva.
Inoltre, atomic-operator può essere utilizzato in molte altre situazioni come:
iaas:awsatomic-operator è un pacchetto solo Python ospitato su PyPi e funziona con Python 3.6 e successivi.
Se desideri una versione PowerShell, dai un'occhiata a Invoke-AtomicRedTeam.
pip install atomic-operator
I passaggi successivi ti guideranno nella configurazione e nell'esecuzione di atomic-operator.
Puoi installare atomic-operator su OS X, Linux o Windows. Puoi anche installarlo direttamente dal sorgente. Per installare, vedi i comandi sotto l'intestazione del sistema operativo pertinente, di seguito.
Le seguenti librerie sono richieste e installate da atomic-operator:
pyyaml==5.4.1
fire==0.4.0
requests==2.26.0
attrs==21.2.0
pick==1.2.0
pip install atomic-operator
git clone https://github.com/swimlane/atomic-operator.git
cd atomic-operator
# Satisfy ModuleNotFoundError: No module named 'setuptools_rust'
brew install rust
pip3 install --upgrade pip
pip3 install setuptools_rust
# Back to our regularly scheduled programming . . .
pip install -r requirements.txt
python setup.py install
git clone https://github.com/swimlane/atomic-operator.git
cd atomic-operator
pip install -r requirements.txt
python setup.py install
Puoi eseguire atomic-operator dalla riga di comando o all'interno dei tuoi script Python. Per usare atomic-operator dalla riga di comando, inserisci semplicemente quanto segue nel tuo terminale:
atomic-operator --help
atomic-operator run -- --help
Nota che per vedere i dettagli sul comando run esegui
atomic-operator run -- --helpe NONatomic-operator run --help
Per utilizzare atomic-operator devi avere uno o più test atomic-red-team (Atomics) sul tuo sistema locale. atomic-operator ti offre la possibilità di scaricare il repository Atomic Red Team. Puoi farlo eseguendo quanto segue dalla riga di comando:
atomic-operator get_atomics
# You can specify the destination directory by using the --destination flag
atomic-operator get_atomics --destination "/tmp/some_directory"
Per eseguire un test devi fornire alcune proprietà aggiuntive (e opzioni se desiderato). Il metodo principale per eseguire i test si chiama run.
# This will run ALL tests compatiable with your local operating system
atomic-operator run --atomics-path "/tmp/some_directory/redcanaryco-atomic-red-team-3700624"
Puoi selezionare test individuali quando fornisci una o più tecniche specifiche. Ad esempio, eseguendo quanto segue sulla riga di comando:
atomic-operator run --techniques T1564.001 --select_tests
Verrà mostrato all'utente un elenco di selezione dei test associati a quella tecnica. Un utente può selezionare uno o più test usando la barra spaziatrice per evidenziare il test desiderato:
Select Test(s) for Technique T1564.001 (Hide Artifacts: Hidden Files and Directories)
* Create a hidden file in a hidden directory (61a782e5-9a19-40b5-8ba4-69a4b9f3d7be)
Mac Hidden file (cddb9098-3b47-4e01-9d3b-6f5f323288a9)
Create Windows System File with Attrib (f70974c8-c094-4574-b542-2c545af95a32)
Create Windows Hidden File with Attrib (dadb792e-4358-4d8d-9207-b771faa0daa5)
Hidden files (3b7015f2-3144-4205-b799-b05580621379)
Hide a Directory (b115ecaf-3b24-4ed2-aefe-2fcb9db913d3)
Show all hidden files (9a1ec7da-b892-449f-ad68-67066d04380c)
Quanto segue ti permetterà di fornire argomenti di input personalizzati per i test. Lo fai fornendo un dizionario di chiavi e valori come dizionario al parametro input_arguments sul metodo run.
atomic-operator run --techniques T1564.001 --input_arguments '{"project-id": "some_value", "another_key": "another value"}'
# Per favore includi apici singoli attorno al valore di input_arguments.
Per eseguire un test in remoto devi fornire alcune proprietà aggiuntive (e opzioni se desiderato). Il metodo principale per eseguire i test si chiama run.
# This will run ALL tests compatiable with your local operating system
atomic-operator run --atomics-path "/tmp/some_directory/redcanaryco-atomic-red-team-3700624" --hosts "10.32.1.0" --username "my_username" --password "my_password"
Quando esegui comandi in remoto su host Windows potresti aver bisogno di configurare PSRemoting. Vedi i dettagli qui: Windows Remoting
Puoi vedere parametri aggiuntivi eseguendo il seguente comando:
atomic-operator run -- --help
| Nome Parametro | Tipo | Default | Descrizione |
|---|---|---|---|
| techniques | list | all | Una o più tecniche definite dall'ID attack_technique. |
| test_guids | list | None | Uno o più GUID di test Atomici. |
| select_tests | bool | False | Seleziona uno o più test atomici da eseguire quando vengono specificate delle tecniche. |
| atomics_path | str | os.getcwd() | Il percorso dei test Atomici. |
| input_arguments | dict | {} | Un dizionario di argomenti di input da passare al test. |
| check_prereqs | bool | False | Se controllare o meno le dipendenze prerequisiti (prereq_comand). |
| get_prereqs | bool | False | Se si desidera recuperare i prerequisiti. |
| cleanup | bool | False | Se si desidera eseguire comandi di pulizia. |
| copy_source_files | bool | True | Se si desidera copiare eventuali file sorgente correlati (src, bin, ecc.) su un host remoto. |
| command_timeout | int | 20 | Durata del timeout per ogni comando. |
| debug | bool | False | Se si desidera visualizzare i dettagli sui test in esecuzione. |
| prompt_for_input_args | bool | False | Se si desidera richiedere argomenti di input per ogni test. |
| return_atomics | bool | False | Se si desidera restituire gli atomics invece di eseguirli. |
| config_file | str | None | Percorso di un file di configurazione utilizzato per automatizzare atomic-operator in ambienti. |
| config_file_only | bool | False | Se si desidera eseguire test solo in base al file di configurazione fornito. |
| hosts | list | None | Un elenco di uno o più host remoti su cui eseguire un test. |
| username | str | None | Nome utente per l'autenticazione delle connessioni remote. |
| password | str | None | Password per l'autenticazione delle connessioni remote. |
| ssh_key_path |
Dovresti vedere un output simile al seguente:
NAME
atomic-operator run - The main method in which we run Atomic Red Team tests.
SYNOPSIS
atomic-operator run <flags>
DESCRIPTION
The main method in which we run Atomic Red Team tests.
FLAGS
--techniques=TECHNIQUES
Type: list
Default: ['all']
One or more defined techniques by attack_technique ID. Defaults to 'all'.
--test_guids=TEST_GUIDS
Type: list
Default: []
One or more Atomic test GUIDs. Defaults to None.
--select_tests=SELECT_TESTS
Type: bool
Default: False
Select one or more tests from provided techniques. Defaults to False.
--atomics_path=ATOMICS_PATH
Default: '/U...
The path of Atomic tests. Defaults to os.getcwd().
--input_arguments={}
Default: {}
A dictionary of input arguments to pass to the test.
--check_prereqs=CHECK_PREREQS
Default: False
Whether or not to check for prereq dependencies (prereq_comand). Defaults to False.
--get_prereqs=GET_PREREQS
Default: False
Whether or not you want to retrieve prerequisites. Defaults to False.
--cleanup=CLEANUP
Default: False
Whether or not you want to run cleanup command(s). Defaults to False.
--copy_source_files=COPY_SOURCE_FILES
Default: True
Whether or not you want to copy any related source (src, bin, etc.) files to a remote host. Defaults to True.
--command_timeout=COMMAND_TIMEOUT
Default: 20
Timeout duration for each command. Defaults to 20.
--debug=DEBUG
Default: False
Whether or not you want to output details about tests being ran. Defaults to False.
--prompt_for_input_args=PROMPT_FOR_INPUT_ARGS
Default: False
Whether you want to prompt for input arguments for each test. Defaults to False.
--return_atomics=RETURN_ATOMICS
Default: False
Whether or not you want to return atomics instead of running them. Defaults to False.
--config_file=CONFIG_FILE
Type: Optional[]
Default: None
A path to a conifg_file which is used to automate atomic-operator in environments. Default to None.
--config_file_only=CONFIG_FILE_ONLY
Default: False
Whether or not you want to run tests based on the provided config_file only. Defaults to False.
--hosts=HOSTS
Default: []
A list of one or more remote hosts to run a test on. Defaults to [].
--username=USERNAME
Type: Optional[]
Default: None
Username for authentication of remote connections. Defaults to None.
--password=PASSWORD
Type: Optional[]
Default: None
Password for authentication of remote connections. Defaults to None.
--ssh_key_path=SSH_KEY_PATH
Type: Optional[]
Default: None
Path to a SSH Key for authentication of remote connections. Defaults to None.
--private_key_string=PRIVATE_KEY_STRING
Type: Optional[]
Default: None
A private SSH Key string used for authentication of remote connections. Defaults to None.
--verify_ssl=VERIFY_SSL
Default: False
Whether or not to verify ssl when connecting over RDP (windows). Defaults to False.
--ssh_port=SSH_PORT
Default: 22
SSH port for authentication of remote connections. Defaults to 22.
--ssh_timeout=SSH_TIMEOUT
Default: 5
SSH timeout for authentication of remote connections. Defaults to 5.
Additional flags are accepted.
If provided, keys matching inputs for a test will be replaced. Default is None.
Oltre alla possibilità di passare parametri con atomic-operator, puoi anche passare il percorso di un config_file che contiene tutti i test atomici e i loro potenziali input. Puoi vedere un esempio di questo config_file qui:
atomic_tests:
- guid: f7e6ec05-c19e-4a80-a7e7-241027992fdb
input_arguments:
output_file:
value: custom_output.txt
input_file:
value: custom_input.txt
- guid: 3ff64f0b-3af2-3866-339d-38d9791407c3
input_arguments:
second_arg:
value: SWAPPPED argument
- guid: 32f90516-4bc9-43bd-b18d-2cbe0b7ca9b2
Per utilizzare atomic-operator devi istanziare un oggetto AtomicOperator.
from atomic_operator import AtomicOperator
operator = AtomicOperator()
# This will download a local copy of the atomic-red-team repository
print(operator.get_atomics('/tmp/some_directory'))
# this will run tests on your local system
operator.run(
technique: str='All',
atomics_path=os.getcwd(),
check_dependencies=False,
get_prereqs=False,
cleanup=False,
command_timeout=20,
debug=False,
prompt_for_input_args=False,
**kwargs
)
Per favore crea un issue se hai domande o incontri problemi.
Per favore leggi CONTRIBUTING.md per dettagli sul nostro codice di condotta e sul processo per inviarci pull request.
Usiamo SemVer per il versionamento.
Josh Rickard - Lavoro iniziale - MSAdministrator
Vedi anche l'elenco dei contributori che hanno partecipato a questo progetto.
Questo progetto è concesso in licenza secondo i termini della licenza MIT - vedi il file LICENSE per i dettagli
| str |
| None |
| Percorso di una chiave SSH per l'autenticazione delle connessioni remote. |
| private_key_string | str | None | Una stringa di chiave SSH privata utilizzata per l'autenticazione delle connessioni remote. |
| verify_ssl | bool | False | Se verificare o meno SSL durante la connessione tramite RDP (Windows). |
| ssh_port | int | 22 | Porta SSH per l'autenticazione delle connessioni remote. |
| ssh_timeout | int | 5 | Timeout SSH per l'autenticazione delle connessioni remote. |
| **kwargs | dict | None | Se vengono passati flag aggiuntivi nel comando run, si tenterà di abbinarli agli input definiti nei test Atomici e di sostituire il loro valore con quello fornito. |