bee-san / pyWhat

🐸 Identify anything. pyWhat easily lets you identify emails, IP addresses, and more. Feed it a .pcap file or some text and it'll tell you what it is! 🧙‍♀️
MIT License
6.58k stars 349 forks source link

Update Slack Webhook regex with tests #214

Closed gVirtu closed 3 years ago

gVirtu commented 3 years ago

Prerequisites

Why do we need this pull request?

image

Notice that both fragments after the domain (the ones starting with T and B) contain 11 characters each instead of the usual 9.

What GitHub issues does this fix?

Copy / paste of output

Please copy and paste the output of PyWhat with your new addition using an example that tests this addition below:

what 'https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX'
Matched on: https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
Name: Slack Webhook
Exploit: If the command below returns 'missing_text_or_fallback_or_attachments', it means
that the URL is valid, any other responses would mean that the URL is invalid.
  $ curl -s -X POST -H "Content-type: application/json" -d '{"text":""}' 
"https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"

Matched on: https://hooks.sl
Name: Uniform Resource Locator (URL)

Matched on: ack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
Name: Uniform Resource Locator (URL)

Matched on: hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
Name: JSON Web Token (JWT)
codecov-commenter commented 3 years ago

Codecov Report

Merging #214 (8c6fb5e) into main (dd077aa) will increase coverage by 0.03%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #214      +/-   ##
==========================================
+ Coverage   92.32%   92.35%   +0.03%     
==========================================
  Files          14       14              
  Lines        1198     1203       +5     
==========================================
+ Hits         1106     1111       +5     
  Misses         92       92              
Impacted Files Coverage Δ
tests/test_click.py 98.32% <100.00%> (+0.01%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update dd077aa...8c6fb5e. Read the comment docs.

bee-san commented 3 years ago

@gVirtu thanks so much for such a great PR description and addition!!! 🥳

@amadejpapez if i am not mistaken, why doesn't the URL regex recursively report its findings? It should look like this but I've never seen it done this way. Is this some fancy code we have somewhere? 🤔

Matched on: ack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
Matched on: ck.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
Matched on: k.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
bee-san commented 3 years ago

My Q is answered here: https://discord.com/channels/754001738184392704/825403560065761291/899278650082492447