Jump to content

Ned

Active Members
  • Posts

    2
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Ned

  1. I have been testing the Mark IV with an observe/report system incorporating python. The biggest challenge has been memory. Something in my main python script is eating memory. The only way to run this system, and keep it stable is to run it inside of a bash script that kills and reloads the program before the pineapple crashes. This setup can be used to search for lost/stolen equipment, and can also be used to detect equipment you do not want in your area. For example, if you are at a job location where people should be working instead of using unauthorized wireless devices, Nook, psp, personal laptops, etc. this setup can alert you via text message when they are present. There are 2 python scripts and one bash script. Macmon.sh restarts macwatch.py every 15 seconds, and exits if the file "macstop" exists. In the current setup, macwatch.py checks for a single mac in every packet it receives, if it matches, it launches tweet.py and passes a message to it. macwatch.py then creates the file macstop, and exits. Tweet.py posts the message passed to it, and exits. I am keeping tweet.py separate to keep this system modular, and to keep the twitter codes in one place. Any suggestions regarding python memory management would be greatly appreciated. macmon.sh _______________________________________ #!/bin/bash control_c() # run if user hits control-c { echo -en "\n*** Killing Python ***\n" pkill python > /dev/null exit $? } # trap keyboard interrupt (control-c) trap control_c SIGINT while true; do python macwatch.py $1 & sleep 15 sync && echo 3 > /proc/sys/vm/drop_caches if [ -e macstop ] then rm macstop break fi pkill python done -------------------------------------------- macwatch.py ____________________________________________ import logging logging.getLogger("scapy.runtime").setLevel(logging.ERROR) from scapy.all import * interface = "mon.wlan0" def sniffReq(p): macwatch = sys.argv[1] if p.sprintf("%Dot11.addr2%") == macwatch: macwatch = "Pineapple_detected_" + macwatch notify = "python tweet.py " + str(macwatch) os.system(notify) os.system("touch macstop") quit() else: del p sniff(iface=interface,prn=sniffReq) ----------------------------------------------- tweet.py ________________________________________________ import os import tweepy import string import time import sys tweetline = sys.argv[1] consumer_key =' ' consumer_secret=' ' access_token=' ' access_token_secret=' ' auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token, access_token_secret) api = tweepy.API(auth) api.update_status(tweetline) ------------------------------------------------------------
  2. The more I work with the MKIV in different scenarios, and configurations, the more I see the need to have it "internet aware" so it can decide if it is capable of sending alerts, uploading information, or quietly save everything for later. Until I find a more bandwidth friendly solution, (currently no dig on the pineapple) I created the following script in my usb folder named iconnect.sh and ran 'chmod +x iconnect.sh' then added '/usb/iconnect.sh &' to /etc/rc.local ----------------------------- #!/bin/bash while [ 1 ]; do touch /usb/online rm /usb/online WGET="/usr/bin/wget" $WGET http://www.google.com -O /usb/online &> /dev/null sleep 15 done ----------------------------- Any program that collects data can now check for the existence of /usb/online so it can decided whether to upload the information, or store it.
×
×
  • Create New...