Exemplo n.º 1
0
	def __init__(self, id=0, port=None):
		self.x = 126 # angle range is [51..201]
		[self._device, idString] = utils.open(utils.getPort(id, port))

		if idString == "joystick streaming angle, Ready!":
			logging.debug("Device is a joystick ({}): {}".format(len(idString), idString))
		else:
			logging.error("Device is NOT a joystick ({}): {}".format(len(idString), idString))
Exemplo n.º 2
0
 def __init__(self, id=0, port=None):
     [self._device, idString] = utils.open(utils.getPort(id, port))
     if not self._device:
         logging.error("No BITSI extended buttonbox connected.")
     elif idString == "BITSI_extend mode, Ready!":
         logging.debug(
             "Device is a BITSI extended buttonbox ({}): {}".format(
                 len(idString), idString))
     else:
         logging.error(
             "Device is NOT a BITSI extended  buttonbox ({}): {}".format(
                 len(idString), idString))
     self.calibrated = False
Exemplo n.º 3
0
 def __init__(self, id=0, port=None):
     self._port = utils.getPort(id, port)
     self._device = None
     if not self._port:
         raise Exception(
             "No USB serial device connected, could not get port name.")
     [self._device, idString] = utils.open(self._port)
     if not self._device:
         logging.critical(
             "No BITSI buttonbox connected, could not connect to port {}".
             format(self._port))
     elif idString == "BITSI mode, Ready!" or idString == "BITSI event mode, Ready!":
         logging.debug("Device is a BITSI buttonbox ({}): {}".format(
             len(idString), idString))
     else:
         logging.error("Device is NOT a BITSI buttonbox ({}): {}".format(
             len(idString), idString))
Exemplo n.º 4
0
def populateScanResultsDB():
    db = create_engine('sqlite:///iot.db')

    db.echo = True  # True means verbose log

    metadata = MetaData(db)

    scanResults = Table('ScanResults', metadata, autoload=True)

    ins = scanResults.insert()

    vul = ['Yes', 'No', 'No', 'No']
    dev = ['raspberrypi', 'NodeMCU']
    protocol = ['SSH', 'FTP', 'Telnet', 'HTTP']
    os_ = ['Linux', 'RTOS']
    arch_ = ['x64', 'x86_64']

    for i in range(1000):
        vulnerable = random.choice(vul)
        device = random.choice(dev)
        mapped = zip(dev, os_)
        mapped = list(mapped)
        mapp = random.choice(mapped)
        device = mapp[0]
        _os = mapp[1]
        _arch = random.choice(arch_)
        times = randomize_time()
        ip_address = IP_generator()
        prot = random.choice(protocol)
        portN = getPort(prot)

        ins.execute(Timestamp=times,
                    Vulnerable=vulnerable,
                    IPAddress=ip_address,
                    Device=device,
                    portNumber=portN,
                    protocolName=prot,
                    os=_os,
                    arch=_arch)
Exemplo n.º 5
0
def control_motor_with_keys(port_input, speed=50):

    # get the port using getPort in utils
    port = utils.getPort(port_input)

    # get user input to start motor
    start_motor = None
    while(not (start_motor == 'g' or start_motor == 'G') ):
        start_motor = input("Waiting for you to press the 'g' key...")

    # start motor at speed 'speed'
    print("starting motor at port ", port, "with speed")
    BrickPi.MotorSpeed[port] = speed
    stop_motor = None

    # get user input to start motor
    while (not (stop_motor == 's' or stop_motor == 'S')):
        stop_motor = input("stop me with s")
        BrickPiUpdateValues()

    #stop motor
    BrickPi.MotorSpeed[port] = 0
Exemplo n.º 6
0
 def _start(self):
     s = SimpleXMLRPCServer(('', getPort(self.url)), logRequests=False)
     s.register_instance(self)
     s.serve_forever()