Agent: Add unit tests for log4shell ldap server tree

This commit is contained in:
Mike Salvatore 2022-01-10 08:22:01 -05:00
parent dcc68914bd
commit eb10bdaa4e
1 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,13 @@
from pathlib import Path
from infection_monkey.exploit.log4shell_utils.ldap_server import EXPLOIT_RDN, Tree
def test_java_code_base_url(tmp_path):
ip = "172.10.20.30"
port = 9999
tree = Tree(ip, port, tmp_path)
ldif_path = Path(tree.path) / f"{EXPLOIT_RDN}.ldif"
with open(ldif_path, "r") as exploit_dit:
assert f"javaCodeBase: http://{ip}:{port}/" in exploit_dit.read()