exploit the possibilities
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:

November 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close