예제 #1
0
파일: GET.py 프로젝트: gh0std4ncer/ping-me
def main():
    while(True):
        # The try/except is for the case when the file might not exist
        found = False
        try:
            country = ping_me.authenticate.extract_phone()[2]
            filename = country[:2] + country[-2:] + '.txt'
            target = "http://www.himanshumishra.in/pingme/cron/" + filename
            email = ping_me.authenticate.extract_email()
            hashed_email = hashlib.md5(email).hexdigest()
            key = ping_me.authenticate.extract_password()

            data = urllib2.urlopen(target)

            for line in data:
                line = line.split()
                if line[0] == hashed_email:
                    # ping time!
                    found = True
                    message = cryptex.decryptor(key, line[1])
                    if sys.platform == 'linux2':
                        subprocess.call(['notify-send', message])
                    elif sys.platform == 'darwin':
                        subprocess.call(['terminal-notifier', '-title',
                                         'ping-me', message])
                    elif sys.platform in ['win32', 'win64']:
                        # Do things for windows
                        pass

            # If not found in the country's name, search in XXXX.txt
            if not found:
                target = 'http://www.himanshumishra.in/pingme/cron/XXXX.txt'
                data = urllib2.urlopen(target)
                for line in data:
                    line = line.split()
                    if line[0] == hashed_email:
                        found = True
                        message = cryptex.decryptor(key, line[1])
                        if sys.platform == 'linux2':
                            subprocess.call(['notify-send', message])
                        elif sys.platform == 'darwin':
                            subprocess.call(['terminal-notifier', '-title',
                                                 message])
                        elif sys.platform in ['win32', 'win64']:
                            # Do things for windows
                            pass
            time.sleep(4)
        except:
            time.sleep(4)
예제 #2
0
def main():
    """Executed by cron every minute. Sends POST request to recieve
    reminder for upcoming minute."""

    target = "http://ping-me.himanshumishra.in/ping/"
    email = ping_me.authenticate.extract_email()
    key = ping_me.authenticate.extract_password()
    data_t = {"email": email, "password": key}
    r = requests.post(target, data=data_t)
    if ast.literal_eval(r.text)["success"] == "True":
        message = cryptex.decryptor(key, ast.literal_eval(r.text)["message"])
        if sys.platform == 'linux2':
            subprocess.call(['notify-send', message])
        elif sys.platform == 'darwin':
            # Need to install `terminal-notifier`
            # $ brew install terminal-notifier
            subprocess.call(
                ['terminal-notifier', '-title', 'ping-me', message])
        elif sys.platform in ['win32', 'win64']:
            # Do things for windows
            pass
예제 #3
0
파일: GET.py 프로젝트: priestd09/ping-me
def main():
    """Executed by cron every minute. Sends POST request to recieve
    reminder for upcoming minute."""

    target = "http://ping-me.himanshumishra.in/ping/"
    email = ping_me.authenticate.extract_email()
    key = ping_me.authenticate.extract_password()
    data_t = {
        "email" : email,
        "password" : key
    }
    r = requests.post(target, data=data_t)
    if ast.literal_eval(r.text)["success"] == "True":
        message = cryptex.decryptor(key, ast.literal_eval(r.text)["message"])
        if sys.platform == 'linux2':
            subprocess.call(['notify-send', message])
        elif sys.platform == 'darwin':
            # Need to install `terminal-notifier`
            # $ brew install terminal-notifier
            subprocess.call(['terminal-notifier', '-title',
                             'ping-me', message])
        elif sys.platform in ['win32', 'win64']:
            # Do things for windows
            pass