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
6460ffd7
Commit
6460ffd7
authored
3 years ago
by
Odin K. Henriksen
Browse files
Options
Downloads
Plain Diff
Merge branch 'main' of git.gvk.idi.ntnu.no:Johannesb/dcsg2900-threattotal into main
parents
4cbc2104
27b33f37
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 @
6460ffd7
...
@@ -17,6 +17,7 @@ import (
...
@@ -17,6 +17,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin"
)
)
// Retrieves data of uploaded file
func
UploadFileRetrieve
(
c
*
gin
.
Context
)
{
func
UploadFileRetrieve
(
c
*
gin
.
Context
)
{
var
fileData
[]
byte
var
fileData
[]
byte
...
@@ -77,6 +78,7 @@ func UploadFileRetrieve(c *gin.Context) {
...
@@ -77,6 +78,7 @@ func UploadFileRetrieve(c *gin.Context) {
c
.
Data
(
http
.
StatusOK
,
"application/json"
,
fileData
)
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
)
{
func
uploadFileRetrieveCall
(
id
string
)
(
data
[]
byte
,
err
error
)
{
var
responseData
utils
.
ResultFrontendResponse
var
responseData
utils
.
ResultFrontendResponse
responseData
,
err
=
CallVirusTotal
(
id
)
responseData
,
err
=
CallVirusTotal
(
id
)
...
@@ -94,6 +96,7 @@ func uploadFileRetrieveCall(id string) (data []byte, err error) {
...
@@ -94,6 +96,7 @@ func uploadFileRetrieveCall(id string) (data []byte, err error) {
return
fileData
,
nil
return
fileData
,
nil
}
}
// Uploads file to VirusTotal and returns an ID reference to the scan results in VirusTotal
func
UploadFile
(
c
*
gin
.
Context
)
{
func
UploadFile
(
c
*
gin
.
Context
)
{
log
.
Println
(
"Fileupload worked"
)
log
.
Println
(
"Fileupload worked"
)
logging
.
Loginfo
(
"Fileupload worked"
)
logging
.
Loginfo
(
"Fileupload worked"
)
...
...
This diff is collapsed.
Click to expand it.
api/virustotal.go
+
1
−
0
View file @
6460ffd7
...
@@ -118,6 +118,7 @@ func CallVirusTotal(id string) (response utils.ResultFrontendResponse, err error
...
@@ -118,6 +118,7 @@ func CallVirusTotal(id string) (response utils.ResultFrontendResponse, err error
return
response
,
nil
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
{
func
sortDanger
(
values
[]
utils
.
FrontendResponse2
,
dangerSize
int
,
safeSize
int
)
[]
utils
.
FrontendResponse2
{
if
dangerSize
==
0
{
if
dangerSize
==
0
{
return
values
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