Paste #238068

   
pasted on 27.11.2021 17:10
  • Edit to this paste
  • Print
  • Raw
  • The following pastes replied to this paste:  # 262805
  • Show paste tree
  • Compare with paste
    #  
  • Toggle line numbers
  • Syntax highlighting  
Text paste
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#!/bin/bash
ip=$l
tcpscan()
{
ip=$i
for port in $(seq 1 65535);
do
timeout 1 bash -c "</dev/tcp/$ip/$port && echo Port $port is open ||echo Port $port is closed > /dev/null" 2>/dev/null || echo Connection timeout > /dev/null
done
}
tcpscan $ip
Add Comment
Author