Skip to content

Commit e2e109e

Browse files
authored
Merge pull request #214 from gVirtu/improvement/slack_webhook_regex
Update Slack Webhook regex with tests
2 parents dd077aa + 8c6fb5e commit e2e109e

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

fixtures/file

+3-1
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,6 @@ b2ced6f5-2542-4f7d-b131-e3ada95d8b75
9595

9696
otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example
9797

98-
sshpass -p MyPassw0RD! ssh root@10.0.0.10
98+
sshpass -p MyPassw0RD! ssh root@10.0.0.10
99+
100+
https://hooks.slack.com/services/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

pywhat/Data/regex.json

+10-3
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@
258258
},
259259
{
260260
"Name": "Slack Webhook",
261-
"Regex": "(?i)^(https://hooks.slack.com/services/T[a-zA-Z0-9_]{8}/B[a-zA-Z0-9_]{8}/[a-zA-Z0-9_]{24})$",
261+
"Regex": "(?i)^(https://hooks.slack.com/services/T[a-zA-Z0-9_]{8,10}/B[a-zA-Z0-9_]{8,10}/[a-zA-Z0-9_]{24})$",
262262
"plural_name": false,
263263
"Description": null,
264264
"Exploit": "If the command below returns 'missing_text_or_fallback_or_attachments', it means\nthat the URL is valid, any other responses would mean that the URL is invalid.\n $ curl -s -X POST -H \"Content-type: application/json\" -d '{\"text\":\"\"}' \"SLACK_WEBOOK_URL_HERE\"\n",
@@ -269,7 +269,14 @@
269269
"API Keys",
270270
"Credentials",
271271
"Slack"
272-
]
272+
],
273+
"Examples": {
274+
"Valid": [
275+
"https://hooks.slack.com/services/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",
276+
"https://hooks.slack.com/services/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"
277+
],
278+
"Invalid": []
279+
}
273280
},
274281
{
275282
"Name": "Amazon Web Services Simple Storage (AWS S3) URL",
@@ -2587,4 +2594,4 @@
25872594
"Invalid": []
25882595
}
25892596
}
2590-
]
2597+
]

tests/test_click.py

+7
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,13 @@ def test_file_fixture_sshpass():
639639
assert re.findall("SSHPass Clear Password Argument", str(result.output))
640640

641641

642+
def test_file_fixture_slack_webhook():
643+
runner = CliRunner()
644+
result = runner.invoke(main, ["fixtures/file"])
645+
assert result.exit_code == 0
646+
assert re.findall("Slack Webhook", str(result.output))
647+
648+
642649
def test_format():
643650
runner = CliRunner()
644651
result = runner.invoke(

0 commit comments

Comments
 (0)