joshhighet / ransomwatch

the transparent ransomware claim tracker 🥷🏼🧅🖥️
https://ransomwatch.telemetry.ltd
The Unlicense
904 stars 135 forks source link

Feature Request: Microsoft Teams #72

Closed etaylor77 closed 1 year ago

etaylor77 commented 1 year ago

I am very interested in getting this to post information into Microsoft Teams channels.

soufianetahiri commented 1 year ago

I think you must be able to make a python script in like 5 minutes

`import requests import json

def send_to_teams(webhook_url, json_url):

Retrieve the JSON data from the URL

response = requests.get(json_url)
data = response.json()

# Convert the JSON data to a string
payload = json.dumps(data)

# Prepare the payload for Teams
teams_payload = {
    "text": "JSON data",
    "attachments": [
        {
            "contentType": "application/json",
            "content": payload
        }
    ]
}

# Send the payload to Teams using the webhook URL
requests.post(webhook_url, json=teams_payload)

`

Example usage

webhook_url = "https://your_teams_webhook_url" json_url = "https://example.com/your_json_file.json"

send_to_teams(webhook_url, json_url)

joshhighet commented 1 year ago

+1 to what @soufianetahiri said

@etaylor77 alternatively - you could also maintain a fork and leverage the following function

https://github.com/joshhighet/ransomwatch/blob/f0d0ce568ba76f7d524055d3356908b46c32b6fe/sharedutils.py#L436-L484

you would need to uncomment https://github.com/joshhighet/ransomwatch/blob/f0d0ce568ba76f7d524055d3356908b46c32b6fe/parsers.py#L70-L76

and inject the webhook into your runtime.. if using actions, similar to https://github.com/joshhighet/ransomwatch/blob/f0d0ce568ba76f7d524055d3356908b46c32b6fe/.github/workflows/ransomwatch.yml#L33

a useful PR would be a way that this can be done without having to run the entire scraper set - i.e a smaller package allowing you to consume a feed from this repository without all the other noise. I appreciate without guids/offset markers on each post this is more difficult than it really should be

joshhighet commented 1 year ago

perhaps there is a service I can send new "posts" to that can then make it easier for others to "subscribe" to for things like private teams channels. if you find something like this - let me know, happy to consider