Add scan tests (#12) - tests of current codebase complete

* 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

* Changed the dir layout (#6) and fixed paths (#8)

this commit closes #6 and #8
updated existing tests to utilize new paths

* tests of current codebase complete

* added is_kali check to searchsploit test

* added test_web action to pipeline
This commit is contained in:
epi052
2020-02-04 06:33:00 -06:00
committed by GitHub
parent 1d5155f930
commit 7a24d85db4
20 changed files with 279 additions and 264 deletions

View File

@@ -7,8 +7,6 @@ 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"}},
@@ -20,45 +18,24 @@ test_dict = {
def test_massscan_output_location(tmp_path):
asc = MasscanScan(
target_file=tf, exempt_list=el, results_dir=str(tmp_path), top_ports=100
)
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
)
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"
)
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")
(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)