Exemplo n.º 1
0
from api import VacuumCleaner, MoveDirection
from time import sleep

if __name__ == '__main__':

    cleaner = VacuumCleaner()
    cleaner.send_debug_message("My device ID: " + cleaner.get_dev_id())
    sleep(61)
    cleaner.send_debug_message("Discovered things (1): {}".format(cleaner.discover_things()))
    cleaner.move(MoveDirection.FORWARD)
    sleep(61)
    cleaner.send_debug_message("Discovered things (2): {}".format(cleaner.discover_things()))
Exemplo n.º 2
0
if __name__ == '__main__':

    cleaner = VacuumCleaner()

    print("Trying to go back - success : {}".format(
        cleaner.move(MoveDirection.BACKWARD)))
    # cleaner.print_env()

    if cleaner.check_passability():
        print("There is free space in front of device!")
        print("Trying to go forward - success : {}".format(
            cleaner.move(MoveDirection.FORWARD)))
    else:
        print("There is NO free space in front of device!")
    cleaner.print_env()
    print("Discovered things: ".format(cleaner.discover_things()))

    if cleaner.check_passability():
        print("There is free space in front of device!")
        print("Trying to go forward - success : {}".format(
            cleaner.move(MoveDirection.FORWARD)))
    else:
        print("There is NO free space in front of device!")
    cleaner.print_env()

    print("Trying to rotate left - success : {}".format(
        cleaner.rotate(RotateDirection.LEFT)))
    cleaner.print_env()

    if cleaner.check_passability():
        print("There is free space in front of device!")
Exemplo n.º 3
0
from api import VacuumCleaner, MoveDirection, RotateDirection

if __name__ == '__main__':

    cleaner = VacuumCleaner()
    print("Discovered things (1): {}".format(cleaner.discover_things()))
    cleaner.send_debug_message("Distance 0")
    cleaner.rotate(RotateDirection.LEFT)
    cleaner.move(MoveDirection.FORWARD)
    cleaner.move(MoveDirection.FORWARD)
    cleaner.move(MoveDirection.FORWARD)
    cleaner.move(MoveDirection.FORWARD)
    cleaner.move(MoveDirection.FORWARD)
    cleaner.move(MoveDirection.FORWARD)
    cleaner.move(MoveDirection.FORWARD)
    cleaner.move(MoveDirection.FORWARD)
    cleaner.move(MoveDirection.FORWARD)
    cleaner.move(MoveDirection.FORWARD)
    cleaner.send_debug_message("Distance 10")
    print("Discovered things (2): {}".format(cleaner.discover_things()))
    cleaner.move(MoveDirection.FORWARD)
    cleaner.move(MoveDirection.FORWARD)
    cleaner.move(MoveDirection.FORWARD)
    cleaner.move(MoveDirection.FORWARD)
    cleaner.move(MoveDirection.FORWARD)
    cleaner.move(MoveDirection.FORWARD)
    cleaner.move(MoveDirection.FORWARD)
    cleaner.move(MoveDirection.FORWARD)
    cleaner.move(MoveDirection.FORWARD)
    cleaner.move(MoveDirection.FORWARD)
    cleaner.send_debug_message("Distance 20")
Exemplo n.º 4
0
            "Did not receive flag from : {}".format(device_name))
        time.sleep(61)
        cleaner.send_debug_message(
            "Did not receive flag from : {}".format(device_name))
        return ""

if __name__ == '__main__':
    flags = ""
    cleaner = VacuumCleaner()
    exploit = base64.b64decode(EXPLOIT_4)

    # infect first bulb
    infect_device(cleaner)
    time.sleep(15)

    things = cleaner.discover_things()
    for device in things:
        cleaner.send_message(device,
                             "FLAGFLAGFLAG" + cleaner.get_dev_id()[:10])

    # wait for result
    flags += wait_flag(cleaner, "P1_")

    things = cleaner.discover_things()
    for device in things:
        cleaner.send_message(device, "STOPSTOPSTOP")

    dump_flag(cleaner, flags)
    flags = ""

    # go to second bulb