-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPortScanner.sh
45 lines (34 loc) · 1.19 KB
/
PortScanner.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
#++++++++++++Variables++++++++++++#
default="google.com"
address=${1:-$default}
def_first=1
first_port=${2:-$def_first}
def_last=1000
last_port=${3:-$def_last}
#++++++++++++++++++++++++++++++++#
echo "
..######...######.....###....##....##.##....##.####.##....##..######..
.##....##.##....##...##.##...###...##.###...##..##..###...##.##....##.
.##.......##........##...##..####..##.####..##..##..####..##.##.......
..######..##.......##.....##.##.##.##.##.##.##..##..##.##.##.##...####
.......##.##.......#########.##..####.##..####..##..##..####.##....##.
.##....##.##....##.##.....##.##...###.##...###..##..##...###.##....##.
..######...######..##.....##.##....##.##....##.####.##....##..######..
"
echo "
########################################
Target is -----------> $address
Begining Port -------> $first_port
Ending Port ---------> $last_port
########################################
"
#++++++++++++ Functionality ++++++++++++#
for port in $(seq $first_port $last_port); do
if timeout .5 bash -c "</dev/tcp/$address/$port &>/dev/null"; then
echo "Port $port is open"
else
echo "Port $port is closed"
fi
done
#++++++++++++++++++++++++++++++++++++++++#