From 4e5fbabf863a5956d982c0bd7c0fca5e138cf2bc Mon Sep 17 00:00:00 2001 From: PabloLec Date: Mon, 11 Oct 2021 12:45:48 +0200 Subject: [PATCH 1/3] Add sshpass --- fixtures/file | 4 +++- pywhat/Data/regex.json | 15 ++++++++++++++- tests/test_click.py | 7 +++++++ tests/test_regex_identifier.py | 10 ++++++++++ 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/fixtures/file b/fixtures/file index b5bc63e..1101af0 100644 --- a/fixtures/file +++ b/fixtures/file @@ -93,4 +93,6 @@ b2ced6f5-2542-4f7d-b131-e3ada95d8b75 5fc7c33a7ef88b139122a38a 01ERJ58HMWDN3VTRRHZQV2T5R5 -otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example \ No newline at end of file +otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example + +sshpass -p MyPassw0RD! ssh root@10.0.0.10 \ No newline at end of file diff --git a/pywhat/Data/regex.json b/pywhat/Data/regex.json index f9c5df4..a03cdce 100644 --- a/pywhat/Data/regex.json +++ b/pywhat/Data/regex.json @@ -1011,7 +1011,20 @@ "Credentials", "TOTP", "Bug Bounty" - ] + ] + }, + { + "Name": "SSHPass clear password argument", + "Regex": "^(sshpass [^\\n]*-p[ ]+[^ ]+)$", + "plural_name": false, + "Description": null, + "Rarity": 1, + "URL": null, + "Tags": [ + "Credentials", + "SSH", + "Bug Bounty" + ] }, { "Name": "Google Cloud Platform API Key", diff --git a/tests/test_click.py b/tests/test_click.py index b6a54f6..6b98793 100644 --- a/tests/test_click.py +++ b/tests/test_click.py @@ -625,3 +625,10 @@ def test_file_fixture_totp_URI(): result = runner.invoke(main, ["fixtures/file"]) assert result.exit_code == 0 assert re.findall("Time-Based One-Time Password [(]TOTP[)] URI", str(result.output)) + + +def test_file_fixture_sshpass(): + runner = CliRunner() + result = runner.invoke(main, ["fixtures/file"]) + assert result.exit_code == 0 + assert re.findall("SSHPass clear password argument", str(result.output)) diff --git a/tests/test_regex_identifier.py b/tests/test_regex_identifier.py index f91ace3..bf849fa 100644 --- a/tests/test_regex_identifier.py +++ b/tests/test_regex_identifier.py @@ -1044,3 +1044,13 @@ def test_complex_totp_URI(): ] ) _assert_match_first_item("Time-Based One-Time Password (TOTP) URI", res) + + +def test_sshpass(): + res = r.check(["sshpass -p MyPassw0RD!"]) + _assert_match_first_item("SSHPass clear password argument", res) + + +def test_sshpass_multiple_args(): + res = r.check(["sshpass -P 'Please enter your password' -p MyPassw0RD!"]) + _assert_match_first_item("SSHPass clear password argument", res) From 33b86a057d20c6c5923bfba4c0807e2850d5245b Mon Sep 17 00:00:00 2001 From: Pablo Lecolinet Date: Mon, 11 Oct 2021 15:52:50 +0200 Subject: [PATCH 2/3] Update pywhat/Data/regex.json Co-authored-by: Bee --- pywhat/Data/regex.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pywhat/Data/regex.json b/pywhat/Data/regex.json index a03cdce..7bfd25c 100644 --- a/pywhat/Data/regex.json +++ b/pywhat/Data/regex.json @@ -1014,7 +1014,7 @@ ] }, { - "Name": "SSHPass clear password argument", + "Name": "SSHPass Clear Password Argument", "Regex": "^(sshpass [^\\n]*-p[ ]+[^ ]+)$", "plural_name": false, "Description": null, From e42d52d9fc8df1a0ffba0aff747b6d543ded1383 Mon Sep 17 00:00:00 2001 From: PabloLec Date: Mon, 11 Oct 2021 16:04:43 +0200 Subject: [PATCH 3/3] Fix SSHPass tests --- tests/test_click.py | 2 +- tests/test_regex_identifier.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_click.py b/tests/test_click.py index 6b98793..c8c51b5 100644 --- a/tests/test_click.py +++ b/tests/test_click.py @@ -631,4 +631,4 @@ def test_file_fixture_sshpass(): runner = CliRunner() result = runner.invoke(main, ["fixtures/file"]) assert result.exit_code == 0 - assert re.findall("SSHPass clear password argument", str(result.output)) + assert re.findall("SSHPass Clear Password Argument", str(result.output)) diff --git a/tests/test_regex_identifier.py b/tests/test_regex_identifier.py index bf849fa..ba81485 100644 --- a/tests/test_regex_identifier.py +++ b/tests/test_regex_identifier.py @@ -1048,9 +1048,9 @@ def test_complex_totp_URI(): def test_sshpass(): res = r.check(["sshpass -p MyPassw0RD!"]) - _assert_match_first_item("SSHPass clear password argument", res) + _assert_match_first_item("SSHPass Clear Password Argument", res) def test_sshpass_multiple_args(): res = r.check(["sshpass -P 'Please enter your password' -p MyPassw0RD!"]) - _assert_match_first_item("SSHPass clear password argument", res) + _assert_match_first_item("SSHPass Clear Password Argument", res)