ping 172.16.1.116Pinging host 172.16.1.116 : 172.16.1.116ping: No reply. Time Out !!ping: No reply. Time Out !!ping: No reply. Time Out !!ping: No reply. Time Out !!Host 172.16.1.116 replied to 0 of the 4 pingsready 12:26:32 |
telnet 172.16.1.116 1830Trying...Connected to 172.16.1.116.Escape character is '^]'. |
telnet 172.16.1.116 1830Trying...Connected to 172.16.1.116.Escape character is '^]'. telnet> quit |
On target system (Linux) [ndav@phx-lab-lnx64 ~]$ perl tcplisten.pl -p 1830 -m 'Connection has been accepted'perl tcplisten.pl -port 1830 -message 'Connection has been accepted' On OpenVOS client stp -ttp asciiready 12:16:34telnet 164.152.77.155 1830Trying...Connected to 164.152.77.155.Escape character is '^]'.Connection has been accepted Escape character is '^]'.Connection closed by forei.Ready 12:16:40 |
On OpenVOS target system perl tcplisten.pl -p 1830 -m 'made it to m16'perl tcplisten.pl -port 1830 -message 'made it to m16' On Linux client [ndav@phx-lab-lnx64 ~]$ telnet 164.152.77.128 1830Trying 164.152.77.128...Connected to rigel.az.stratus.com (164.152.77.128).Escape character is '^]'.made it to m16Connection closed by foreign host.[ndav@phx-lab-lnx64 ~]$ |
telnet 172.16.1.116 1830Trying...telnet: Unable to connect to remote host: The connection was refused.ready 12:31:28 |
telnet 172.16.1.116 1830Trying...telnet: Unable to connect to remote host: Network trying to be reached is unreac+hable.ready 12:54:34 |
telnet 172.16.1.116 1830Trying...telnet: Unable to connect to remote host: No route to host.ready 12:55:44 |
telnet 172.16.1.116 1830Trying...telnet: Unable to connect to remote host: The operation timed out. |
|
메시지
|
의미
|
|---|---|
|
연결됨 (배너 포함)
|
호스트 및 애플리케이션에 접근할 수 있음
|
|
연결됨 (배너 없음)
|
호스트와 애플리케이션에 도달할 수 있음 – 아마도
|
|
거절됨
|
호스트에는 연결 가능하지만 애플리케이션에는 연결 불가 – 아마도
|
|
연락 불가
|
호스트에 연결할 수 없습니다
|
|
타임아웃
|
호스트에 연결할 수 없음 – 아마도
|
perl tuc.pl -i 172.16.1.116 -p 1830Reply received on UDP socket from 164.152.77.128 message: echoed by udpecho.pl:+sent by tuc.pl at Mon Aug 30 13:31:34 2010ready 13:31:34 |
perl tuc.pl -i 172.16.1.116 -p 1830ICMP Destination port unreachable message received from 172.16.1.116ready 11:40:12 |
perl tuc.pl -i 172.16.1.116 -p 1830ICMP Destination network unreachable message received from 164.152.77.171ready 11:43:50 perl tuc.pl -i 172.16.1.116 -p 1830ICMP Destination host unreachable message received from 164.152.77.171ready 11:44:54 |
perl tuc.pl -i 172.16.1.116 -p 1830ICMP Time exceeded , TTL expired in transit message received from 164.152.77.34ready 11:45:39 |
perl tuc.pl -i 172.16.1.116 -p 1830No response was received from 172.16.1.116ready 16:43:26 |
perl tuc.pl -i 172.16.1.117 -p 1830 -t 10No response was received from 172.16.1.117ready 12:06:26 perl tuc.pl -i 172.16.1.117 -p 1830 -t 1 No response was received from 172.16.1.117ready 12:06:32 |
|
메시지
|
의미
|
|---|---|
|
애플리케이션 배너 메시지
|
호스트 및 애플리케이션에 접근할 수 있음
|
|
ICMP 네트워크/호스트 메시지
|
호스트에 연결할 수 없습니다
|
|
호스트로부터의 ICMP 포트 메시지
|
호스트에는 연결할 수 있으나 애플리케이션에는 연결할 수 없음
|
|
응답 없음, 애플리케이션이 배너 메시지를 전송합니다
|
호스트에 연결할 수 없습니다
|
|
응답 없음, 애플리케이션이 배너 메시지를 전송하지 않음
|
호스트에 연결할 수 있을 수도 있고 없을 수도 있습니다
|
tcplisten.pl
# tcplisten.pl begins here
# # 버전 1.00 10-07-30 # 이 스크립트는 다음 환경에서 테스트되었습니다. # Open VOS 17.0.2ah 실행 중, i686-vos용으로 빌드된 Perl v5.8.0 # Microsoft Windows XP 서비스 팩 3 실행 중 # ActiveState Perl v5.10.0, MSWin32-x86-멀티스레드용으로 빌드됨 # Red Hat Linux 4AS-5.5 실행 중 # x86_64-linux-thread-multi용으로 빌드된 Perl v5.8.5 # # use IO::Socket; use Getopt::Long; use Sys::Hostname; use strict; my ($result); my ($localPort, $message, $peerAddr); my ($newSock, $data); $result = GetOptions('port=s' => $localPort, 'message=s' => $message); if (($result != 1) || !(defined($localPort))) { print "nn사용법:n"; print "tperl tcplisten.pl -port 포트번호 [-message 메시지]"; 종료; } define($message)가 정의되지 않은 경우 { print "메시지가 지정되지 않았습니다 – 메시지를 생성 중입니다"; $message = "tcplisten이 실행 중인 " . hostname . "에서 연결이 수락되었습니다."; } print "perl tcplisten.pl -port $localPort -message '" . $message . "'n"; my $sock = IO::Socket::INET->new( Proto => ‘tcp’, LocalPort => $localPort, LocalAddr => '0.0.0.0', 듣기 => 1, ) 또는 종료됨 “포트 $localPort에 대한 소켓을 생성할 수 없음: $!n”; while (1) { my $newSock = $sock->accept(); print “연결 요청 수락됨: ” . $newSock->peerhost . " at " . localtime() . "n"; print $newSock $message . "\n"; $newSock -> shutdown(2); $sock->read($data, 1024); # 닫힘 신호 수신 대기 */ $newSock->close(); } # # tcplisten.pl은 여기서 끝납니다 |
tuc.pl
# tuc.pl begins here
# # 버전 1.00 10-07-30 # 이 스크립트는 다음 환경에서 테스트되었습니다. # Open VOS 17.0.2ah 실행 중, i686-vos용으로 빌드된 Perl v5.8.0 # Microsoft Windows XP 서비스 팩 3 실행 중 # ActiveState Perl v5.10.0, MSWin32-x86-멀티스레드용으로 빌드됨 # Red Hat Linux 4AS-5.5 실행 중 # x86_64-linux-thread-multi용으로 빌드된 Perl v5.8.5 # # use IO::Socket; use IO::Select; use Getopt::Long; use strict; my ($result); my ($목적지IP, $목적지포트, $타임아웃, $결과, $메시지, $플래그); my ($ready, $socket); my ($x, $c, $icmpAlready); $result = GetOptions('ip=s' => $destIP, ‘port=s’ => $destPort, ‘timeout=s’ => $timeout); if (($result != 1) || !(defined($destIP) && defined($destPort))) { print "nn사용법:n"; "tperl tuc.pl -ip 대상 IP 주소" 출력. “-포트 대상-포트-번호nn”; 종료; } if (!defined($timeout)) { $timeout = 5; } elsif ($timeout > 15) { print "OK, 하지만 " . $timeout . "불합리하게 길어 보인다."; } $message = "tuc.pl에 의해 전송됨: " . localtime(); my $sock = IO::Socket::INET->new( Proto => ‘udp’, PeerPort => $destPort, PeerAddr => $destIP ) 또는 종료됨 “대상 $destIP에 대한 소켓을 생성할 수 없음: $!n”; my $isock = IO::Socket::INET->new( Proto => 'icmp'); $sock->send($message) or die "전송 오류: $!n"; $message = ""; my $read_set = new IO::Select(); $read_set->add($sock); $read_set->add($isock); ($ready) = IO::Select->select($read_set, undef, undef, $timeout); $icmpAlready = 0; $c = 0; foreach $socket (@$ready) { $c = $c + 1; if ($socket == $sock) { $x = "UDP 소켓에서 수신된 응답: "; $socket->recv($message, 100, $flags); if ($icmpAlready == 0) { if (length($message) > 0) { print $x . $socket->peerhost . ” message: ” . $message . “n”; } else { print $x . $socket->peerhost . “n”; } } } else # icmp 메시지 수신 { $icmpAlready = 1; $socket->recv($message, 100, $flags); if (length($message) > 98) { print "예상보다 긴 (" . length($message) . “) ICMP 메시지 발신자 ” . $socket->peerhost . "message: " . $message . "\n"; } elsif (length ($message) < 52) { print "예상보다 짧음(" . length($message) . “) ” . $socket->peerhost . “에서 보낸 ICMP 메시지입니다.”; } else # ICMP 메시지 처리 { my $type = ord (substr ($message, 20, 1)); my $code = ord (substr ($message, 21, 1)); my $port = ord (substr ($message, 50, 1)) * 256 + ord(substr($message, 51, 1)); $port가 $destPort와 다를 경우 { print "예상치 못한 ICMP 메시지를 다음 주소로부터 수신했습니다: " . $socket->peerhost . " 메시지 : " . substr($message, 20) . “n”; } else # icmp 메시지는 정상입니다 { if ($type == 3) { if ($code == 0) { print "ICMP 목적지 네트워크 " . "접속 불가한 메시지를 수신했습니다." $socket->peerhost . "n"; } elsif ($code == 1) { print “ICMP 대상 호스트 ” . "접속 불가한 메시지를 수신했습니다." $socket->peerhost . "n"; } elsif ($code == 3) { print "ICMP 대상 포트 " . "접속 불가한 메시지를 수신했습니다." $socket->peerhost . "n"; } elsif ($code == 6) { print "ICMP 목적지 네트워크 " . "알 수 없는 발신자로부터 메시지를 수신했습니다." $socket->peerhost . "n"; } elsif ($code == 7) { print "ICMP 대상 호스트 알 수 없음 " . “” . $socket->peerhost . “” . “에서 메시지 수신됨”; } elsif ($code == 8) { print “ICMP 소스 호스트 격리됨 ” . "에서 수신된 메시지" $socket->peerhost . "n"; } elsif ($code == 9) { print “ICMP 네트워크 관리상 ” . "에서 금지된 메시지를 수신했습니다." $socket->peerhost . "n"; } elsif ($code == 10) { print “ICMP 호스트 관리상 ” . "에서 금지된 메시지를 수신했습니다." $socket->peerhost . "n"; } elsif ($code == 11) { print “ICMP 네트워크에 도달할 수 없음: ” . "TOS 메시지 수신됨" $socket->peerhost . "n"; } elsif ($code == 12) { print “ICMP 호스트에 연결할 수 없음: ” . "TOS 메시지 수신됨" $socket->peerhost . "n"; } elsif ($code == 13) { print “ICMP 통신 ” . "행정적으로 금지된 메시지를 수신했습니다." $socket->peerhost . "n"; } else { print "예상치 못한 ICMP 메시지 수신 유형 = " . $type . “, 코드 = ” . $code . ” 출처 ” . $socket->peerhost . "n"; } } # if ($type == 3) elsif (($type == 11) & ($code == 0)) { print "ICMP 시간 초과, 전송 중 TTL 만료" . “” . $socket->peerhost . “” . “에서 메시지 수신됨”; } else { print "예상치 못한 ICMP 메시지 수신 유형 = " . $type . “, 코드 = ” . $code . ” 출처 ” . $socket->peerhost . "n"; } } # 그렇지 않으면 # icmp 메시지가 정상입니다 } # else # icmp 메시지 처리 } # else #icmp 메시지 수신 foreach $socket (@$ready) if ($c == 0) { print “응답을 받지 못했습니다: ” . $sock->peerhost . "n"; } # # tuc.pl 여기서 끝 |
udpecho.pl
# udpecho.pl begins here
# # 버전 1.00 10-07-30 # 이 스크립트는 다음 환경에서 테스트되었습니다. # Open VOS 17.0.2ah 실행 중, i686-vos용으로 빌드된 Perl v5.8.0 # Microsoft Windows XP 서비스 팩 3 실행 중 # ActiveState Perl v5.10.0, MSWin32-x86-멀티스레드용으로 빌드됨 # Red Hat Linux 4AS-5.5 실행 중 # x86_64-linux-thread-multi용으로 빌드된 Perl v5.8.5 # # use IO::Socket; use IO::Select; use Getopt::Long; use strict; my ($result); my ($localPort, $debug, $result, $message, $flags); my ($ready, $socket); my ($x, $c); $result = GetOptions('port=s' => $localPort, ‘debug’ => $debug); if (($result != 1) || !(defined($localPort))) { print "nn사용법:n"; print "tperl udpecho.pl -port 로컬 포트 번호 [-debug]nn"; 종료; } if (defined($debug)) { print “local port number is ” . $localPort . “n”; } my $sock = IO::Socket::INET->new( Proto => ‘udp’, LocalPort => $localPort ) 또는 종료 “소켓 $!n을 생성할 수 없습니다”; my $read_set = new IO::Select(); $read_set->add($sock); $message = ""; while (1) { ($ready) = IO::Select->select($read_set, undef, undef, 300); foreach $socket (@$ready) { $socket->recv($message, 100, $flags); if (defined ($debug)) { print "Message from " . $socket->peerhost . "message: " . $message . "\n"; } $socket->send("udpecho.pl에 의해 에코됨: " . $message) or die("전송 오류: $!") +n”; } } # # udpecho.pl 여기서 끝 |
