tests: add e2e tests and README
parent
bbc1803b2b
commit
50d5014a58
|
@ -0,0 +1,10 @@
|
|||
# CME Tests
|
||||
## Running Tests
|
||||
### Unit Tests
|
||||
* Install CME (either in venv or via Poetry)
|
||||
* Run `pytest` (or `poetry run pytest`)
|
||||
|
||||
### End to End Tests
|
||||
* Install CME (either in venv or via Poetry)
|
||||
* Run `python tests/e2e_tests.py -t $IP -u $USER -p $PASS`, with optional `-k` parameter
|
||||
* Poetry: `poetry run python tests/e2e_tests.py -t $IP -u $USER -p $PASS`
|
|
@ -0,0 +1,65 @@
|
|||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS --shares
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS --shares --filter-shares READ WRITE
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS --pass-pol
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS --disks
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS --groups
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS --sessions
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS --loggedon-users
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS --users
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS --computers
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS --rid-brute
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS --local-groups
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS --gen-relay-list /tmp/relaylistOutputFilename.txt
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS --local-auth
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS --sam
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS --ntds
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS --lsa
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS --dpapi
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS -x whoami
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS -X whoami
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS -X whoami --obfs
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS --wmi "os get"
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS -M ntdsutil
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS -M nopac
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS -M enum_av
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS -M wifi
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS -M petitpotam
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS -M spooler
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS -M dfscoerce
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS -M shadowcoerce
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS -M enum_dns
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS -M gpp_autologin
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS -M gpp_password
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS -M lsassy
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS -M impersonate
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS -M install_elevated
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS -M ioxidresolver
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS -M MS17-010
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS -M ntlmv1
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS -M runasppl
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS -M uac
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS -M webdav
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS -M wifi
|
||||
crackmapexec smb TARGET -u USER -p PASSWORD KERBEROS -M winscp
|
||||
crackmapexec smb TARGET -u '' -p '' -M zerologon
|
||||
crackmapexec smb TARGET -u '' -p '' -M petitpotam
|
||||
crackmapexec ldap TARGET -u USER -p PASSWORD KERBEROS --users
|
||||
crackmapexec ldap TARGET -u USER -p PASSWORD KERBEROS --groups
|
||||
crackmapexec ldap TARGET -u USER -p PASSWORD KERBEROS --get-sid
|
||||
crackmapexec ldap TARGET -u USER -p '' --asreproast /tmp/output.txt
|
||||
crackmapexec ldap TARGET -u USER -p PASSWORD KERBEROS --kerberoasting /tmp/output2.txt
|
||||
crackmapexec ldap TARGET -u USER -p PASSWORD KERBEROS --trusted-for-delegation
|
||||
crackmapexec ldap TARGET -u USER -p PASSWORD KERBEROS --admin-count
|
||||
crackmapexec ldap TARGET -u USER -p PASSWORD KERBEROS --gmsa
|
||||
crackmapexec ldap TARGET -u USER -p PASSWORD KERBEROS -M laps
|
||||
crackmapexec ldap TARGET -u USER -p PASSWORD KERBEROS -M maq
|
||||
crackmapexec ldap TARGET -u USER -p PASSWORD KERBEROS -M get-desc-users
|
||||
crackmapexec ldap TARGET -u USER -p PASSWORD KERBEROS -M adcs
|
||||
crackmapexec ldap TARGET -u USER -p PASSWORD KERBEROS -M get-network
|
||||
crackmapexec ldap TARGET -u USER -p PASSWORD KERBEROS -M get-network -o ONLY_HOSTS=true
|
||||
crackmapexec ldap TARGET -u USER -p PASSWORD KERBEROS -M get-network -o ALL=true
|
||||
crackmapexec ldap TARGET -u USER -p PASSWORD KERBEROS -M ldap-checker
|
||||
crackmapexec winrm TARGET -u USER -p PASSWORD
|
||||
crackmapexec winrm TARGET -u USER -p PASSWORD -X whoami
|
||||
crackmapexec winrm TARGET -u USER -p PASSWORD --laps
|
|
@ -0,0 +1,72 @@
|
|||
import argparse
|
||||
import os
|
||||
import subprocess
|
||||
from time import sleep
|
||||
from rich.console import Console
|
||||
|
||||
# TODO IN ARG PARSE
|
||||
IP = "192.168.8.96"
|
||||
USER = 'Administrator'
|
||||
PASSWORD = "-p Passw0rd\!"
|
||||
# PASSWORD = "-H 23C36EF176F50F9483DCE5068ED64161"
|
||||
KERBEROS = ""
|
||||
|
||||
|
||||
def get_cli_args():
|
||||
parser = argparse.ArgumentParser(
|
||||
description=f"Script for running end to end tests for CME"
|
||||
)
|
||||
parser.add_argument("-t", "--target", dest="target", required=True)
|
||||
parser.add_argument("-u", "--user", "--username", dest="username", required=True)
|
||||
parser.add_argument("-p", "--pass", "--password", dest="password", required=True)
|
||||
parser.add_argument("-k", "--kerberos", action="store_true", required=False)
|
||||
|
||||
args = parser.parse_args()
|
||||
return args
|
||||
|
||||
|
||||
def generate_commands():
|
||||
args = get_cli_args()
|
||||
lines = []
|
||||
|
||||
if args.kerberos:
|
||||
kerberos = "-k"
|
||||
else:
|
||||
kerberos = ""
|
||||
|
||||
file_loc = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
|
||||
commands_file = os.path.join(file_loc, "e2e_commands.txt")
|
||||
|
||||
with open(commands_file) as file:
|
||||
for line in file:
|
||||
line = line.strip()
|
||||
line = line.replace("TARGET", args.target) \
|
||||
.replace("USER", f"\"{args.username}\"") \
|
||||
.replace("PASSWORD", f"\"{args.password}\"") \
|
||||
.replace("KERBEROS", kerberos)
|
||||
lines.append(line)
|
||||
return lines
|
||||
|
||||
|
||||
def run_e2e_tests():
|
||||
console = Console()
|
||||
tasks = generate_commands()
|
||||
|
||||
result = subprocess.Popen("crackmapexec --version", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
version = result.communicate()[0].decode().strip()
|
||||
|
||||
with console.status(f"[bold green] :brain: Running test commands for cme v{version}...") as status:
|
||||
while tasks:
|
||||
task = tasks.pop(0)
|
||||
result = subprocess.Popen(str(task), shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
# pass in a "y" for things that prompt for it (--ndts, etc)
|
||||
text = result.communicate(input=b"y")[0]
|
||||
return_code = result.returncode
|
||||
if return_code == 0:
|
||||
console.log(f"{task.strip()} :heavy_check_mark:")
|
||||
else:
|
||||
console.log(f"[bold red]{task.strip()} :cross_mark:[/]")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_e2e_tests()
|
Loading…
Reference in New Issue