Skip to content

Commit 2589780

Browse files
authored
Add mount commands and fstab entries with clear credentials (#210)
* Add mount and fstab entries * Replace `[ ]+` by `\s+`
1 parent e8aaaaa commit 2589780

File tree

3 files changed

+53
-3
lines changed

3 files changed

+53
-3
lines changed

pywhat/Data/regex.json

+26-2
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@
10151015
},
10161016
{
10171017
"Name": "SSHPass Clear Password Argument",
1018-
"Regex": "^(sshpass [^\\n]*-p[ ]+[^ ]+)$",
1018+
"Regex": "^(sshpass [^\\n]*-p\\s+[^ ]+)$",
10191019
"plural_name": false,
10201020
"Description": null,
10211021
"Rarity": 1,
@@ -1026,6 +1026,30 @@
10261026
"Bug Bounty"
10271027
]
10281028
},
1029+
{
1030+
"Name": "Mount Command With Clear Credentials",
1031+
"Regex": "^(mount(.cifs)?\\s+[^\\n]*(username=[^, \\n]+[^\\n ]*password=[^, \\n]+|password=[^, \\n]+[^\\n ]*username=[^, \\n]+))$",
1032+
"plural_name": false,
1033+
"Description": null,
1034+
"Rarity": 1,
1035+
"URL": null,
1036+
"Tags": [
1037+
"Credentials",
1038+
"Bug Bounty"
1039+
]
1040+
},
1041+
{
1042+
"Name": "CIFS Fstab Entry With Clear Credentials",
1043+
"Regex": "^(cifs\\s+[^\\n]*(username=[^, \\n]+[^\\n ]*password=[^, \\n]+|password=[^, \\n]+[^\\n ]*username=[^, \\n]+))$",
1044+
"plural_name": false,
1045+
"Description": null,
1046+
"Rarity": 1,
1047+
"URL": null,
1048+
"Tags": [
1049+
"Credentials",
1050+
"Bug Bounty"
1051+
]
1052+
},
10291053
{
10301054
"Name": "Google Cloud Platform API Key",
10311055
"Regex": "(?i)^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$",
@@ -1783,7 +1807,7 @@
17831807
"ObjectID"
17841808
]
17851809
},
1786-
1810+
17871811
{
17881812
"Name": "Recent Unix Timestamp",
17891813
"Regex": "^([0-9]{10})$",

tests/test_regex_formatting.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def test_name_capitalization():
1919
assert word.title() == word, (
2020
f'Wrong capitalization in regex name: "{entry_name}"\n'
2121
f'Expected: "{entry_name.title()}"\n'
22-
"Please capitalize every the first letter of each word."
22+
"Please capitalize the first letter of each word."
2323
)
2424

2525

tests/test_regex_identifier.py

+26
Original file line numberDiff line numberDiff line change
@@ -1035,3 +1035,29 @@ def test_sshpass():
10351035
def test_sshpass_multiple_args():
10361036
res = r.check(["sshpass -P 'Please enter your password' -p MyPassw0RD!"])
10371037
_assert_match_first_item("SSHPass Clear Password Argument", res)
1038+
1039+
1040+
def test_mount_command():
1041+
res = r.check(["mount -o username=myuser,password=password"])
1042+
_assert_match_first_item("Mount Command With Clear Credentials", res)
1043+
1044+
1045+
def test_mountcifs_command():
1046+
res = r.check(["mount.cifs -o username=myuser,password=password"])
1047+
_assert_match_first_item("Mount Command With Clear Credentials", res)
1048+
1049+
1050+
def test_complex_mount_command():
1051+
res = r.check(
1052+
[
1053+
"mount -t cifs -osec=ntlmv2,password=S3cUr3D!,domain=mydomain,noserverino,username=H4x0r"
1054+
]
1055+
)
1056+
_assert_match_first_item("Mount Command With Clear Credentials", res)
1057+
1058+
1059+
def test_cifs_fstab_entry():
1060+
res = r.check(
1061+
["cifs uid=1000,password=password,gid=1000,noperm,nofail,username=myuser"]
1062+
)
1063+
_assert_match_first_item("CIFS Fstab Entry With Clear Credentials", res)

0 commit comments

Comments
 (0)