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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Johannes Barstad
DCSG2900-ThreatTotal
Commits
c8d6fce0
Commit
c8d6fce0
authored
3 years ago
by
Jonas Kjærandsen
Browse files
Options
Downloads
Patches
Plain Diff
Removed empty values from virusTotal file response
parent
a5093c9a
No related branches found
No related tags found
1 merge request
!2
Merge react-branch into main.
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
api/virustotal.go
+29
-25
29 additions, 25 deletions
api/virustotal.go
with
29 additions
and
25 deletions
api/virustotal.go
+
29
−
25
View file @
c8d6fce0
...
...
@@ -58,8 +58,6 @@ func CallVirusTotal(id string) (response utils.ResultFrontendResponse, err error
logging
.
Logerror
(
unmarshalledBody
,
""
)
}
var
test3
=
make
([]
utils
.
FrontendResponse4
,
len
(
vtResponse
.
Data
.
Attributes
.
LastAnalysisResults
))
log
.
Println
(
"here is the test output we maybe want"
)
i
:=
0
...
...
@@ -70,15 +68,18 @@ func CallVirusTotal(id string) (response utils.ResultFrontendResponse, err error
for
_
,
val
:=
range
vtResponse
.
Data
.
Attributes
.
LastAnalysisResults
{
//log.Printf("testing, %s, %s", key, val)
// initialize struct
test3
[
i
]
=
val
// print
log
.
Println
(
test3
[
i
]
)
log
.
Println
(
val
)
if
val
.
Category
==
"undetected"
||
val
.
Category
==
"malicious"
||
val
.
Category
==
"malicious"
||
val
.
Category
==
"malicious"
{
// save engine name
testStruct
[
i
]
.
ID
=
i
+
1
testStruct
[
i
]
.
SourceName
=
test3
[
i
]
.
EngineName
testStruct
[
i
]
.
SourceName
=
val
.
EngineName
// resolution of AV
testStruct
[
i
]
.
EN
.
Status
=
test3
[
i
]
.
Category
testStruct
[
i
]
.
EN
.
Status
=
val
.
Category
testStruct
[
i
]
.
EN
.
Content
=
vtResponse
.
Data
.
Attributes
.
MeaningfulName
testStruct
[
i
]
.
EN
.
Description
=
vtResponse
.
Data
.
Attributes
.
Magic
...
...
@@ -92,9 +93,12 @@ func CallVirusTotal(id string) (response utils.ResultFrontendResponse, err error
i
++
}
}
log
.
Println
(
testStruct
)
var
testStruct2
=
make
([]
utils
.
FrontendResponse2
,
i
)
testStruct2
=
testStruct
[
0
:
(
i
-
1
)]
response
.
FrontendResponse
=
testStruct
response
.
FrontendResponse
=
testStruct
2
// IMPORTANT TODO, FIGURE ROUTING
// Possible to add more cases in the future, for more accurate assessements
...
...
@@ -114,9 +118,9 @@ func CallVirusTotal(id string) (response utils.ResultFrontendResponse, err error
response
.
NO
.
Result
=
"Filen er mistenkelig. Det anbefales å ikke videre håndtere filen. "
}
var
engines
int
=
len
(
vtResponse
.
Data
.
Attributes
.
LastAnalysisResults
)
//
var engines int = len(vtResponse.Data.Attributes.LastAnalysisResults)
utils
.
SetResultFile
(
&
response
,
engines
)
utils
.
SetResultFile
(
&
response
,
i
-
1
)
log
.
Println
(
response
)
...
...
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