Simple demo showcasing IoT and Auto0's Webtask integration.
npm install wt-cli -g
wt create send_text.js --name send_text -s TWILIO_ACCOUNT_SID=aaaa -s TWILIO_AUTH_TOKEN=aaa -s TWILIO_NUMBER=+15005550006
sudo python run.py
from scapy.all import * | |
import requests | |
import time | |
WEB_TASK_URL = 'https://webtask.it.auth0.com/api/run/wt-xmlking+github-gmail_com-0/send_text?webtask_no_cache=1' | |
def call_webtask(): | |
data = { | |
"Timestamp": time.strftime("%Y-%m-%d %H:%M"), | |
"to": '+19513677933', | |
"message": 'Tide button pressed' | |
} | |
r = requests.post(WEB_TASK_URL, data) | |
print(r.text) | |
def arp_display(pkt): | |
if pkt[ARP].op == 1: #who-has (request) | |
if pkt[ARP].psrc == '0.0.0.0': # ARP Probe | |
if pkt[ARP].hwsrc == '74:75:48:8a:4f:f0': # Tide | |
# print "Pushed Tide" | |
call_webtask() | |
else: | |
print "ARP Probe from unknown device: " + pkt[ARP].hwsrc | |
print sniff(prn=arp_display, filter="arp", store=0, count=10) |
"use latest"; | |
var request = require('request'); | |
module.exports = function (context, callback) { | |
var required_params = ['TWILIO_AUTH_TOKEN', 'TWILIO_ACCOUNT_SID', 'to', 'TWILIO_NUMBER', 'message']; | |
for (var p in required_params) | |
if (!context.data[required_params[p]]) | |
return callback(new Error('The `' + required_params[p] + '` parameter must be provided.')); | |
request({ | |
url: 'https://api.twilio.com/2010-04-01/Accounts/' + context.data.TWILIO_ACCOUNT_SID + '/Messages', | |
method: 'POST', | |
auth: { | |
user: context.data.TWILIO_ACCOUNT_SID, | |
pass: context.data.TWILIO_AUTH_TOKEN | |
}, | |
form: { | |
From: context.data.TWILIO_NUMBER, | |
To: context.data.to, | |
Body: context.data.message | |
} | |
}, function (error, res, body) { | |
callback(error, body); | |
}); | |
}; |