moay/virus-total-api
Composer 安装命令:
composer require moay/virus-total-api
包简介
Very simple VirusTotal api wrapper for Laravel 5
README 文档
README
Very simple VirusTotal API wrapper for Laravel 5. This package wraps the VirusTotal API in to very simple methods in order to allow you to very easily perform a virus scan or malware scan on URLs or files. Please be aware, that there are some limits to the public API. See their docs: https://www.virustotal.com/documentation/public-api/
Installation
Installation is super simple. Use Composer to require this package:
"require": { "moay/virus-total-api": "dev-master" }
After having pulled the repo via composer update, you will have to add this to your Laravel providers in app/config/app.php (within the providers array):
'moay\VirusTotalApi\VirusTotalApiServiceProvider',
In order to access the API, you need a VirusTotal API key. Get one at their website and publish the package settings:
php artisan vendor:publish
This will publish a file named virus-total-api to your app/config directory. Insert your API key there to make it work.
Usage
Usage is super simple. Let's imagine a simple controller:
<?php namespace app\Http\Controllers; // Include the alias, else it won't work use VirusTotal; class Simplecontroller extends Controller { public function example() { // Let's scan google for malware $googleResults = VirusTotal::scanUrl('http://google.de'); // Let's scan a file for malware $fileResults = VirusTotal::scanFile('/my/absolute/filename.txt'); //Let's scan a file for malware via its URL $remoteFileResults = VirusTotal::scanFileViaUrl('http://somecooldomain.com/filename.txt'); } }
This is it, there are no more methods to learn. Please be aware of the access rate limits of the API. Read more about the returned stuff over at https://www.virustotal.com/documentation/public-api/
The wrapper will add a success variable to the returned array to indicate whether or not the API request was successful. If you did exceed your API quota for the current minute or you did not provide a valid API, it will be set to false.
Using the results
A quick example to handle the returned stuff.
<?php namespace app\Http\Controllers; use VirusTotal; class Simplecontroller extends Controller { public function anotherExample() { // Let's scan google for malware $googleResults = VirusTotal::scanUrl('http://google.de'); if($googleResults['success']) { // Let's check if there was a virus detected if($googleResults['positives']>0) { // There was a virus - do something about it! } } elseif($googleResults['error'] == 'rate limit exceeded') { // Reschedule the scan ... } } }
moay/virus-total-api 适用场景与选型建议
moay/virus-total-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.92k 次下载、GitHub Stars 达 10, 最近一次更新时间为 2015 年 03 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 moay/virus-total-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 moay/virus-total-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 3.92k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-24