Skip to content

Commit

Permalink
testfix
Browse files Browse the repository at this point in the history
  • Loading branch information
babenek committed Aug 28, 2024
1 parent 841f145 commit ae75d71
Show file tree
Hide file tree
Showing 5 changed files with 616 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
from pathlib import Path

# total number of files in test samples
SAMPLES_FILES_COUNT: int = 130
SAMPLES_FILES_COUNT: int = 132

# the lowest value of ML threshold is used to display possible lowest values
NEGLIGIBLE_ML_THRESHOLD = 0.0001

# credentials count after scan
SAMPLES_CRED_COUNT: int = 360
SAMPLES_CRED_LINE_COUNT: int = 377
SAMPLES_CRED_COUNT: int = 369
SAMPLES_CRED_LINE_COUNT: int = 386

# credentials count after post-processing
SAMPLES_POST_CRED_COUNT: int = 329
SAMPLES_POST_CRED_COUNT: int = 335

# with option --doc
SAMPLES_IN_DOC = 417
SAMPLES_IN_DOC = 418

# archived credentials that are not found without --depth
SAMPLES_IN_DEEP_1 = SAMPLES_POST_CRED_COUNT + 23
Expand Down
162 changes: 162 additions & 0 deletions tests/data/depth_3.json
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,87 @@
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "VALIDATED_KEY",
"ml_probability": 0.997,
"rule": "CMD Password",
"severity": "critical",
"confidence": "moderate",
"line_data_list": [
{
"line": "mysql -u root --password Sne3sd8AZjq",
"line_num": 2,
"path": "tests/samples/cmd_password",
"info": "tests/samples/cmd_password|RAW",
"value": "Sne3sd8AZjq",
"value_start": 25,
"value_end": 36,
"variable": "password",
"variable_start": 16,
"variable_end": 24,
"entropy_validation": {
"iterator": "BASE64_CHARS",
"entropy": 3.459431618637298,
"valid": false
}
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "VALIDATED_KEY",
"ml_probability": 0.904,
"rule": "ConvertTo-SecureString",
"severity": "critical",
"confidence": "moderate",
"line_data_list": [
{
"line": "ConvertTo-SecureString -String -Force dsjUE#$gds8s",
"line_num": 1,
"path": "tests/samples/convert_to_secure_string",
"info": "tests/samples/convert_to_secure_string|RAW",
"value": "dsjUE#$gds8s",
"value_start": 38,
"value_end": 50,
"variable": "ConvertTo-SecureString -String -Force",
"variable_start": 0,
"variable_end": 37,
"entropy_validation": {
"iterator": "BASE64_CHARS",
"entropy": 2.4245614587540074,
"valid": false
}
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "VALIDATED_KEY",
"ml_probability": 1.0,
"rule": "ConvertTo-SecureString",
"severity": "critical",
"confidence": "moderate",
"line_data_list": [
{
"line": "\"ConvertTo-SecureString \\\"4yd21JKH~GE8dkd\\\"\"",
"line_num": 2,
"path": "tests/samples/convert_to_secure_string",
"info": "tests/samples/convert_to_secure_string|RAW",
"value": "4yd21JKH~GE8dkd",
"value_start": 26,
"value_end": 41,
"variable": "ConvertTo-SecureString",
"variable_start": 1,
"variable_end": 23,
"entropy_validation": {
"iterator": "BASE64_CHARS",
"entropy": 3.3294387224237187,
"valid": false
}
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "VALIDATED_KEY",
Expand Down Expand Up @@ -1937,6 +2018,33 @@
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "VALIDATED_KEY",
"ml_probability": 0.984,
"rule": "CMD Password",
"severity": "critical",
"confidence": "moderate",
"line_data_list": [
{
"line": "--user master --password dipPr127Gg!",
"line_num": 28,
"path": "tests/samples/doc_id_pair_passwd_pair",
"info": "tests/samples/doc_id_pair_passwd_pair|RAW",
"value": "dipPr127Gg!",
"value_start": 25,
"value_end": 36,
"variable": "password",
"variable_start": 16,
"variable_end": 24,
"entropy_validation": {
"iterator": "BASE64_CHARS",
"entropy": 3.1449378351248165,
"valid": false
}
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "VALIDATED_KEY",
Expand Down Expand Up @@ -2180,6 +2288,33 @@
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "VALIDATED_KEY",
"ml_probability": 0.992,
"rule": "CMD Password",
"severity": "critical",
"confidence": "moderate",
"line_data_list": [
{
"line": "--username master --password dipPr137Gg!",
"line_num": 38,
"path": "tests/samples/doc_id_pair_passwd_pair",
"info": "tests/samples/doc_id_pair_passwd_pair|RAW",
"value": "dipPr137Gg!",
"value_start": 29,
"value_end": 40,
"variable": "password",
"variable_start": 20,
"variable_end": 28,
"entropy_validation": {
"iterator": "BASE64_CHARS",
"entropy": 3.1449378351248165,
"valid": false
}
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "VALIDATED_KEY",
Expand Down Expand Up @@ -3989,6 +4124,33 @@
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "VALIDATED_KEY",
"ml_probability": 0.953,
"rule": "CMD Password",
"severity": "critical",
"confidence": "moderate",
"line_data_list": [
{
"line": "-password \"Prl23Db#@\"",
"line_num": 33,
"path": "tests/samples/doc_passwd_pair",
"info": "tests/samples/doc_passwd_pair|RAW",
"value": "Prl23Db#@",
"value_start": 11,
"value_end": 20,
"variable": "password",
"variable_start": 1,
"variable_end": 9,
"entropy_validation": {
"iterator": "BASE64_CHARS",
"entropy": 2.4654972233440207,
"valid": false
}
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "VALIDATED_KEY",
Expand Down
44 changes: 44 additions & 0 deletions tests/data/doc.json
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,50 @@
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "NOT_AVAILABLE",
"ml_probability": null,
"rule": "ID_PAIR_PASSWD_PAIR",
"severity": "medium",
"confidence": "moderate",
"line_data_list": [
{
"line": "mysql -u root --password Sne3sd8AZjq",
"line_num": 2,
"path": "tests/samples/cmd_password",
"info": "tests/samples/cmd_password|RAW",
"value": "--password",
"value_start": 14,
"value_end": 24,
"variable": "root",
"variable_start": 9,
"variable_end": 13,
"entropy_validation": {
"iterator": "BASE64_CHARS",
"entropy": 2.45754247590989,
"valid": false
}
},
{
"line": "mysql -u root --password Sne3sd8AZjq",
"line_num": 2,
"path": "tests/samples/cmd_password",
"info": "tests/samples/cmd_password|RAW",
"value": "Sne3sd8AZjq",
"value_start": 25,
"value_end": 36,
"variable": "password",
"variable_start": 16,
"variable_end": 24,
"entropy_validation": {
"iterator": "BASE64_CHARS",
"entropy": 3.459431618637298,
"valid": false
}
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "NOT_AVAILABLE",
Expand Down
Loading

0 comments on commit ae75d71

Please sign in to comment.