-
-
Save idem2lyon/0fdf947d6a6dbae70b7c05c86ba74891 to your computer and use it in GitHub Desktop.
An adapter from outgress to IFTTT Maker action. Use as a cgi and set the destination to it in outgress.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cgi | |
import requests | |
__author__ = 'haxwithaxe <spam@haxwithaxe.net>' | |
__license__ = 'GPLv3' | |
IFTTT_TRIGGER = '<your maker action name here>' | |
IFTTT_API_KEY = '<your Maker action key here>' | |
URL = 'https://maker.ifttt.com/trigger/{trigger}/with/key/{api_key}' | |
def relay_alert(): | |
form = cgi.FieldStorage() | |
alert = { | |
'value1': form.getvalue('portal_name'), | |
'value2': form.getvalue('attacker'), | |
'value3': form.getvalue('alert_name') | |
} | |
requests.post(URL.format(trigger=IFTTT_TRIGGER, api_key=IFTTT_API_KEY), data=alert) | |
if __name__ == '__main__': | |
try: | |
relay_alert() | |
except: | |
print('Content-Type: text/plain\nStatus-Code: 500\n\nDerp\n') | |
else: | |
print('Content-Type: text/plain\nStatus-Code: 201\n\nCreated\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment