Exemplo n.º 1
0
    def keyDistribution(self, type="initiator"):
        if type == "initiator":
            keyDistribution = self.initiatorKeyDistribution
        else:
            keyDistribution = self.responderKeyDistribution
        if keyDistribution.encKey:
            io.info("Sending LTK...")
            self.emitter.sendp(
                ble.BLEEncryptionInformation(
                    ltk=bytes.fromhex(self.args["LTK"])[::-1]))
            self.emitter.sendp(
                ble.BLEMasterIdentification(
                    ediv=utils.integerArg(self.args["EDIV"]),
                    rand=bytes.fromhex(self.args["RAND"])))
            io.success("Sent !")
        if keyDistribution.idKey:
            io.info("Sending IRK...")
            self.emitter.sendp(
                ble.BLEIdentityInformation(
                    irk=bytes.fromhex(self.args["IRK"])[::-1]))
            self.emitter.sendp(
                ble.BLEIdentityAddressInformation(
                    address=utils.addressArg(self.args["ADDR"]),
                    type=self.args["ADDR_TYPE"].lower()))
            io.success("Sent !")

        if keyDistribution.signKey:
            io.info("Sending CSRK...")
            self.emitter.sendp(
                ble.BLESigningInformation(
                    csrk=bytes.fromhex(self.args["CSRK"])[::-1]))
            io.success("Sent !")
Exemplo n.º 2
0
 def masterSigningInformation(self, packet):
     io.info("Signing Information (from master) : csrk = " +
             packet.csrk.hex())
     io.info("Redirecting to slave ...")
     self.a2sEmitter.sendp(ble.BLESigningInformation(csrk=packet.csrk))