Code Monkey home page Code Monkey logo

Comments (3)

hash3liZer avatar hash3liZer commented on July 18, 2024

Hi, Perhaps you can help me with that. But does MAC support monitor mode? If yes, we can implement it.

from wifibroot.

Hamid-Najafi avatar Hamid-Najafi commented on July 18, 2024

yes,
see these
better way:
https://ss64.com/osx/tcpdump.html
and airport
https://apple.stackexchange.com/questions/272930/how-to-enable-wireless-monitoring-macbook-pro

from wifibroot.

mogekag avatar mogekag commented on July 18, 2024

Mac seems to support monitor mode, but it seems like once cannot put the card into monitor mode without actively sniffing for something. I was able to list the interfaces in wifibroot.py by using:

def list_ifaces(self):
		ifaces = []
		'''
		macos does not have this directory, instead you can check for interfaces
		with the command networksetup -listallhardwareports .
		'''
		#dev = open('/proc/net/dev', 'r')
		#data = dev.read()
		# for facecard in re.findall('[a-zA-Z0-9]+:', data):
		# 	ifaces.append(facecard.rstrip(":"))
		# dev.close()
		os.system('networksetup -listallhardwareports | grep \'Device\' | sed s/"Device: "/""/g > /tmp/iface-wifibroot.txt')
		dev = open('/tmp/iface-wifibroot.txt', 'r')
		for facecard in dev.readlines():
			ifaces.append(facecard.rstrip('\n'))
		dev.close()
		return ifaces

On is_mon() and is_man() I was able to replicate the behavior on linux by declaring airport built-in tool path and changing the regexp, but since one cannot actively put the interface on monitor mode and just leave it, I ended up completely bypassing this on check_mon().

_OS_AIRPORT_PATH = '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport'

def is_mon(self, iface):
		co = subprocess.Popen([_OS_AIRPORT_PATH, '-I'], stdout=subprocess.PIPE)
		data = co.communicate()[0].decode('utf-8')
		card = re.findall('op mode: [A-Za-z]+', data)
		if "monitor" in card:
			return True
		else:
			return False

Now, one can set a specific channel with airport command with os.system(_OS_AIRPORT_PATH + " %s -c%d" % (self.iface, n)) on all hopper related functions, but I still was not able to scan for networks the same way as airport -s.

Edit: grammar

from wifibroot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.