Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DCSG2900-ThreatTotal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Johannes Barstad
DCSG2900-ThreatTotal
Commits
d2434faa
Commit
d2434faa
authored
3 years ago
by
Johannes Barstad
Browse files
Options
Downloads
Patches
Plain Diff
more commenting, sufficient
parent
1c443370
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/fileupload.go
+3
-0
3 additions, 0 deletions
api/fileupload.go
api/virustotal.go
+1
-0
1 addition, 0 deletions
api/virustotal.go
with
4 additions
and
0 deletions
api/fileupload.go
+
3
−
0
View file @
d2434faa
...
...
@@ -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"
)
...
...
This diff is collapsed.
Click to expand it.
api/virustotal.go
+
1
−
0
View file @
d2434faa
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment