Introduction to Nmap
Nmap (Network Mapper) is a security scanner, used to discover hosts and services on a computer network, thus building a "map" of the network. To accomplish its goal, Nmap sends specially crafted packets to the target host(s) and then analyzes the responses.Steps
In tutorial we will follow basic mentioned steps,
- Install Nmap on Raspberry Pi
- Find Gateway Ip of Pi
- Python code to detect Particular device
Install Map on Raspberry Pi
To Install Nmap on Raspberry Pi simply run below command,sudo apt-get install nmap
Find below image for reference of installation process,

Find IP Address of Gateway Device
To find IP address of Gateway device run below command,
route | grep default
To find IP address of Raspberry PI device run below command,
ifconfig
Python code to detect Particular device
Use below python script to find particular device from network. Modify mac1
and mac2 with your intended devices mac address and run script.
import subprocess
mac1="A0:F3:C1:E2:33:8E"
mac2="F0:79:60:2B:1A:E4" result=subprocess.check_output("sudo nmap -sn 192.168.0.1-255", shell=True)
print(result)
if (mac1 in result):
print("1st device found on network")
if (mac2 in result):
print("2st device found on network")
Below image is shows execution of above python script.
You can download above python script here.
You may also check our other posts at
Inverter 12V DC to 230V AC using Arduino Nano
How to Install Mplab Harmony Integrated Software Framework
Scan Network Using Python On Raspberry Pi / How to Detect Wi-Fi devices
on Raspberry Pi
How To Load Micropython Firmware On ESP8266 using Windows
Overview of MicroPython
Arduino Fan Speed Controll Using Pulse Width Modulation (PWM)
#tags
electronics for you,electronicsgarage
Raspberry PI,Network,Nmap,Python,Subprocess,Getaway,Mac,IP
electronicshub ,electronicsforu
IoT

0 Comments