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 setting the TZ environment variable avoids thousands of system calls
Viewed 11284 times since Mon, May 21, 2018
List usernames instead of uids with the ps command for long usernames
Viewed 3390 times since Wed, Jul 25, 2018
ZPOOL: Detach a submirror from a mirrored zpool
Viewed 3729 times since Sun, Jun 3, 2018
Tip: SSD and Linux. Enable TRIM and check if it works
Viewed 18828 times since Fri, May 15, 2020
Nagrywanie sesji SSH do pliku
Viewed 3768 times since Thu, May 24, 2018
How to sort IP addresses in Linux
Viewed 4667 times since Sun, May 20, 2018
Linux get the list of FC HBA’s and WWPN
Viewed 4856 times since Tue, May 22, 2018
RHCS: Configure an active/backup pacemaker cluster
Viewed 10490 times since Sun, Jun 3, 2018
Red Hat Cluster Tutorial
Viewed 2938 times since Sun, Jun 3, 2018
UUIDs and Linux: Everything you ever need to know [Update]
Viewed 5985 times since Tue, Jul 17, 2018