
Atomic Red Team 테스트(Atomics)를 여러 운영 체제 환경에서 실행하는 데 사용되는 Python 패키지입니다.
이 Python 패키지는 여러 운영 체제 환경에서 Atomic Red Team 테스트(Atomics)를 실행하는 데 사용됩니다.
(새로운 기능?)
atomic-operator는 보안 전문가가 atomic-red-team에 정의된 규정된 기술에 대해 탐지 및 방어 기능을 테스트할 수 있도록 합니다. atomic-operator와 같은 테스트 프레임워크를 활용하면 방어 능력과 방어 커버리지의 공백을 모두 식별할 수 있습니다.
또한 atomic-operator는 다음과 같은 다양한 상황에서 사용할 수 있습니다.
iaas:aws에 대한 원자 테스트 실행 지원atomic-operator는 PyPi에서 호스팅되는 Python 전용 패키지이며 Python 3.6 이상에서 작동합니다.
PowerShell 버전을 원한다면 Invoke-AtomicRedTeam을 확인하세요.
pip install atomic-operator
다음 단계에서는 atomic-operator를 설정하고 실행하는 방법을 안내합니다.
atomic-operator는 OS X, Linux 또는 Windows에 설치할 수 있습니다. 또한 소스에서 직접 설치할 수도 있습니다. 아래 해당 운영 체제 제목 아래의 명령을 참조하여 설치하세요.
다음 라이브러리는 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
# ModuleNotFoundError: No module named 'setuptools_rust' 해결
brew install rust
pip3 install --upgrade pip
pip3 install setuptools_rust
# 다시 정규 작업으로 돌아갑니다...
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
atomic-operator는 명령줄 또는 자체 Python 스크립트 내에서 실행할 수 있습니다. 명령줄에서 atomic-operator를 사용하려면 터미널에 다음을 입력하세요.
atomic-operator --help
atomic-operator run -- --help
run 명령에 대한 자세한 내용을 보려면
atomic-operator run -- --help를 실행하고atomic-operator run --help는 실행하지 마세요.
atomic-operator를 사용하려면 로컬 시스템에 하나 이상의 atomic-red-team 테스트(Atomics)가 있어야 합니다. atomic-operator는 Atomic Red Team 리포지토리를 다운로드하는 기능을 제공합니다. 명령줄에서 다음을 실행하여 수행할 수 있습니다.
atomic-operator get_atomics
# --destination 플래그를 사용하여 대상 디렉터리를 지정할 수 있습니다.
atomic-operator get_atomics --destination "/tmp/some_directory"
테스트를 실행하려면 추가 속성(및 원하는 경우 옵션)을 제공해야 합니다. 테스트를 실행하는 주요 메서드는 run입니다.
# 이 명령은 로컬 운영 체제와 호환되는 모든 테스트를 실행합니다.
atomic-operator run --atomics-path "/tmp/some_directory/redcanaryco-atomic-red-team-3700624"
하나 이상의 특정 기술을 제공하면 개별 테스트를 선택할 수 있습니다. 예를 들어 명령줄에서 다음을 실행합니다.
atomic-operator run --techniques T1564.001 --select_tests
그러면 해당 기술과 관련된 테스트 선택 목록이 사용자에게 표시됩니다. 사용자는 스페이스바를 사용하여 원하는 테스트를 강조 표시하여 하나 이상의 테스트를 선택할 수 있습니다.
기술 T1564.001(아티팩트 숨기기: 숨김 파일 및 디렉터리)에 대한 테스트 선택
* 숨김 디렉터리에 숨김 파일 만들기 (61a782e5-9a19-40b5-8ba4-69a4b9f3d7be)
Mac 숨김 파일 (cddb9098-3b47-4e01-9d3b-6f5f323288a9)
Attrib으로 Windows 시스템 파일 만들기 (f70974c8-c094-4574-b542-2c545af95a32)
Attrib으로 Windows 숨김 파일 만들기 (dadb792e-4358-4d8d-9207-b771faa0daa5)
숨김 파일 (3b7015f2-3144-4205-b799-b05580621379)
디렉터리 숨기기 (b115ecaf-3b24-4ed2-aefe-2fcb9db913d3)
모든 숨김 파일 표시 (9a1ec7da-b892-449f-ad68-67066d04380c)
다음과 같이 테스트에 사용자 정의 입력 인수를 제공할 수 있습니다. run 메서드의 input_arguments 매개변수에 키-값 쌍의 딕셔너리를 제공하면 됩니다.
atomic-operator run --techniques T1564.001 --input_arguments '{"project-id": "some_value", "another_key": "another value"}'
# input_arguments 값 주위에 작은따옴표를 포함하세요.
테스트를 원격으로 실행하려면 추가 속성(및 원하는 경우 옵션)을 제공해야 합니다. 테스트를 실행하는 주요 메서드는 run입니다.
# 이 명령은 로컬 운영 체제와 호환되는 모든 테스트를 실행합니다.
atomic-operator run --atomics-path "/tmp/some_directory/redcanaryco-atomic-red-team-3700624" --hosts "10.32.1.0" --username "my_username" --password "my_password"
Windows 호스트에서 명령을 원격으로 실행할 때는 PSRemoting을 구성해야 할 수 있습니다. 자세한 내용은 Windows 원격을 참조하세요.
다음 명령을 실행하여 추가 매개변수를 확인할 수 있습니다.
atomic-operator run -- --help
다음과 유사한 출력이 표시됩니다.
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.
atomic-operator에 매개변수를 전달하는 기능 외에도 모든 Atomic 테스트와 잠재적 입력이 포함된 config_file 경로를 전달할 수도 있습니다. 이 config_file의 예는 다음과 같습니다.
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
atomic-operator를 사용하려면 AtomicOperator 객체를 인스턴스화해야 합니다.
from atomic_operator import AtomicOperator
operator = AtomicOperator()
# 이 명령은 atomic-red-team 리포지토리의 로컬 복사본을 다운로드합니다.
print(operator.get_atomics('/tmp/some_directory'))
# 이 명령은 로컬 시스템에서 테스트를 실행합니다.
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
)
질문이 있거나 문제가 발생하면 이슈를 생성해 주세요.
기여 지침 및 풀 리퀘스트 제출 절차에 대한 자세한 내용은 CONTRIBUTING.md를 참조하세요.
버전 관리는 SemVer를 사용합니다.
이 프로젝트에 참여한 기여자 목록도 확인하세요.
이 프로젝트는 MIT 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 LICENSE 파일을 참조하세요.
| 매개변수 이름 | 유형 | 기본값 | 설명 |
|---|
| techniques | list | all | attack_technique ID로 정의된 하나 이상의 기술. |
| test_guids | list | None | 하나 이상의 Atomic 테스트 GUID. |
| select_tests | bool | False | 기술이 지정된 경우 실행할 Atomic 테스트를 하나 이상 선택합니다. |
| atomics_path | str | os.getcwd() | Atomic 테스트 경로. |
| input_arguments | dict | {} | 테스트에 전달할 입력 인수의 딕셔너리. |
| check_prereqs | bool | False | 전제 조건 의존성(prereq_comand)을 확인할지 여부. |
| get_prereqs | bool | False | 전제 조건을 검색할지 여부. |
| cleanup | bool | False | 정리 명령어를 실행할지 여부. |
| copy_source_files | bool | True | 관련 소스(src, bin 등) 파일을 원격 호스트에 복사할지 여부. |
| command_timeout | int | 20 | 각 명령의 시간 제한 시간(초). |
| debug | bool | False | 실행 중인 테스트에 대한 세부 정보를 출력할지 여부. |
| prompt_for_input_args | bool | False | 각 테스트에 대해 입력 인수를 요청할지 여부. |
| return_atomics | bool | False | 테스트를 실행하는 대신 atomics를 반환할지 여부. |
| config_file | str | None | 환경에서 atomic-operator를 자동화하는 데 사용되는 구성 파일 경로. |
| config_file_only | bool | False | 제공된 config_file만 기반으로 테스트를 실행할지 여부. |
| hosts | list | None | 테스트를 실행할 하나 이상의 원격 호스트 목록. |
| username | str | None | 원격 연결 인증을 위한 사용자 이름. |
| password | str | None | 원격 연결 인증을 위한 비밀번호. |
| ssh_key_path | str | None | 원격 연결 인증을 위한 SSH 키 경로. |
| private_key_string | str | None | 원격 연결 인증에 사용되는 개인 SSH 키 문자열. |
| verify_ssl | bool | False | RDP(Windows)를 통해 연결할 때 SSL을 확인할지 여부. |
| ssh_port | int | 22 | 원격 연결 인증을 위한 SSH 포트. |
| ssh_timeout | int | 5 | 원격 연결 인증을 위한 SSH 시간 제한. |
| **kwargs | dict | None | 추가 플래그가 run 명령에 전달되면 Atomic 테스트 내 정의된 입력과 일치시키고 해당 값을 제공된 값으로 대체합니다. |