Skip to content

Latest commit

 

History

History
531 lines (332 loc) · 12.3 KB

USAGE-LARAVEL.md

File metadata and controls

531 lines (332 loc) · 12.3 KB

Laravel

You must not import a class. For Laravel, You can simply use the VirusTotal Facade.

Getting Starting

Add the VIRUS_TOTAL_API_KEY variable in your .env file with VirusTotal API key.

# ...
VIRUS_TOTAL_API_KEY=<YOUR-API_KEY>
# ...

Optional: Publish the config

php artisan vendor:publish --provider="NormanHuth\VirusTotal\Providers\ServiceProvider"

Usage

Examples

Scan A File

$upload = VirusTotal::scanFile('/path/to-file');
$analysisId = $upload['data']['id'];
$result = VirusTotal::analyseUrlOrFile($analysisId);

Scan A URL

$url = VirusTotal::scanURL('https://huth.it/coffee');
$analysisId = $url['data']['id'];
$result = VirusTotal::analyseUrlOrFile($analysisId);

Scan A Domain

$result = VirusTotal::scanDomain('huth.it');

return $result['data'];

Scan A Url

$result = VirusTotal::scanDomain('huth.it');

return $result['data'];

All Endpoints

IP addresses

Get an IP address report.

Reference: https://developers.virustotal.com/reference/ip-info

VirusTotal::getAnIPAddressReport(string $ip): array
Get comments on an IP address.

Reference: https://developers.virustotal.com/reference/ip-comments-get

VirusTotal::getCommentsOnAnIPAddress(string $ip, ?string $cursor, int $limit): array
Add a comment to an IP address.

Reference: https://developers.virustotal.com/reference/ip-comments-post

VirusTotal::addACommentToAnIPAddress(string $ip, string $text): array
Get objects related to an IP address.

Reference: https://developers.virustotal.com/reference/ip-relationships

VirusTotal::getObjectsRelatedToAnIPAddress(string $ip, string $relationship, ?string $cursor, int $limit): array
Get object descriptors related to an IP address.

Reference: https://developers.virustotal.com/reference/ip-relationships-ids

VirusTotal::getObjectDescriptorsRelatedToAnIPAddress(string $ip, string $relationship, ?string $cursor, int $limit): array
Get votes on an IP address.

Reference: https://developers.virustotal.com/reference/ip-votes

VirusTotal::getVotesOnAnIPAddress(string $ip): array
Add a vote to an IP address.

Reference: https://developers.virustotal.com/reference/ip-votes-post

VirusTotal::addAVoteToAnIPAddress(string $ip, string $verdict): array

Domains & Resolutions

Get a domain report.

Reference: https://developers.virustotal.com/reference/domain-info

VirusTotal::getADomainReport(string $domain): array
Get comments on a domain.

Reference: https://developers.virustotal.com/reference/domains-comments-get

VirusTotal::getCommentsOnADomain(string $domain, ?string $cursor, int $limit): array
Add a comment to a domain.

Reference: https://developers.virustotal.com/reference/domains-comments-post

VirusTotal::addACommentToADomain(string $domain, string $text): array
Get objects related to a domain.

Reference: https://developers.virustotal.com/reference/domains-relationships

VirusTotal::getObjectsRelatedToADomain(string $domain, string $relationship, ?string $cursor, int $limit): array
Get object descriptors related to a domain

Reference: https://developers.virustotal.com/reference/domains-relationships-ids

VirusTotal::getObjectDescriptorsRelatedToADomain(string $domain, string $relationship, ?string $cursor, int $limit): array
Get a DNS resolution object.

Reference: https://developers.virustotal.com/reference/get-resolution-by-id

VirusTotal::getADNSResolutionObject(string $id): array
Get votes on a domain.

Reference: https://developers.virustotal.com/reference/domains-votes-get

VirusTotal::getVotesOnADomain(string $domain): array
Add a vote to a domain.

