コード例 #1
0
ファイル: esb_sniff.py プロジェクト: RCayre/mirage
 def show(self, packet):
     if utils.booleanArg(self.args["ACK_PACKETS"]) or (
             not utils.booleanArg(self.args["ACK_PACKETS"])
             and not isinstance(packet, esb.ESBAckResponsePacket)):
         io.displayPacket(packet)
         self.lastReceivedFrameTimestamp = utils.now()
         if self.pcap is not None:
             self.pcap.sendp(packet)
コード例 #2
0
ファイル: zigbee_sniff.py プロジェクト: topotam/mirage
 def show(self, packet):
     if ((self.target is None or
          (hasattr(packet, "srcAddr") and packet.srcAddr == self.target))
             and (self.targetPanID is None or
                  (hasattr(packet, "destPanID")
                   and packet.destPanID == self.targetPanID))):
         io.displayPacket(packet)
         if self.pcap is not None:
             self.pcap.sendp(packet)
コード例 #3
0
ファイル: ble_slave.py プロジェクト: conchyliculture/mirage
	def readByGroupTypeRequest(self,packet):
		io.info("Read By Group Type Request : startHandle = "+hex(packet.startHandle)+
				" / endHandle = "+hex(packet.endHandle)+" / uuid = "+hex(packet.uuid))
		(success,response) = self.server.readByGroupType(packet.startHandle, packet.endHandle, packet.uuid)
		if success:
			io.displayPacket(ble.BLEReadByGroupTypeResponse(attributes=response))
			self.emitter.sendp(ble.BLEReadByGroupTypeResponse(attributes=response))
		else:
			self.emitter.sendp(ble.BLEErrorResponse(request=0x10,ecode=response,handle=packet.startHandle))
コード例 #4
0
ファイル: ble_slave.py プロジェクト: conchyliculture/mirage
	def findInformationRequest(self,packet):
		io.info("Find Information Request : startHandle = "+hex(packet.startHandle)+
			" / endHandle = "+hex(packet.endHandle))
		(success,response) = self.server.findInformation(packet.startHandle,packet.endHandle)
		if success:
			io.displayPacket(ble.BLEFindInformationResponse(attributes=response))
			self.emitter.sendp(ble.BLEFindInformationResponse(attributes=response))
		else:
			self.emitter.sendp(ble.BLEErrorResponse(request=0x04,ecode=response,handle=packet.startHandle))
コード例 #5
0
	def show(self,packet):
		advMode = self.args["SNIFFING_MODE"].upper() == "advertisements".upper()
		isAnAdv =  isinstance(packet, ble.BLEAdvertisement)
		isAnEmpty = isinstance(packet,ble.BLEEmptyPDU)
		unknownInName = "Unknown" in packet.name
		isConnectReq = isinstance(packet,ble.BLEConnectRequest)
		addressMatching = (    isConnectReq
				   and packet.addr == utils.addressArg(self.args["TARGET"])
				   or  self.args["TARGET"] == ""
				   or  (hasattr(packet,"addr") and packet.addr == utils.addressArg(self.args["TARGET"])))
		if (
			(not advMode and (not isAnAdv or isConnectReq) and not isAnEmpty and not unknownInName) 
			 or (advMode and isAnAdv and addressMatching)
		   ):
			io.displayPacket(packet)
			if self.pcap is not None:
				self.pcap.sendp(packet)
			
			if utils.booleanArg(self.args["CRACK_KEY"]):
				if isConnectReq:
					self.initiatorAddress = packet.srcAddr
					self.initiatorAddressType = packet.srcAddrType
					self.responderAddress = packet.dstAddr
					self.responderAddressType = packet.dstAddrType

				if isinstance(packet, ble.BLEPairingRequest):
					self.pReq = packet.payload[::-1]
				if isinstance(packet,ble.BLEPairingResponse):
					self.pRes = packet.payload[::-1]
				if isinstance(packet,ble.BLEPairingConfirm) and self.mConfirm is None:
					self.mConfirm = packet.confirm[::-1]

				if isinstance(packet,ble.BLEPairingRandom) and self.mRand is not None and self.sRand is None:
					self.sRand = packet.random[::-1]
					while self.temporaryKey is None and not self.failure:
						pass
					if self.failure:
						self.errorDuringCracking()
					else:
						io.info("Derivating Short Term Key ...")
						self.shortTermKey = ble.BLECrypto.s1(self.temporaryKey,self.mRand,self.sRand)[::-1]
						io.success("Short Term Key found : "+ self.shortTermKey.hex())
						ble.BLELinkLayerCrypto.provideLTK(self.shortTermKey)
			
				if isinstance(packet,ble.BLEPairingRandom) and self.mRand is None:
					self.mRand = packet.random[::-1]
					self.failure = not self.crackTemporaryKey()
コード例 #6
0
	def onPacket(self,pkt):
		io.displayPacket(pkt)
コード例 #7
0
	def show(self):
		'''
		This method allows to display the packet.
		'''
		io.displayPacket(self)