Scripts pour scanner des ports sous Linux

#!/bin/bash
ports=(21 22 53 80 443 3306 8443 8080)
for port in ${ports[@]}; do
timeout 1 bash -c "echo \"Port Scan Test\" > /dev/tcp/1.1.1.1/$port && echo $port is open || /dev/null" 
done

#!/usr/bin/python3
import socket
host = "1.1.1.1"
portList = [21,22,53,80,443,3306,8443,8080]
for port in portList:
 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 try:
  s.connect((host,port))
  print("Port ", port, " is open")
 except:
  print("Port ", port, " is closed")

nc -zv 192.168.100.1 1-65535

Si aucun outil n’est disponible, nous pouvons télécharger des binaires statiques (statically compiled binaries) sur le site https://github.com/andrew-d/static-binaries

Leave a Reply