Reference: https://developers.virustotal.com/reference/domain-votes-post

VirusTotal::addAVoteToADomain(string $domain, string $verdict): array

Files

Upload a file.

Reference: https://developers.virustotal.com/reference/files-scan

VirusTotal::uploadAFile(string $file, ?string $password): array
Get a URL for uploading large files.

Reference: https://developers.virustotal.com/reference/files-upload-url

VirusTotal::getAURLForUploadingLargeFiles(): array
Upload a large file.

Reference: https://developers.virustotal.com/reference/files-upload-url

VirusTotal::uploadALargeFile(string $url, string $file, ?string $password): array
Request a file rescan (re-analyze).

Reference: https://developers.virustotal.com/reference/files-analyse

VirusTotal::requestAFileRescan(string $id): array
Get a file’s download URL.

Reference: https://developers.virustotal.com/reference/files-download-url

VirusTotal::getAFilesDownloadURL(string $id): array
Download a file.

Reference: https://developers.virustotal.com/reference/files-download

VirusTotal::downloadAFile(string $id, string $target): \Psr\Http\Message\ResponseInterface
Get comments on a file.

Reference: https://developers.virustotal.com/reference/files-comments-get

VirusTotal::getCommentsOnAFile(string $id, ?string $cursor, int $limit): array
Add a comment to a file.

Reference: https://developers.virustotal.com/reference/ip-comments-post

VirusTotal::addACommentToAFile(string $id, string $text): array
Get objects related to a file.

Reference: https://developers.virustotal.com/reference/files-relationships

VirusTotal::getObjectsRelatedToAFile(string $id, string $relationship, ?string $cursor, int $limit): array
Get object descriptors related to a file.

Reference: https://developers.virustotal.com/reference/files-relationships-ids

VirusTotal::getObjectDescriptorsRelatedToAFile(string $id, string $relationship, ?string $cursor, int $limit): array
Get a crowdsourced Sigma rule object.

Reference: https://developers.virustotal.com/reference/get-sigma-rules

VirusTotal::getACrowdsourcedSigmaRuleObject(string $id): array
Get a crowdsourced YARA ruleset.

Reference: https://developers.virustotal.com/reference/get-yara-rulesets

VirusTotal::getACrowdsourcedYARARuleset(string $id): array
Get votes on a file.

Reference: https://developers.virustotal.com/reference/files-votes-get

VirusTotal::getVotesOnAFile(string $id): array
Add a vote on a file.

Reference: https://developers.virustotal.com/reference/files-votes-post

VirusTotal::addAVoteOnAFile(string $id, string $verdict): array

URLs

Scan URL.

Reference: https://developers.virustotal.com/reference/scan-url

VirusTotal::scanURL(string $url): array
Get a URL analysis report.

Reference: https://developers.virustotal.com/reference/url-info

VirusTotal::getAURLAnalysisReport(string $id): array
Request a URL rescan (re-analyze).

Reference: https://developers.virustotal.com/reference/urls-analyse

VirusTotal::requestAURLRescan(string $id): array
Get comments on a URL.

Reference: https://developers.virustotal.com/reference/urls-comments-get

VirusTotal::getCommentsOnAURL(string $id, ?string $cursor, int $limit): array
Add a comment on a URL.

Reference: https://developers.virustotal.com/reference/urls-comments-post

VirusTotal::addACommentOnAURL(string $ip, string $text): array
Get objects related to a URL.

Reference: https://developers.virustotal.com/reference/urls-relationships

VirusTotal::getObjectsRelatedToAURL(string $id, string $relationship, ?string $cursor, int $limit): array
Get object descriptors related to a URL.

Reference: https://developers.virustotal.com/reference/ip-relationships-ids

VirusTotal::getObjectDescriptorsRelatedToAURL(string $id, string $relationship, ?string $cursor, int $limit): array
Get votes on a URL.

Reference: https://developers.virustotal.com/reference/urls-votes-get

