Skip to content

VirusTotal/vt-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b198130 · Jul 8, 2024

History

72 Commits
Jul 12, 2019
May 8, 2023
May 15, 2018
May 15, 2018
Aug 18, 2021
Jul 8, 2024
Jan 16, 2023
Jan 28, 2020
Jul 17, 2023
Apr 15, 2021
May 8, 2023
Jul 12, 2019
May 28, 2021
May 26, 2024
Dec 9, 2021
Dec 9, 2019
Feb 20, 2019
May 28, 2021
Apr 2, 2024

Repository files navigation

GoDoc Go Report Card

vt-go

This is the official Go client library for VirusTotal. With this library you can interact with the VirusTotal REST API v3 without having to send plain HTTP requests with the standard "http" package.

Usage example

package main

import (
	"flag"
	"fmt"
	"log"
	"os"

	vt "github.com/VirusTotal/vt-go"
)

var apikey = flag.String("apikey", "", "VirusTotal API key")
var sha256 = flag.String("sha256", "", "SHA-256 of some file")

func main() {

	flag.Parse()

	if *apikey == "" || *sha256 == "" {
		fmt.Println("Must pass both the --apikey and --sha256 arguments.")
		os.Exit(0)
	}

	client := vt.NewClient(*apikey)

	file, err := client.GetObject(vt.URL("files/%s", *sha256))
	if err != nil {
		log.Fatal(err)
	}

	ls, err := file.GetTime("last_submission_date")
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("File %s was submitted for the last time on %v\n", file.ID(), ls)
}