Exemplo n.º 1
0
def print_handover_select(message):
    print "Connection Handover Select Message"
    number_suffix = ('st', 'nd', 'rd', 'th')
    message = HandoverSelectMessage(message)
    for i, carrier in enumerate(message.carriers):
        carrier_type = carrier['carrier-type']
        if carrier_type == "application/vnd.wfa.wsc":
            carrier_name = "Wi-Fi (Simple Config)"
        elif carrier_type == "application/vnd.bluetooth.ep.oob":
            carrier_name = "Bluetooth (Easy Pairing)"
        else:
            carrier_name = carrier_type
        print "  %d%s carrier" % (i + 1, number_suffix[min(i, 3)]),
        print "is %s" % carrier_name
        print "    power    = %s" % carrier['power-state']
        config_data = carrier['config-data']
        if carrier_type == "application/vnd.wfa.wsc":
            cfg = WiFiConfigData.fromstring(config_data)
            print "    version  = %d.%d" % cfg.version
            print "    network  = %s" % cfg.ssid
            print "    password = %s" % cfg.network_key
            print "    macaddr  = %s" % cfg.mac_address
            print "    security = %s / %s" % \
                (cfg.authentication, cfg.encryption)
        elif carrier_type == "application/vnd.bluetooth.ep.oob":
            cfg = BluetoothConfigData.fromstring(config_data)
            print "    bdaddr   = %s" % cfg.device_address
            print "    class    = %s" % cfg.class_of_device.encode("hex")
            print "    sp hash  = %s" % cfg.simple_pairing_hash
            print "    sp rand  = %s" % cfg.simple_pairing_randomizer
            print "    longname = %s" % cfg.long_name
            print "    partname = %s" % cfg.short_name
        else:
            print carrier
Exemplo n.º 2
0
def print_handover_select(message):
    print "Connection Handover Select Message"
    number_suffix = ('st', 'nd', 'rd', 'th')
    message = HandoverSelectMessage(message)
    for i, carrier in enumerate(message.carriers):
        carrier_type = carrier['carrier-type']
        if carrier_type == "application/vnd.wfa.wsc":
            carrier_name = "Wi-Fi (Simple Config)"
        elif carrier_type == "application/vnd.bluetooth.ep.oob":
            carrier_name = "Bluetooth (Easy Pairing)"
        else:
            carrier_name = carrier_type
        print "  %d%s carrier" % (i+1, number_suffix[min(i,3)]),
        print "is %s" % carrier_name
        print "    power    = %s" % carrier['power-state']
        config_data  = carrier['config-data']
        if carrier_type == "application/vnd.wfa.wsc":
            cfg = WiFiConfigData.fromstring(config_data)
            print "    version  = %d.%d" % cfg.version
            print "    network  = %s" % cfg.ssid
            print "    password = %s" % cfg.network_key
            print "    macaddr  = %s" % cfg.mac_address
            print "    security = %s / %s" % \
                (cfg.authentication, cfg.encryption)
        elif carrier_type == "application/vnd.bluetooth.ep.oob":
            cfg = BluetoothConfigData.fromstring(config_data)
            print "    bdaddr   = %s" % cfg.device_address
            print "    class    = %s" % cfg.class_of_device.encode("hex")
            print "    sp hash  = %s" % cfg.simple_pairing_hash
            print "    sp rand  = %s" % cfg.simple_pairing_randomizer
            print "    longname = %s" % cfg.long_name
            print "    partname = %s" % cfg.short_name
        else:
            print carrier
Exemplo n.º 3
0
def print_bt21_token(message):
    cfg = BluetoothConfigData.fromstring(message[0].data)
    print "  Bluetooth (Easy Pairing)"
    print "    bdaddr   = %s" % cfg.device_address
    print "    class    = %s" % cfg.class_of_device.encode("hex")
    print "    sp hash  = %s" % cfg.simple_pairing_hash
    print "    sp rand  = %s" % cfg.simple_pairing_randomizer
    print "    longname = %s" % cfg.long_name
    print "    partname = %s" % cfg.short_name
Exemplo n.º 4
0
def print_bt21_token(message):
    cfg = BluetoothConfigData.fromstring(message[0].data)
    print "  Bluetooth (Easy Pairing)"
    print "    bdaddr   = %s" % cfg.device_address
    print "    class    = %s" % cfg.class_of_device.encode("hex")
    print "    sp hash  = %s" % cfg.simple_pairing_hash
    print "    sp rand  = %s" % cfg.simple_pairing_randomizer
    print "    longname = %s" % cfg.long_name
    print "    partname = %s" % cfg.short_name