Ejemplo n.º 1
0
def oledDisplay(msgType, message):
    # Displays to th oled, doesn't bother if the message hasnt changed.
    global lastDisplay
    # print "Message is %s and lastDisplay is %s" % (message,lastDisplay)
    if msgType == "p":
        header = "Pwned!:"
    elif msgType == "h":
        header = "Recent host:"

    if message != lastDisplay:
        # print "Upating display"
        #        lcd.home()
        #        lcd.clear()
        #        #lcd.autoscroll()
        #        #lcd.setCursor(2,1)
        #        lcd.message('%s' % (message))
        if lastDisplay:
            oled.chompit()
        else:
            oled.clear_display()

        oled.shift_display(right=True, count=16)
        oled.set_pos(0, 0)
        oled.write_string(header)
        oled.shift_display(right=False, count=16)
        oled.set_pos(1, 0)
        tdelay = 0.1
        oled.write_string(message.center(16), typeomatic_delay=tdelay)

        lastDisplay = message
Ejemplo n.º 2
0
def oledDisplay(msgType, message):
    # Displays to th oled, doesn't bother if the message hasnt changed.
    global lastDisplay
    #print "Message is %s and lastDisplay is %s" % (message,lastDisplay)
    if msgType == 'p':
        header = 'Pwned!:'
    elif msgType == 'h':
        header = 'Recent host:'

    if message != lastDisplay:
        #print "Upating display"
        #        lcd.home()
        #        lcd.clear()
        #        #lcd.autoscroll()
        #        #lcd.setCursor(2,1)
        #        lcd.message('%s' % (message))
        if lastDisplay:
            oled.chompit()
        else:
            oled.clear_display()

        oled.shift_display(right=True, count=16)
        oled.set_pos(0, 0)
        oled.write_string(header)
        oled.shift_display(right=False, count=16)
        oled.set_pos(1, 0)
        tdelay = 0.1
        oled.write_string(message.center(16), typeomatic_delay=tdelay)

        lastDisplay = message
Ejemplo n.º 3
0
def advertise():
    # Retruns a random advertisement.
    global lastDisplay
    global adLoopCount
    global ownerTwitter
    currentHour = datetime.now().hour
    if currentHour >= 20 or currentHour <= 2:
        partyMode()
    else:
        ads = [
            twitter,
            "Free Hugs!",
            "___ all the ___!",
            "Hack the Planet!",
            "We like beer.",
            "Ice? Not so much",
            "Hack 4 Charities",
            "Chess?",
            "Ironliver comp.",
            "@starkdong",
            "LiverStrong!",
            "CTF fun for all!",
        ]
        if adLoopCount >= 5:
            message = "Join my SSID:"
            ssid = getSSID()
            adLoopCount = 0
            oled.chompit()
            oled.set_pos(0, 0)
            oled.write_string("There are many")
            oled.set_pos(1, 0)
            oled.write_string("derbies but")
            sleep(5)
            oled.clear_display()
            oled.set_pos(0, 0)
            oled.write_string("This one is")
            oled.set_pos(1, 0)
            owner = ownerTwitter + "'s"
            oled.write_string(owner.center(16))
            sleep(10)
            oled.chompit()
            oled.set_pos(0, 0)
            oled.shift_display(right=True, count=16)
            oled.write_string(message)
            oled.shift_display(right=False, count=16)
            sleep(1)
            oled.set_pos(1, 0)
            oled.write_string(ssid.center(16))
            sleep(10)
            oled.chompit()
            oled.set_pos(0, 0)
            oled.write_string("Information at:")
            oled.set_pos(1, 0)
            oled.write_string("http://hmd.lafayette.edu")
            for shift in range(8):
                oled.shift_display(right=False, count=1)
                sleep(1)
            for shift in range(8):
                oled.shift_display(right=True, count=1)
                sleep(1)
            for shift in range(8):
                oled.shift_display(right=False, count=1)
                sleep(1)
            for shift in range(8):
                oled.shift_display(right=True, count=1)
                sleep(1)

        else:
            ad = random.choice(ads)
            if ad != lastDisplay:
                footer = "Hack My Derby!"

                if lastDisplay:
                    oled.chompit()
                else:
                    oled.clear_display()

                oled.set_pos(0, 0)
                oled.shift_display(right=True, count=16)
                oled.write_string(ad.center(16))
                oled.shift_display(right=False, count=16)
                sleep(1)
                oled.set_pos(1, 0)
                oled.write_string(footer.center(16))
                lastDisplay = ad
                adLoopCount = adLoopCount + 1
Ejemplo n.º 4
0
def advertise():
    # Retruns a random advertisement.
    global lastDisplay
    global adLoopCount
    global ownerTwitter
    currentHour = datetime.now().hour
    if currentHour >= 20 or currentHour <= 2:
        partyMode()
    else:
        ads = [
            twitter, 'Free Hugs!', '___ all the ___!', 'Hack the Planet!',
            'We like beer.', 'Ice? Not so much', 'Hack 4 Charities', 'Chess?',
            'Ironliver comp.', '@starkdong', 'LiverStrong!', 'CTF fun for all!'
        ]
        if adLoopCount >= 5:
            message = 'Join my SSID:'
            ssid = getSSID()
            adLoopCount = 0
            oled.chompit()
            oled.set_pos(0, 0)
            oled.write_string('There are many')
            oled.set_pos(1, 0)
            oled.write_string('derbies but')
            sleep(5)
            oled.clear_display()
            oled.set_pos(0, 0)
            oled.write_string('This one is')
            oled.set_pos(1, 0)
            owner = ownerTwitter + '\'s'
            oled.write_string(owner.center(16))
            sleep(10)
            oled.chompit()
            oled.set_pos(0, 0)
            oled.shift_display(right=True, count=16)
            oled.write_string(message)
            oled.shift_display(right=False, count=16)
            sleep(1)
            oled.set_pos(1, 0)
            oled.write_string(ssid.center(16))
            sleep(10)
            oled.chompit()
            oled.set_pos(0, 0)
            oled.write_string('Information at:')
            oled.set_pos(1, 0)
            oled.write_string('http://hmd.lafayette.edu')
            for shift in range(8):
                oled.shift_display(right=False, count=1)
                sleep(1)
            for shift in range(8):
                oled.shift_display(right=True, count=1)
                sleep(1)
            for shift in range(8):
                oled.shift_display(right=False, count=1)
                sleep(1)
            for shift in range(8):
                oled.shift_display(right=True, count=1)
                sleep(1)

        else:
            ad = random.choice(ads)
            if ad != lastDisplay:
                footer = 'Hack My Derby!'

                if lastDisplay:
                    oled.chompit()
                else:
                    oled.clear_display()

                oled.set_pos(0, 0)
                oled.shift_display(right=True, count=16)
                oled.write_string(ad.center(16))
                oled.shift_display(right=False, count=16)
                sleep(1)
                oled.set_pos(1, 0)
                oled.write_string(footer.center(16))
                lastDisplay = ad
                adLoopCount = adLoopCount + 1
Ejemplo n.º 5
0
 def get(self):
     result = oled.chompit()
     return jsonify(result)