shone/scanner

此包已被放弃,不再维护。未建议替代包。

一个扫描器,用于确定您运行的流行开源软件版本是否存在漏洞。

安装: 13

依赖项: 0

建议者: 0

安全: 0

星级: 4

观察者: 1

分支: 1

类型:工具

v1.1.4 2014-08-28 09:00 UTC

This package is auto-updated.

Last update: 2021-09-18 12:40:16 UTC


README

Build Status SensioLabsInsight Coverage Status Latest Stable Version License

一个用于与Shone Web Scanner API交互的命令行工具。

入门

要进行扫描,您需要在https://www.shone.co.za/上创建一个免费账户

要获取API密钥,登录您的账户并转到API选项卡(https://www.shone.co.za/client/api

最简单的方法是直接下载phar文件并开始使用

$ wget raw.github.com/xsist10/shone-phar/master/shone.phar && chmod +x shone.phar

或者您可以使用composer

{
    "require": {
        "shone/scanner": "1.0.*@dev"
    }
}

要全局安装phar,请执行以下操作

$ mv shone.phar /usr/local/bin/shone

更新phar

如果您正在使用shone.phar文件,您可以通过运行以下命令将其更新到最新版本

$ ./shone.phar self-update

设置您的配置

有一些基本设置可以使工具更容易使用。建议在开始时设置您的API密钥(配置文件将存储在您的家目录~/shone.json或类似位置)。

# Set the API key so you don't need to declare it everywhere
$ ./shone.phar set-config --key "[API KEY]"

# This is not recommended
$ ./shone.phar set-config  --common-checksum=0 --no-cert-check=1

使用扫描器

本地文件系统

您可以通过以下方式扫描网页目录

$ ./shone.phar scan --key "[API KEY]" --label "Website Label" /path/to/web/folder

或者如果您更喜欢直接使用代码(请记住先运行composer update

$ ./bin/shone scan --key "[API KEY]" --label "Website Label" /path/to/web/folder

如果一切顺利,您应该会收到一个URL,用于找到您的扫描结果

检查本地文件

您可以通过运行指纹命令来找出文件所属的软件包

$ ./shone.phar fingerprint --key "[API KEY]" /path/to/file

预期结果

Result: 11 matches found
+----------+-----------+------------+
| Software | Version   | Status     |
+----------+-----------+------------+
| Joomla!  | 2.5.9     | Vulnerable |
| Joomla!  | 2.5.9     | Vulnerable |
| Joomla!  | 2.5.11    | Vulnerable |
| Joomla!  | 2.5.10    | Vulnerable |
| Joomla!  | 2.5.12    | Vulnerable |
| Joomla!  | 2.5.14    | Vulnerable |
| Joomla!  | 2.5.13    | Vulnerable |
| Joomla!  | 2.5.16    | Secure     |
| Joomla!  | 2.5.15    | Secure     |
| Joomla!  | 2.5.17.rc | Secure     |
| Joomla!  | 2.5.17    | Secure     |
+----------+-----------+------------+

远程文件系统

您可以通过FTP像这样扫描远程网页目录

$ ./shone.phar ftpscan --username [USERNAME] --password --key="[API KEY]" --label "Website Label" [FTP HOST] /path/to/web/folder

如果您运行,将列出一些额外的FTP选项

$ ./shone.phar ftpscan --help

获取结果

获取一个作业结果

当您向API提交作业时,您将获得一个直接链接到您的扫描结果的URL。您也可以使用哈希值通过API以这种方式检索结果

$ ./shone.phar job --hash="[HASH]"

预期结果

Found 2 results.

Path: /
+----------+---------+------------+-------+--------+
| Software | Version | Status     | Risk  | Match  |
+----------+---------+------------+-------+--------+
| Joomla!  | 2.5.10  | vulnerable | 10/10 | 97.00% |
| Joomla!  | 2.5.11  | vulnerable | 10/10 | 96.00% |
| Joomla!  | 2.5.12  | vulnerable | 10/10 | 94.00% |
| Joomla!  | 2.5.13  | vulnerable | 10/10 | 94.00% |
| Joomla!  | 2.5.14  | vulnerable | 7/10  | 94.00% |
+----------+---------+------------+-------+--------+

Path: media/editors/tinymce/jscripts/tiny_mce
+----------+---------+--------+------+--------+
| Software | Version | Status | Risk | Match  |
+----------+---------+--------+------+--------+
| tinymce  | 3.5.2   | secure | N/A  | 10.00% |
| tinymce  | 3.5.3   | secure | N/A  | 10.00% |
| tinymce  | 3.5.4   | secure | N/A  | 10.00% |
| tinymce  | 3.5.4.1 | secure | N/A  | 10.00% |
| tinymce  | 3.5.3.1 | secure | N/A  | 10.00% |
+----------+---------+--------+------+--------+

获取最近的工作

您可以调用此方法来获取月份的工作

$ ./shone.phar job --key="[API KEY]"

预期结果

Found 1 job(s).

+------------+----------------------------------+------------+----------+------------------------------------------------------+
| Date       | Job                              | Status     | Severity | Details                                              |
+------------+----------------------------------+------------+----------+------------------------------------------------------+
| 2014-04-13 | 14dd8544av1f6f2ea1d55319625f7744 | vulnerable | 10/10    | 2 bundle(s) found in 4444 file(s) on xxx.xxx.xxx.xxx |
+------------+----------------------------------+------------+----------+------------------------------------------------------+

您可以使用标签标志搜索特定标签的最新扫描

$ ./shone.phar job --key="[API KEY]" --label="Website Label"

编译phar

您可以通过调用以下命令重新编译phar

$ ./bin/compile && chmod +x shone.phar

然后您可以将phar复制到您希望使用的任何服务器或目录,并用作独立可执行文件。

更多信息

要获取更多信息,请运行

$ ./shone.phar

直接使用库

如果您希望编写自己的代码以使用Shone API,您可以像这样直接使用库

use Shone\Scanner\Scanner;
use League\Flysystem\Filesystem;
use League\Flysystem\Adapter\Local;

$scanner = new Scanner();

// Set your API key
$scanner->setKey([API KEY]);

// Enable SSL certificate checking
$scanner->setCertCheck(true);

// Set the label of the job you want to submit or search for
$scanner->setLabel("Website Label");

// You can build a list of files anyway you want like:
// $files = array('/path/to/file1', '/path/to/file2');
// I find the easiest way is like this:
$filesystem = new Filesystem(new Local("path/to/scan"));
$files = $scanner->buildFileList($filesystem);

// Build our packet to send to the API
$packet = $scanner->buildJobPacket($filesystem, $files);

// Send the packet to the framework
$result = $scanner->submitJob($packet);

if ($result['Status'] != 'Success') {
    // Something went wrong
    throw new \Exception($result['Detail']);
} else {
    $hash = $result['Hash'];
}

// Wait a little while and attempt to get the result (might take a few seconds to process)
$max_retry = 5;
$attempt = 1;
while ($attempt < $max_retry)
{
    sleep(2);
    $job = $scanner->getJob($hash);
    if (empty($job['status']) || $job['status'] != 'In progress')
    {
        break;
    }
    $attempt++;
}

// The job result:
print_r($job);

贡献

请参阅CONTRIBUTING以获取详细信息。

Bitdeli Badge