diff --git a/api/fileupload.go b/api/fileupload.go index 5400ff18de91acbe3b371b50e9a475454d0cf8db..33e4b86cdeaf1e925c025b5718bd2c98becd78d1 100644 --- a/api/fileupload.go +++ b/api/fileupload.go @@ -17,6 +17,7 @@ import ( "github.com/gin-gonic/gin" ) +// Retrieves data of uploaded file func UploadFileRetrieve(c *gin.Context) { var fileData []byte @@ -77,6 +78,7 @@ func UploadFileRetrieve(c *gin.Context) { c.Data(http.StatusOK, "application/json", fileData) } +// Performs request to virustotal, returning a full report of analyzed file func uploadFileRetrieveCall(id string) (data []byte, err error) { var responseData utils.ResultFrontendResponse responseData, err = CallVirusTotal(id) @@ -94,6 +96,7 @@ func uploadFileRetrieveCall(id string) (data []byte, err error) { return fileData, nil } +// Uploads file to VirusTotal and returns an ID reference to the scan results in VirusTotal func UploadFile(c *gin.Context) { log.Println("Fileupload worked") logging.Loginfo("Fileupload worked") diff --git a/api/virustotal.go b/api/virustotal.go index 46dab32b50d7b47ab910eb9d215ef145514e2362..bfcc8af5df9e4bb05fc0e51ff7d0442e33612589 100644 --- a/api/virustotal.go +++ b/api/virustotal.go @@ -118,6 +118,7 @@ func CallVirusTotal(id string) (response utils.ResultFrontendResponse, err error return response, nil } +// Sorts frontend display information from AV engines, based on malicious sites first, and harmless last func sortDanger(values []utils.FrontendResponse2, dangerSize int, safeSize int) []utils.FrontendResponse2 { if dangerSize == 0 { return values