Skip to content

Instantly share code, notes, and snippets.

@ygorth
Last active November 9, 2017 05:03
Show Gist options
  • Save ygorth/59fa2581adaece6489fc67c7b2870d35 to your computer and use it in GitHub Desktop.
Save ygorth/59fa2581adaece6489fc67c7b2870d35 to your computer and use it in GitHub Desktop.
Simple network tools
#!/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
#!/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