Created
December 8, 2015 05:41
-
-
Save garethpaul/0812b6c7f7b0537d785c to your computer and use it in GitHub Desktop.
iot_listener.py
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
from scapy.all import * | |
import tweepy | |
# Make constants to hold values of our keys | |
CONSUMER_KEY = "xxxxxx" | |
CONSUMER_SECRET = "xxxx" | |
ACCESS_TOKEN = "xxxx" | |
ACCESS_SECRET = "xxxx" | |
MAIN_USER = "gpj" | |
# set auth variables | |
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) | |
auth.set_access_token(ACCESS_TOKEN, ACCESS_SECRET) | |
api = tweepy.API(auth) | |
def arp_display(pkt): | |
if pkt[ARP].op == 1: #who-has (request) | |
if pkt[ARP].hwsrc == 'xx:xx:xx:xx:xx:xx': | |
print "Request from the door" | |
api.send_direct_message(MAIN_USER, "Hello there is someone at your door") | |
else: | |
print "Request from " + pkt[ARP].hwsrc | |
print sniff(prn=arp_display, filter="arp", store=0, count=0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment