Git Product home page Git Product logo

network-scanner-python's Introduction

MIT License LinkedIn

Network Scanner

Network Discovery | Traceroute | TCP and UDP Port Scanner

Table of Contents

About The Project

Network Discovery

This program lists all available interfaces present in the local machine and uses Scapy to identify all online machines within the local machine's LAN that are accessible through each of the local machine’s non-virtual interfaces. To achieve this, this program creates an ethernet frame that encapsulates an ARP packet. The Ethernet frame has its destination address set to the broadcast address while the ARP packet has the localhost's subnet address along with the CIDR notation. Finally, Scapy creates a list of ARP packets that are broadcasted to every IP address in the subnet and prints the MAC and IP addresses of the online machines which send a reply back to the localhost.

Traceroute

This traceroute program accepts either the destination IP address or hostname from the user and identifies the IP addresses or possible hostnames of all intermediary machines in between the source and destination. First, this tool identifies if the user has entered an IP address or hostname and finds the respective hostname or IP address accordingly. Next, it creates an IP datagram encapsulating a UDP packet with random destination ports in the range of 33434 - 33464 along with random high number source ports. The IP destination address is either directly provided by the user or is obtained using the hostname provided by the user via Scapy. The max hop is set to 20 and the TTL increases in accordance with the current hop number so that all intermediary machines in the path with a distance less than or equal to 20 hops can be discovered. Finally, it sends and receives the packets from one hop to the next and reports the hostname and IP address present in the response packet. If a packet is not acknowledged within the expected timeout of 3 seconds, the packet is sent one more time. Otherwise, a '*' is printed. The program stops as soon as it receives an ICMP Port Unreachable message (type 3) from the target which signifies that the packet has reached the destination and the destination port is no longer open.

Port Scanner

This program identifies the status of transport layer ports. To accomplish this, it uses the argparse module to get info about the desired ports, target, protocol, etc. from the user and then checks for any invalid port ranges. The program also uses the socket module to check if the target is valid. Next, if the user chooses a TCP scan, an IP datagram containing a TCP SYN packet is sent to all the desired ports of the desired IP. If the program receives a TCP SYN-ACK packet back from the host, then the program determines that the port is open. If the program receives a TCP RST packet, then the port is determined to be closed. If no answer is received within 5 seconds, then the port is marked as filtered. If the user chooses a UDP scan and port 53 is included in the user's desired port range, then a UDP packet containing a DNS query to apple.com is sent. For all other ports, a UDP packet with a dummy payload is sent. If the program receives either a DNS or UDP reply, then the port is determined to be open. If the port receives an ICMP unreachable or ICMP port unreachable error, then the port is determined to be closed. If there is no response from the port, it is determined to be Open|Filtered.

Requirements

Usage

Network Discovery

usage: ./networkdiscovery.py [-h] [--version]

Network Discovery

optional arguments:
  -h, --help  show this help message and exit
  --version   Show Program's Version Number and Exit

Traceroute

usage: ./traceroute.py [-h] [--version] [--target TARGET]

Traceroute

optional arguments:
  -h, --help       show this help message and exit
  --version        Show Program's Version Number and Exit
  --target TARGET  Hostname or IP

Port Scanner

usage: ./portscanner.py [-h] [--version] [--target TARGET] [--port PORT] [--tcp | --udp] [--verbose]

Port Scanner

optional arguments:
  -h, --help       show this help message and exit
  --version        Show Program's Version Number and Exit
  --target TARGET  Hostname or IP to scan
  --port PORT      Port [X] or Port Range [X-Y] to scan
  --tcp            TCP port scan (mutually exclusive with --udp)
  --udp            UDP port scan (mutually exclusive with --tcp)
  --verbose        Verbose output (Print all ports, not just open ports)

License

Distributed under the MIT License.

network-scanner-python's People

Contributors

i0nics avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

sergeyliyasov

network-scanner-python's Issues

License issue

Hi,

how can this have MIT-License, when scapy has GPLv2-License?

Greetings

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.