Skip to content

Commit ad4752c

Browse files
authored
Merge pull request #90 from PabloLec/main
Add common SSH public key formats
2 parents c6527a1 + 7ccb1ce commit ad4752c

File tree

4 files changed

+127
-42
lines changed

4 files changed

+127
-42
lines changed

fixtures/file

+46-42
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,46 @@
1-
#! python3
2-
0x52908400098527886E0F7030069857D2E4169EE7
3-
DANHz6EQVoWyZ9rER56DwTXHWUxfkv9k2o
4-
print("hello)
5-
6-
thm{"Can you guess what this is, now?"}
7-
THM{this is a flag}
8-
0x52908400098527886E0F7030069857D2E4169EE730000000000004
9-
0x52908400098527886E0F7030069857D2E4169EE7
10-
@pytest.mark.skip(reason="Fails Regex due to http://")
11-
"1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"
12-
16ftSEQ4ctQFDtVZiUBusQUjRrGhM3JYwe
13-
4462030000000000
14-
thm{"uh hello?"}
15-
001-01-0001
16-
flag{"helo jenny dwi'n gwybod eich bod chi'n darllen hwn diolch am fod yn ffrind i mi "}
17-
340000000000009
18-
30569309025904
19-
http://10.1.1.1
20-
https://www.youtube.com/watch?v=ScOAntcCa78
21-
adsadasdasdhttps://www.youtube.com/watch?v=trj15fjXWDwasdasdasd
22-
6011000000000004
23-
htb{4111111111111111}
24-
3000 0000 0000 04
25-
5500000000000004
26-
27-
james:S3cr37_P@$$W0rd
28-
ScOAntcCa78
29-
<h1> hello </h2>
30-
127.0.0.1
31-
github@skerritt.blog
32-
33-
Access-Control-Allow-Headers: *
34-
35-
47DF8D9NwtmefhFUghynYRMqrexiZTsm48T1hhi2jZcbfcwoPbkhMrrED6zqJRfeYpXFfdaqAT3jnBEwoMwCx6BYDJ1W3ub
36-
LRX8rSPVjifTxoLeoJtLf2JYdJFTQFcE7m
37-
bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq
38-
rBPAQmwMrt7FDDPNyjwFgwSqbWZPf6SLkk
39-
2001:0db8:85a3:0000:0000:8a2e:0370:7334
40-
41-
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
42-
+91 (385) 985 2821
1+
#! python3
2+
0x52908400098527886E0F7030069857D2E4169EE7
3+
DANHz6EQVoWyZ9rER56DwTXHWUxfkv9k2o
4+
print("hello)
5+
6+
thm{"Can you guess what this is, now?"}
7+
THM{this is a flag}
8+
0x52908400098527886E0F7030069857D2E4169EE730000000000004
9+
0x52908400098527886E0F7030069857D2E4169EE7
10+
@pytest.mark.skip(reason="Fails Regex due to http://")
11+
"1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY"
12+
16ftSEQ4ctQFDtVZiUBusQUjRrGhM3JYwe
13+
4462030000000000
14+
thm{"uh hello?"}
15+
001-01-0001
16+
flag{"helo jenny dwi'n gwybod eich bod chi'n darllen hwn diolch am fod yn ffrind i mi "}
17+
340000000000009
18+
30569309025904
19+
http://10.1.1.1
20+
https://www.youtube.com/watch?v=ScOAntcCa78
21+
adsadasdasdhttps://www.youtube.com/watch?v=trj15fjXWDwasdasdasd
22+
6011000000000004
23+
htb{4111111111111111}
24+
3000 0000 0000 04
25+
5500000000000004
26+
27+
james:S3cr37_P@$$W0rd
28+
ScOAntcCa78
29+
<h1> hello </h2>
30+
127.0.0.1
31+
github@skerritt.blog
32+
33+
Access-Control-Allow-Headers: *
34+
35+
47DF8D9NwtmefhFUghynYRMqrexiZTsm48T1hhi2jZcbfcwoPbkhMrrED6zqJRfeYpXFfdaqAT3jnBEwoMwCx6BYDJ1W3ub
36+
LRX8rSPVjifTxoLeoJtLf2JYdJFTQFcE7m
37+
bitcoincash:qzlg6uvceehgzgtz6phmvy8gtdqyt6vf359at4n3lq
38+
rBPAQmwMrt7FDDPNyjwFgwSqbWZPf6SLkk
39+
2001:0db8:85a3:0000:0000:8a2e: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my-random_host
46+
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK0wmN/Cr3JXqmLW7u+g9pTh+wyqDHpSQEIQczXkVx9q r00t@my-random_host

pywhat/Data/regex.json

+36
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,40 @@
11
[
2+
{
3+
"Name": "SSH RSA Public Key",
4+
"Regex": "ssh-rsa [A-Za-z0-9+\/=]+ [^ \n]+",
5+
"plural_name": false,
6+
"Description": null,
7+
"Rarity": 1,
8+
"URL": null,
9+
"Tags": [
10+
"Credentials",
11+
"Cyber Security"
12+
]
13+
},
14+
{
15+
"Name": "SSH ECDSA Public Key",
16+
"Regex": "ecdsa-sha2-nistp[0-9]{3} [A-Za-z0-9+\/=]+ [^ \n]+",
17+
"plural_name": false,
18+
"Description": null,
19+
"Rarity": 1,
20+
"URL": null,
21+
"Tags": [
22+
"Credentials",
23+
"Cyber Security"
24+
]
25+
},
26+
{
27+
"Name": "SSH ED25519 Public Key",
28+
"Regex": "ssh-ed25519 [A-Za-z0-9+\/=]+ [^ \n]+",
29+
"plural_name": false,
30+
"Description": null,
31+
"Rarity": 1,
32+
"URL": null,
33+
"Tags": [
34+
"Credentials",
35+
"Cyber Security"
36+
]
37+
},
238
{
339
"Name": "Ethereum (ETH) Wallet Address",
440
"Regex": "(?i)^0x[a-f0-9]{40}$",

tests/test_click.py

+18
Original file line numberDiff line numberDiff line change
@@ -454,3 +454,21 @@ def test_only_text():
454454
result = runner.invoke(main, ["-o", "fixtures/file"])
455455
assert result.exit_code == 0
456456
assert "Nothing found" in result.output
457+
458+
def test_ssh_rsa_key():
459+
runner = CliRunner()
460+
result = runner.invoke(main, ["fixtures/file"])
461+
assert result.exit_code == 0
462+
assert re.findall("SSH RSA", str(result.output))
463+
464+
def test_ssh_ecdsa_key():
465+
runner = CliRunner()
466+
result = runner.invoke(main, ["fixtures/file"])
467+
assert result.exit_code == 0
468+
assert re.findall("SSH ECDSA", str(result.output))
469+
470+
def test_ssh_ed25519_key():
471+
runner = CliRunner()
472+
result = runner.invoke(main, ["fixtures/file"])
473+
assert result.exit_code == 0
474+
assert re.findall("SSH ED25519", str(result.output))

tests/test_regex_identifier.py

+27
Original file line numberDiff line numberDiff line change
@@ -389,3 +389,30 @@ def test_arn4():
389389
r = regex_identifier.RegexIdentifier()
390390
res = r.check(["arn:aws:s3:::my_corporate_bucket/Development/*"])
391391
assert "ARN" in str(res)
392+
393+
def test_ssh_rsa_key():
394+
r = regex_identifier.RegexIdentifier()
395+
res = r.check(
396+
[
397+
"ssh-rsa AAAAB3NzaC1tc2EAAAADAQABAAACAQDrnjkGtf3iA46rtwsvRiscvMTCw30l5Mmln/sf8Wohg4RPc7nuIx3/fB86K9jzBNoQk6Fb00p2cSW0dX6c3OTL5R5Q0rBjOFy6GV07MkS7rXa7WYh4ObxBh+M+LEzxVIw29anzQFZkR0TAf6x2rBoErK7JYU4fyqFBDFupTt3coQDPEEmVwtLLUCEnJrurbbnJKcWJ+/FbItLxYyMLPl8TwEn0iqiJ97onCU2DuBtiYv3hp1WoEH08b5WDF0F04zEPRdJT+WisxlEFRgaj51o2BtjOC+D2qZQDb4LHaAfJ0WcO4nu7YocdlcLp2JPfXKKgu9P5J8UDsmXbR3KCJ1oddFa2R6TbHc6d2hKyG4amBzMX5ltxXu7D6FLPZlFqua8YooY7A2zwIVirOUH/cfx+5O9o0CtspkNmj/iYzN0FPaOpELncWsuauy9hrGql/1cF4SUr20zHFoBoDQUtmvmBnWnKoGfpWXzuda449FVtmcrEjvBzCvCb3RStu0BbyOOybJagbKif3MkcYVO10pRbTveIUwgCD6F3ypD11XztoPNsgScmjme0sj/KWWNLyQkLWtpJEQ4k46745NAC5g+nP28TR2JM8doeqsxA8JovQkLWwDcR+WYZu2z/I8dfhOmalnoMRTJ2NzWDc0OSkKGYWjexR4fN6lAKCUOUptl9Nw== r00t@my-random_host"
398+
]
399+
)
400+
assert "SSH RSA" in str(res)
401+
402+
def test_ssh_ecdsa_key():
403+
r = regex_identifier.RegexIdentifier()
404+
res = r.check(
405+
[
406+
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCE9Uli8bGnD4hOWdeo5KKQJ/P/vOazI4MgqJK54w37emP2JwOAOdMmXuwpxbKng3KZz27mz+nKWIlXJ3rzSGMo= r00t@my-random_host"
407+
]
408+
)
409+
assert "SSH ECDSA" in str(res)
410+
411+
def test_ssh_ed25519_key():
412+
r = regex_identifier.RegexIdentifier()
413+
res = r.check(
414+
[
415+
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK0wmN/Cr3JXqmLW7u+g9pTh+wyqDHpSQEIQczXkVx9q r00t@my-random_host"
416+
]
417+
)
418+
assert "SSH ED25519" in str(res)

0 commit comments

Comments
 (0)