perl script for scan TCP ports .(轉)
perl script for scan TCP ports .(轉)[@more@]A simple perl script that scans a machine for reachable TCP ports.[code:1:d7df680c80]#!/usr/bin/perl$|=1;$tghost = shift || $ENV{"HOSTNAME"};$maxprt = shift || 1024;$AF_INET=2;$SOCK_STREAM=1;$sockaddr='S n a4 x8';($name,$aliases,$proto)=getprotobyname('tcp');foreach $port (1 .. $maxprt){($name,$aliases,$type,$len,$thataddr)=gethostbyname($tghost);$this=pack($sockaddr,$AF_INET,0,$thisaddr);$that=pack($sockaddr,$AF_INET,$port,$thataddr);die "unknown host $tghost
" if($thataddr eq "");socket(S,$AF_INET,$SOCK_STREAM,$proto) or die $!;bind(S,$this) or die $!;if(connect(S,$that)){($srv_name, $srv_aliases, undef, undef)=getservbyport($port,'tcp');printf("%5d %s
", $port, $srv_name || "unknown serv");close(S);}}exit 0;[/code:1:d7df680c80
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8225414/viewspace-943003/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- marathon參考(11):ports埠設定(轉)
- Shell Script(轉)
- 保持一個最新的ports樹[翻譯](轉)
- IPTables配置Script(轉)
- ORACLE常用Script(轉)Oracle
- ORACLE常用Script (轉)Oracle
- [轉貼]Skip Scan IndexIndex
- perl橫豎轉換
- 用ports安硯apache13_modssl+mysql+php+phpmyadmin(轉)ApacheMySqlPHP
- perl除錯哲學(轉)除錯
- Perl 連線 SQL Server (轉)SQLServer
- 比較 python & perl(轉)Python
- 用perl作的ftp(轉)FTP
- NAT iptables防火牆(script)(轉)防火牆
- [TCP]轉TCP相關知識TCP
- 玩轉TCPTCP
- Shell Script(bash)--用於自動備份的Shell Script(轉)
- (轉)索引掃描還是全表掃描(Index Scan Or Full Table Scan)索引Index
- 轉)索引掃描還是全表掃描(Index Scan Or Full Table Scan)索引Index
- 本地除錯PERL CGI程式(轉)除錯
- 測試mod_perl模組(轉)
- 比較perl模組的版本(轉)
- Shell Script(bash)--教學例(轉)
- Cultured Perl: 吸引 C 和 Java 程式設計師目光的 Perl 5.6 (轉)Java程式設計師
- INDEX UNIQUE SCAN,INDEX FULL SCAN和INDEX FAST FULL SCANIndexAST
- PERL物件程式設計基礎(轉)物件程式設計
- Script – List status of all submitted DBMS jobs(轉)MIT
- 用perl訪問mysql資料庫(轉)MySql資料庫
- mod_perl 程式設計介紹 (轉)程式設計
- Perl 作為命令列實用程式(轉)命令列
- PHP也可以當成Shell Script使用(轉)PHP
- 跳躍式索引(Skip Scan Index)淺析 - 轉索引Index
- Index Full Scan vs Index Fast Full ScanIndexAST
- Index Full Scan 與 Index Fast Full ScanIndexAST
- perl
- Script
- 請說說`<script>`、`<script async>`和`<script defer>`的區別
- index range scan,index fast full scan,index skip scan發生的條件IndexAST