├── python-2-vs-python-31.jpg ├── Readme.md ├── scanerRouter.py └── .gitignore /python-2-vs-python-31.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shayanizi/pyFindMac/HEAD/python-2-vs-python-31.jpg -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | this script can show all mac addresses in a subnet of localhost 2 | ------------------------------------------------------ 3 | FOR use it : 4 | 5 | 1 >> install python2.7.* 6 | 7 | 2 >> install moudel scapy { pip install scapy } 8 | 9 | 3 >> then run the script and see results :)) 10 | 11 | 4 >> you can emmbeded it 12 | 13 | GOOD LUCK 14 | ----------------------------------------------------- 15 | 16 | -------------------------------------------------------------------------------- /scanerRouter.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python2.7.14 2 | #the first import scapy moduls 3 | from scapy.all import * 4 | from scapy.layers.l2 import Ether, ARP 5 | #create a loop for testing every ip in localhost 6 | for subnetId in range(1,255): 7 | for hostId in range(1,255): 8 | ip="192.168."+str(subnetId) + "." +str(hostId) 9 | arpRequest=Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst=ip,hwdst="ff:ff:ff:ff:ff:ff") 10 | arpResponse = srp1(arpRequest,timeout=1,verbose=0) 11 | if arpResponse: 12 | print "IP >> " + arpResponse.psrc + " MAC >> " + arpResponse.hwsrc 13 | #___________________________________________________________________________________________ -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | 49 | # Translations 50 | *.mo 51 | *.pot 52 | 53 | # Django stuff: 54 | *.log 55 | local_settings.py 56 | 57 | # Flask stuff: 58 | instance/ 59 | .webassets-cache 60 | 61 | # Scrapy stuff: 62 | .scrapy 63 | 64 | # Sphinx documentation 65 | docs/_build/ 66 | 67 | # PyBuilder 68 | target/ 69 | 70 | # Jupyter Notebook 71 | .ipynb_checkpoints 72 | 73 | # pyenv 74 | .python-version 75 | 76 | # celery beat schedule file 77 | celerybeat-schedule 78 | 79 | # SageMath parsed files 80 | *.sage.py 81 | 82 | # dotenv 83 | .env 84 | 85 | # virtualenv 86 | .venv 87 | venv/ 88 | ENV/ 89 | 90 | # Spyder project settings 91 | .spyderproject 92 | .spyproject 93 | 94 | # Rope project settings 95 | .ropeproject 96 | 97 | # mkdocs documentation 98 | /site 99 | 100 | # mypy 101 | .mypy_cache/ 102 | --------------------------------------------------------------------------------