mirror of
https://github.com/aljazceru/recon-pipeline.git
synced 2025-12-24 01:34:26 +01:00
* recon.targets tests added * restructured tests logically * fixed yaml error * fixed job names * recon.__init__ tests added * recon.config tests added * recon.amass.ParseAmassScan tests added * fixed test destined to fail on CI pipeline * testing amass partially complete this commit closes #6 and #8 updated existing tests to utilize new paths
65 lines
1.8 KiB
Python
65 lines
1.8 KiB
Python
import pickle
|
|
from pathlib import Path
|
|
from recon.masscan import ParseMasscanOutput, MasscanScan
|
|
|
|
tfp = "../data/bitdiscovery"
|
|
tf = Path(tfp).stem
|
|
el = "../data/blacklist"
|
|
rd = "../data/recon-results"
|
|
|
|
ips = []
|
|
|
|
test_dict = {
|
|
"104.20.60.51": {"tcp": {"8443", "443"}},
|
|
"104.20.61.51": {"tcp": {"8080", "80", "443"}},
|
|
"13.225.54.100": {"tcp": {"443"}},
|
|
"13.225.54.22": {"tcp": {"80"}},
|
|
"52.53.92.161": {"tcp": {"443", "80"}},
|
|
"52.9.23.177": {"tcp": {"80"}},
|
|
}
|
|
|
|
|
|
def test_massscan_output_location(tmp_path):
|
|
asc = MasscanScan(
|
|
target_file=tf, exempt_list=el, results_dir=str(tmp_path), top_ports=100
|
|
)
|
|
|
|
assert asc.output().path == str(Path(tmp_path) / "masscan-results" / "masscan.json")
|
|
|
|
|
|
def test_parsemassscan_output_location(tmp_path):
|
|
pmo = ParseMasscanOutput(
|
|
target_file=tf, exempt_list=el, results_dir=str(tmp_path), top_ports=100
|
|
)
|
|
|
|
assert pmo.output().path == str(
|
|
Path(tmp_path) / "masscan-results" / "masscan.parsed.pickle"
|
|
)
|
|
|
|
|
|
def test_parsemassscan_output_dictionary(tmp_path):
|
|
# pmo = ParseMasscanOutput(
|
|
# target_file=tf, exempt_list=el, results_dir=str(tmp_path), top_ports=100
|
|
# )
|
|
|
|
# masscan_results = (
|
|
# Path(__file__) / ".." / ".." / "data" / "recon-results" / f"masscan.{tf}.json"
|
|
# )
|
|
# shutil.copy(masscan_results.resolve(), tmp_path)
|
|
ip_dict = pickle.load(
|
|
(
|
|
Path(__file__).parent.parent
|
|
/ "data"
|
|
/ "recon-results"
|
|
/ "masscan-results"
|
|
/ "masscan.parsed.pickle"
|
|
).open("rb")
|
|
)
|
|
from pprint import pprint
|
|
|
|
pprint(ip_dict)
|
|
for ip, proto_dict in test_dict.items():
|
|
for proto, ports in proto_dict.items():
|
|
print(ip, proto)
|
|
assert not ip_dict.get(ip).get(proto).difference(ports)
|