vendor/sensiolabs/security-checker/SensioLabs/Security/Crawler/FileGetContentsCrawler.php
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
/*
* This file is part of the SensioLabs Security Checker.
*
* (c) Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace SensioLabs\Security\Crawler;
use Composer\CaBundle\CaBundle;
use SensioLabs\Security\Exception\HttpException;
use SensioLabs\Security\Exception\RuntimeException;
use SensioLabs\Security\SecurityChecker;
/**
* @internal
*/
class FileGetContentsCrawler extends BaseCrawler
{
/**
* {@inheritdoc}
*/
protected function doCheck($lock, $certFile)
{
$boundary = '------------------------'.md5(microtime(true));
$opts = array(
'http' => array(
'method' => 'POST',
'header' => "Content-Type: multipart/form-data; boundary=$boundary\r\nAccept: application/json",
'content' => "--$boundary\r\nContent-Disposition: form-data; name=\"lock\"; filename=\"$lock\"\r\nContent-Type: application/octet-stream\r\n\r\n".$this->getLockContents($lock)."\r\n--$boundary--\r\n",
'ignore_errors' => true,
'follow_location' => true,
'max_redirects' => 3,
'timeout' => $this->timeout,
'user_agent' => sprintf('SecurityChecker-CLI/%s FGC PHP', SecurityChecker::VERSION),
),
'ssl' => array(
'verify_peer' => 1,
'verify_host' => 2,
),
);
$caPathOrFile = CaBundle::getSystemCaRootBundlePath();
if (is_dir($caPathOrFile) || (is_link($caPathOrFile) && is_dir(readlink($caPathOrFile)))) {
$opts['ssl']['capath'] = $caPathOrFile;
} else {
$opts['ssl']['cafile'] = $caPathOrFile;
}
$context = stream_context_create($opts);
$level = error_reporting(0);
$body = file_get_contents($this->endPoint, 0, $context);
error_reporting($level);
if (false === $body) {
$error = error_get_last();
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。