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
638af34c
Commit
638af34c
authored
3 years ago
by
Odin K. Henriksen
Browse files
Options
Downloads
Patches
Plain Diff
Bugfixes Hash analysis
parent
bf28be98
No related branches found
No related tags found
1 merge request
!2
Merge react-branch into main.
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
api/hash-intelligence.go
+3
-2
3 additions, 2 deletions
api/hash-intelligence.go
api/hybridanalysis.go
+1
-2
1 addition, 2 deletions
api/hybridanalysis.go
utils/struct.go
+1
-1
1 addition, 1 deletion
utils/struct.go
utils/validation.go
+12
-6
12 additions, 6 deletions
utils/validation.go
with
17 additions
and
11 deletions
api/hash-intelligence.go
+
3
−
2
View file @
638af34c
...
...
@@ -6,6 +6,7 @@ import (
"encoding/json"
"fmt"
"net/http"
"strings"
"sync"
"github.com/gin-gonic/gin"
...
...
@@ -16,7 +17,7 @@ func HashIntelligence(c *gin.Context) {
var
hashInt
[]
byte
var
err
error
hash
:=
c
.
Query
(
"hash"
)
hash
:=
strings
.
TrimSpace
(
c
.
Query
(
"hash"
)
)
value
,
err
:=
utils
.
Conn
.
Do
(
"GET"
,
"hash:"
+
hash
)
if
value
==
nil
{
...
...
This diff is collapsed.
Click to expand it.
api/hybridanalysis.go
+
1
−
2
View file @
638af34c
package
api
import
(
logging
"dcsg2900-threattotal/logs"
"dcsg2900-threattotal/utils"
"dcsg2900-threattotal/logs"
"encoding/json"
"fmt"
"io/ioutil"
...
...
@@ -59,7 +59,6 @@ func CallHybridAnalysisHash(hash string, response *utils.FrontendResponse2, wg *
err
=
json
.
Unmarshal
(
body
,
&
jsonResponse
)
if
err
!=
nil
{
fmt
.
Println
(
string
(
body
))
fmt
.
Println
(
err
)
if
len
(
string
(
body
))
==
2
{
//If this statement is true it means that the request
//is sucessful but it cant be unmarshalled because it returns empty
...
...
This diff is collapsed.
Click to expand it.
utils/struct.go
+
1
−
1
View file @
638af34c
...
...
@@ -82,7 +82,7 @@ type GoogleSafeBrowsing struct {
}
`json:"matches"`
}
type
HybridAnalysishash
struct
{
type
HybridAnalysishash
[]
struct
{
JobID
string
`json:"job_id"`
EnvironmentID
int
`json:"environment_id"`
EnvironmentDescription
string
`json:"environment_description"`
...
...
This diff is collapsed.
Click to expand it.
utils/validation.go
+
12
−
6
View file @
638af34c
...
...
@@ -165,20 +165,26 @@ func SetResponseObjectAlienVaultHash(jsonResponse AlienVaultHash, response *Fron
func
SetResponseObjectHybridAnalysisHash
(
jsonResponse
HybridAnalysishash
,
response
*
FrontendResponse2
)
{
response
.
SourceName
=
"Hybrid Analysis"
if
jsonResponse
.
Verdict
==
"malicious"
{
if
jsonResponse
[
0
]
.
Verdict
==
"malicious"
{
response
.
EN
.
Status
=
"Risk"
response
.
EN
.
Content
=
"This file is malicious"
response
.
NO
.
Status
=
"Utrygg"
response
.
EN
.
Content
=
"Denne filen er gjenkjent som ondsinnet"
//response.SourceName = jsonResponse.Submissions[0].Filename
}
else
if
jsonResponse
.
Verdict
==
"whitelisted"
{
}
else
if
jsonResponse
[
0
]
.
Verdict
==
"whitelisted"
{
response
.
EN
.
Status
=
"Safe"
response
.
EN
.
Content
=
"This file is known to be good"
response
.
NO
.
Status
=
"Trygg"
response
.
EN
.
Content
=
"Denne filen er hvitelistet av HybridAnalysis - Ikke ondsinnet."
//response.SourceName = jsonResponse.Submissions[0].Filename
}
else
if
jsonResponse
[
0
]
.
Verdict
==
"no specific threat"
{
response
.
EN
.
Status
=
"Safe"
response
.
EN
.
Content
=
"According to HybridAnalysis does this file not pose any specific threat."
response
.
NO
.
Status
=
"Trygg"
response
.
EN
.
Content
=
"I henhold til informasjon gitt av HybridAnalysis tilsier ikke denne filen noen trussel."
}
else
{
response
.
EN
.
Status
=
"Unknown"
//Denne må byttes til at den er ukjent // grå farge elns på frontend.
response
.
EN
.
Content
=
"This filehash is not known to Hybrid Analysis"
...
...
@@ -188,10 +194,10 @@ func SetResponseObjectHybridAnalysisHash(jsonResponse HybridAnalysishash, respon
}
// Set the filename field if known
if
jsonResponse
.
Submissions
!=
nil
{
if
jsonResponse
.
Submissions
[
0
]
.
Filename
!=
""
{
response
.
EN
.
Content
=
response
.
EN
.
Content
+
" "
+
jsonResponse
.
Submissions
[
0
]
.
Filename
response
.
NO
.
Content
=
response
.
NO
.
Content
+
" "
+
jsonResponse
.
Submissions
[
0
]
.
Filename
if
jsonResponse
[
0
]
.
Submissions
!=
nil
{
if
jsonResponse
[
0
]
.
Submissions
[
0
]
.
Filename
!=
""
{
response
.
EN
.
Content
=
response
.
EN
.
Content
+
" "
+
jsonResponse
[
0
]
.
Submissions
[
0
]
.
Filename
response
.
NO
.
Content
=
response
.
NO
.
Content
+
" "
+
jsonResponse
[
0
]
.
Submissions
[
0
]
.
Filename
}
}
}
...
...
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