Prosty skaner portów TCP w bash

S

kanery do portów są jak śrubokręty. Nigdy nie ma ani jednego w pobliżu kiedy jest najbardziej potrzebny. Z pomocą przychodzi powłoka bash:

1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/bash
for a in $(yes scan | head -1024)
  do
  (( start++ ))
  if [[ -n $(echo '' > /dev/$2/$1/$start && echo "up") ]];
      then
      echo "Port $start UP!" >> scan;
  fi
done;
clear
cat scan;
rm scan;

Hack użyty w tym prostym skanerze korzysta z mało znanej metody obsługi sieci w powłoce bash. Wydając polecenie: ./skaner.sh host.com.pl tcp – przeskanujemy porty od 1 do 1024 serwera host.com.pl.

0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
How log rotation works with logrotate
Viewed 5571 times since Fri, Nov 30, 2018
ZPOOL: Create a new zpool for zfs filesystems
Viewed 2883 times since Sun, Jun 3, 2018
Stunnel Setup
Viewed 18760 times since Fri, Sep 28, 2018
watchdog How to restart a process out of crontab on a Linux/Unix
Viewed 6809 times since Tue, Jul 31, 2018
Odpalenie polecenia tylko na jedną godzinę
Viewed 3377 times since Thu, May 24, 2018
RHEL: Back-up/Replicate a partition table
Viewed 4208 times since Sun, May 27, 2018
RHCS6: Quorum disk and heuristics
Viewed 5065 times since Sun, Jun 3, 2018
stunnel Securing telnet connections with stunnel
Viewed 2152 times since Sun, Dec 6, 2020
How to Synchronize Directories Using Lsyncd in Linux
Viewed 15057 times since Wed, Oct 31, 2018
OEL 7 – How to disable IPv6 on Oracle Linux 7 – Follow Up
Viewed 10193 times since Wed, Jul 25, 2018