Created
September 28, 2016 04:30
-
-
Save haxwithaxe/94df9d73f54b51dbbc25374ea5ab4662 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 hidden or 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 <[email protected]>' | |
__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