VirusTotal::getVotesOnAURL(string $id): array
Add a vote on a URL.

Reference: https://developers.virustotal.com/reference/urls-votes-post

VirusTotal::addAVoteOnAURL(string $id, string $verdict): array

Comments

Get latest comments.

Reference: https://developers.virustotal.com/reference/get-comments

VirusTotal::getLatestComments(?string $filter, ?string $cursor, int $limit): array
Get a comment object.

Reference: https://developers.virustotal.com/reference/get-comment

VirusTotal::getACommentObject(string $id, ?string $relationships): array
Update a comment.

Reference: https://developers.virustotal.com/reference/comment-id-patch

VirusTotal::updateAComment(string $id, mixed $data): array
Delete a comment.

Reference: https://developers.virustotal.com/reference/comment-id-delete

VirusTotal::deleteAComment(string $id): array
Get objects related to a comment.

Reference: https://developers.virustotal.com/reference/comments-relationships

VirusTotal::getObjectsRelatedToAComment(string $id, string $relationship): array
Get object descriptors related to a comment.

Reference: https://developers.virustotal.com/reference/comments-relationships-ids

VirusTotal::getObjectDescriptorsRelatedToAComment(string $id, string $relationship, ?string $cursor, int $limit): array
Add a vote to a comment.

Reference: https://developers.virustotal.com/reference/vote-comment

VirusTotal::addAVoteToAComment(string $id, mixed $data): array

Analyses, Submissions & Operations

Get a URL / file analysis.

Reference: https://developers.virustotal.com/reference/analysis

VirusTotal::getAURLOrFileAnalysis(string $id): array
Get objects related to an analysis.

Reference: https://developers.virustotal.com/reference/analysesidrelationship-1

VirusTotal::getObjectsRelatedToAnAnalysis(string $id, string $relationship): array
Get object descriptors related to an analysis.

Reference: https://developers.virustotal.com/reference/analysesidrelationshipsrelationship-1

VirusTotal::getObjectDescriptorsRelatedToAnAnalysis(string $id, string $relationship): array
Get a submission object.

Reference: https://developers.virustotal.com/reference/get-submission

VirusTotal::getASubmissionObject(string $id): array
Get an operation object.

Reference: https://developers.virustotal.com/reference/get-operations-id

VirusTotal::getAnOperationObject(string $id): array

Attack Tactics

Get an attack tactic object.

Reference: https://developers.virustotal.com/reference/attack_tacticsid

VirusTotal::getAnAttackTacticObject(string $id): array
Get objects related to an attack tactic.

Reference: https://developers.virustotal.com/reference/attack_tacticsidrelationship

VirusTotal::getObjectsRelatedToAnAttackTactic(string $id, string $relationship, ?string $cursor, int $limit): array
Get object descriptors related to an attack tactic.

Reference: https://developers.virustotal.com/reference/attack_tacticsidrelationshipsrelationship

VirusTotal::getObjectDescriptorsRelatedToAnAttackTactic(string $id, string $relationship, ?string $cursor, int $limit): array

Attack Techniques

Get an attack technique object.

Reference: https://developers.virustotal.com/reference/attack_techniqueid

VirusTotal::getAnAttackTechniqueObject(string $id): array
Get objects related to an attack technique.

Reference: https://developers.virustotal.com/reference/attack_techniqueidrelationship

VirusTotal::getObjectsRelatedToAnAttackTechnique(string $id, string $relationship, ?string $cursor, int $limit): array
Get object descriptors related to an attack technique.

Reference: https://developers.virustotal.com/reference/attack_techniquesidrelationshipsrelationship

VirusTotal::getObjectDescriptorsRelatedToAnAttackTechnique(string $id, string $relationship, ?string $cursor, int $limit): array

Popular Threat Categories

Get a list of popular threat categories.

Reference: https://developers.virustotal.com/reference/popular_threat_categories

VirusTotal::getAListOfPopularThreatCategories(): array