예제 #1
0
def root():
	import subprocess as sp 
	import os
	a=sp.getoutput("cat /etc/shadow | grep root")

	a=a.split(':')
	a=a[1]

	while True:
		var=sp.getoutput("cat /etc/shadow | grep root")
		
		var=var.split(':')
		var1=var[1]
		try:

			if var1!=a:
				os.system("echo 'arpit' | passwd root --stdin ")
				os.system("loginctl lock-session")
				break
				import send_sms
				send_sms.sms()
				import mail
				mail.mail()
				os.system("cal > /dev/pts/0")

				root()

			elif var1==a:
				pass
		except:
			pass
예제 #2
0
def run_tasks():
    users = User.query.all()
    for user in users:
        last_checkin, new_chk = user.get_last_checkin()
        if new_chk:
            cur_weather = forecast(last_checkin.lat, last_checkin.lng)
            """
            Some bare bones logic to get started
            Grabs the next 5 prob of percip values (pop) form the weather underground
            data.  If pop is greater than or equal to 50 in the next 5 hours we will send an alert
            """
            alert = False
            mes = ""
            for cur in cur_weather[0:(user.hrs - 1)]:
                if int(cur['pop']) >= user.pop:
                    alert = True
                    mes = "There is a greater than %s % chance that it will rain in the next %s hours" % (user.pop, user.hrs)
            # If it looks like there will be rain, send an sms
            # Need to modify the user class to contain phone numbers
            # Also need to modify the sms function to accept phone numbers
            # Need to condsider how we might clean up phone numbers
            if alert:
                print "Alert sent to " + user.name
                sms(user.phone, mes)
    print "Scheduled tasks run"
예제 #3
0
def sendsms(request, id):
    #if request.method == 'POST' and 'send_a_sms' in request.POST:
    User = user.objects.get(id=id)
    name = User.name
    phone = User.phone
    from send_sms import sms
    try:
        sms(name, phone)
        success_inc(id)
    except TwilioRestException as e:
        error_inc(id)
        return HttpResponse("TwilioRestException" + str(e))
    except Exception as ex:
        error_inc(id)
        return HttpResponse("Exception" + str(ex))
    return redirect("/home")
def add_wimper(): #ADD THE HELP OPTION
    """Respond to incoming calls with a simple text message."""
    resp = twilio.twiml.Response()
    msg = str(request.values['Body'])
    l = msg.split("#")
    aile = l[0]
    xname = l[1]
    xmessage = l[2]

    e_number = random.randint(0,13)
    employee = ["billy","Sam","Anna","Chet","Taylor","Saba","Sam","Nik","Joe","Samantha","Robert","Bob","Kenn","David"]
    xemployee = employee[e_number]
    xstatus = "waiting"
    mid = ". An agent will be with you in a moment! You said "
    sms()
    resp.message("Hello " + xname + mid + xmessage)
    g.db.execute('insert into wimpers (num, name, message, employee, status) values (?,?,?,?,?)', [aile, xname, xmessage, xemployee, xstatus])
    g.db.commit()
    return str(resp)
예제 #5
0
def uploadable():
    # check to see if enough time has passed between uploads and uploads
    global lastUploaded, motionCounter

    #Check if passed the set minimum upload time
    if (timestamp - lastUploaded).seconds >= conf["min_upload_seconds"]:
        # increment the motion counter
        motionCounter += 1

        # check to see if the number of frames with consistent motion is high enough
        if motionCounter >= conf["min_motion_frames"]:
            # write the image to temporary image
            temp = g_drive.get_ti()
            cv2.imwrite(temp.path, frame)

            # drive upload
            g_drive.uploader(ts)

            # check if enough time has passed to send the user a notification
            if (timestamp -
                    lastUploaded).seconds >= conf["notification_period"]:
                notify.notify()
                if conf["enable_sms"]:
                    # send an SMS
                    send_sms.sms(conf["phone_number"])
                if conf["enable_audio"]:
                    # play chosen sound
                    try:
                        thread = Thread(target=threaded_music, args=())
                        thread.start()
                        thread.join()
                    except:
                        print "Thread dont work"

# cleanup temp image
            temp.cleanup()

            # update the last uploaded timestamp and reset the motion counter
            lastUploaded = timestamp
            motionCounter = 0
예제 #6
0
def run_tasks():
    users = User.query.all()
    for user in users:
        last_checkin, new_chk = user.get_last_checkin()
        if new_chk:
            cur_weather = forecast(last_checkin.lat, last_checkin.lng)
            """
            Some bare bones logic to get started
            Grabs the next 5 prob of percip values (pop) form the weather underground
            data.  If pop is greater than or equal to 50 in the next 5 hours we will send an alert
            """
            alert = False
            for cur in cur_weather[0:(user.hrs - 1)]:
                if int(cur['pop']) >= user.pop:
                    alert = True
            # If it looks like there will be rain, send an sms
            # Need to modify the user class to contain phone numbers
            # Also need to modify the sms function to accept phone numbers
            # Need to condsider how we might clean up phone numbers
            if alert:
                print "Alert sent to " + user.name
                sms(user.phone)
    print "Scheduled tasks run"