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 masterEncryptionInformation(self, packet): io.info("Encryption Information (from master) : Long Term Key = " + packet.ltk.hex()) io.info("Redirecting to slave ...") self.a2sEmitter.sendp(ble.BLEEncryptionInformation(ltk=packet.ltk))