mirror of
https://github.com/aljazceru/recon-pipeline.git
synced 2025-12-21 16:24:26 +01:00
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:
38
tests/test_recon/test_nmap.py
Normal file
38
tests/test_recon/test_nmap.py
Normal file
@@ -0,0 +1,38 @@
|
||||
from pathlib import Path
|
||||
from recon.nmap import ThreadedNmapScan, SearchsploitScan
|
||||
|
||||
import luigi
|
||||
|
||||
from ..utils import is_kali
|
||||
|
||||
tfp = "../data/bitdiscovery"
|
||||
tf = Path(tfp).stem
|
||||
el = "../data/blacklist"
|
||||
rd = "../data/recon-results"
|
||||
|
||||
nmap_results = Path(__file__).parent.parent / "data" / "recon-results" / "nmap-results"
|
||||
|
||||
|
||||
def test_nmap_output_location(tmp_path):
|
||||
tns = ThreadedNmapScan(target_file=tf, exempt_list=el, results_dir=str(tmp_path), top_ports=100)
|
||||
|
||||
assert tns.output().path == str(Path(tmp_path) / "nmap-results")
|
||||
|
||||
|
||||
def test_searchsploit_output_location(tmp_path):
|
||||
sss = SearchsploitScan(target_file=tf, exempt_list=el, results_dir=str(tmp_path), top_ports=100)
|
||||
|
||||
assert sss.output().path == str(Path(tmp_path) / "searchsploit-results")
|
||||
|
||||
|
||||
def test_searchsploit_produces_results(tmp_path):
|
||||
sss = SearchsploitScan(target_file=tf, exempt_list=el, results_dir=str(tmp_path), top_ports=100)
|
||||
|
||||
sss.input = lambda: luigi.LocalTarget(nmap_results)
|
||||
|
||||
if not is_kali():
|
||||
return True
|
||||
|
||||
sss.run()
|
||||
|
||||
assert len([x for x in Path(sss.output().path).glob("searchsploit*.txt")]) > 0
|
||||
Reference in New Issue
Block a user