Last active
November 9, 2017 05:03
-
-
Save ygorth/59fa2581adaece6489fc67c7b2870d35 to your computer and use it in GitHub Desktop.
Simple network tools
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$1" == "" ] | |
then | |
echo "Usage: ./ping .sh 192.168.1" | |
else | |
for x in `seq 1 254`; do | |
ping -c 1 $1.$x | grep "64 bytes" | cut -d " " -f 4 | sed 's/.$//' | |
done | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Simple port scanner | |
""" | |
import socket | |
IP = raw_input("Enter a host to scan: ") | |
PORT = input("Enter a port number: ") | |
# AF_INET = IPv4 ; SOCK_STREAM = TCP | |
SOCK = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
if SOCK.connect_ex((IP, PORT)): | |
print "Port", PORT, "is closed" | |
else: | |
print "Port", PORT, "is open" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment