what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Simple LAN Scanner 1.0

Simple LAN Scanner 1.0
Posted Jan 8, 2011
Authored by Valentin Hoebel

Simple LAN Scanner is a simple python script that leverages scapy for discovering live hosts on a network.

tags | tool, scanner, python
systems | unix
SHA-256 | 5b9a1073a20d03e4e93144a5db6e630a62b90fb9f3bbaace030de8b42c127d90

Simple LAN Scanner 1.0

Change Mirror Download
#!/usr/bin/python

# !!! Install package python-scapy before you use it !!!

# Simple LAN Scanner
# by Valentin Hoebel (valentin@xenuser.org)
# Version 1.0 (08th January 2011)

# ASCII FOR BREAKFAST

# ---------- [Description]
# A very simple LAN scanner which shows MAC and IP addresses.

# ---------- [Features]
# - Shows you the MAC and IP of a running system.
# - Creates a small log file.

# ---------- [Usage example]
# sudo ./simple_lan_scan.py --network=192.168.1.0/24

# ---------- [Tested with]
# - Python 2.6.5

# ---------- [Notes]
# - This tool was developed using a Python 2.6.5 interpreter.
# - Modify, distribute, share and copy this code in any way you like!
# - Please note that this tool was created and published for educational purposes only.

# Power to the cows!

import sys, getopt
from scapy.all import srp,Ether,ARP,conf
from time import gmtime, strftime

def print_usage():
print_banner()
print "[!] Wrong argument and parameter passed. Use --help for more information."
print "[!] Usage: sudo ./simple_lan_scan.py --network=<your network>"
print "[i] Usage Example: sudo ./simple_lan_scan.py --network=192.168.1.0/24"
print ""
print ""
sys.exit()
return

def print_help():
print_banner()
print ""
print "[Description]"
print "The Simple LAN Scanner tries to show you"
print "the MAC and IP addresses of all running systems"
print "in your local network."
print ""
print "[Usage]"
print "sudo ./simple_lan_scan.py --network=<your network>"
print ""
print "[Usage example]"
print "sudo ./simple_lan_scan.py --network=192.168.1.0/24"
print ""
print "[Feature list]"
print "- Shows you the MAC and IP of a running system."
print "- Creates a small log file."
print ""
print "[Installation]"
print "- Requires package python-scapy."
print ""
print "[Some notes]"
print "- Tested with Python 2.6.5."
print "- Modify, distribute, share and copy the code in any way you like!"
print "- Please note that this tool was created for educational purposes only."
print "- Do not use this tool in an illegal way. Know and respect your local laws."
print "- Power to teh c0ws!"
print ""
print ""
sys.exit()
return

def print_banner():
print ""
print ""
print "Simple LAN Scanner"
print "by Valentin Hoebel (valentin@xenuser.org)"
print ""
print "Version 1.0 (08th January 2011)"
print "____________________________________________________"
print ""
return

def scan_lan(scan_network):
conf.verb=0
ans,unans=srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst=scan_network),timeout=2)
print ""

log_file=strftime("%d_%b_%Y_%H:%M:%S_+0000", gmtime()) + "_-_scan.log"
FILE = open(log_file, "w")
FILE.write("Simple LAN Scanner - Log File\n")
FILE.write("----------------------------------------\n")
FILE.write("[+] Scanned network: " + scan_network + "\n")
FILE.write("[+] Scan time: " + strftime("%d %b %Y, %H:%M:%S +0000 GMT", gmtime()) + "\n")
FILE.write("\n")

for snd,rcv in ans:
mac_address=rcv.sprintf("%Ether.src%")
ip_address=rcv.sprintf("%ARP.psrc%")

print rcv.sprintf("[+] Found a system! MAC: %Ether.src% IP: %ARP.psrc% ")
FILE.write(ip_address + ", " + mac_address + "\n")

FILE.write("\n")
FILE.close
print ""
print "[i] Completed the scan. Exiting now!"
print ""
print ""
return


def main(argv):
scan_network=""

try:
opts, args = getopt.getopt(sys.argv[1:], "", ["help", "network="])
except getopt.GetoptError :
print_usage()
sys.exit(2)

for opt, arg in opts:
if opt in ("--help"):
print_help()
break
sys.exit(1)
elif opt in ("--network") :
scan_network=arg

if len(scan_network) < 1:
print_usage()
sys.exit()

print_banner()
print "[i] Provided network to scan: " + scan_network
scan_lan(scan_network)

if __name__ == "__main__":
main(sys.argv[1:])
### EOF ###
Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    0 Files
  • 18
    Apr 18th
    0 Files
  • 19
    Apr 19th
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close