Skip to content

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
ocervell committed Sep 26, 2024
1 parent ae57cb4 commit a2ee068
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
1 change: 1 addition & 0 deletions secator/tasks/gitleaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class gitleaks(Command):
opt_key_map = {
"ignore_path": "i"
}
input_type = "folder"
output_types = [Tag]
output_map = {
Tag: {
Expand Down
4 changes: 3 additions & 1 deletion secator/utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
USERNAME: 'test',
IP: '192.168.1.23',
CIDR_RANGE: '192.168.1.0/24',
EMAIL: '[email protected]'
EMAIL: '[email protected]',
'folder': '.'
}

#---------------------#
Expand Down Expand Up @@ -95,6 +96,7 @@
'nmap.skip_host_discovery': True,
'msfconsole.resource': load_fixture('msfconsole_input', FIXTURES_DIR, only_path=True),
'dirsearch.output_path': load_fixture('dirsearch_output', FIXTURES_DIR, only_path=True),
'gitleaks_output_path': load_fixture('gitleaks_output', FIXTURES_DIR, only_path=True),
'maigret.output_path': load_fixture('maigret_output', FIXTURES_DIR, only_path=True),
'nuclei.template_id': 'prometheus-metrics',
'wpscan.output_path': load_fixture('wpscan_output', FIXTURES_DIR, only_path=True),
Expand Down
42 changes: 42 additions & 0 deletions tests/fixtures/gitleaks_output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[
{
"Description": "Identified a Private Key, which may compromise cryptographic security and sensitive data encryption.",
"StartLine": 5,
"EndLine": 5,
"StartColumn": 742,
"EndColumn": 813,
"Match": "-----BEGIN OPENSSH PRIVATE KEY-----s!\u0000\u0000\u0000-----END OPENSSH PRIVATE KEY----",
"Secret": "-----BEGIN OPENSSH PRIVATE KEY-----s!\u0000\u0000\u0000-----END OPENSSH PRIVATE KEY----",
"File": ".venv/lib/python3.11/site-packages/cryptography/hazmat/primitives/serialization/__pycache__/ssh.cpython-311.pyc",
"SymlinkFile": "",
"Commit": "",
"Entropy": 3.8125615,
"Author": "",
"Email": "",
"Date": "",
"Message": "",
"Tags": [],
"RuleID": "private-key",
"Fingerprint": ".venv/lib/python3.11/site-packages/cryptography/hazmat/primitives/serialization/__pycache__/ssh.cpython-311.pyc:private-key:5",
},
{
"Description": "Detected a Generic API Key, potentially exposing access to various services and sensitive operations.",
"StartLine": 63,
"EndLine": 64,
"StartColumn": 6,
"EndColumn": 1,
"Match": "key: ed448.Ed448PrivateKey",
"Secret": "ed448.Ed448PrivateKey",
"File": ".venv/lib/python3.11/site-packages/dns/dnssecalgs/eddsa.py",
"SymlinkFile": "",
"Commit": "",
"Entropy": 3.5944657,
"Author": "",
"Email": "",
"Date": "",
"Message": "",
"Tags": [],
"RuleID": "generic-api-key",
"Fingerprint": ".venv/lib/python3.11/site-packages/dns/dnssecalgs/eddsa.py:generic-api-key:63"
}
]

0 comments on commit a2ee068

Please sign in to comment.