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 !")
def masterMasterIdentification(self, packet): io.info("Master Indentification (from master) : ediv = " + hex(packet.ediv) + " / rand = " + packet.rand.hex()) io.info("Redirecting to slave ...") self.a2sEmitter.sendp( ble.BLEMasterIdentification(rand=packet.rand, ediv=packet.ediv))