Skip to content
Snippets Groups Projects
Commit c2ddf9c6 authored by Odin K. Henriksen's avatar Odin K. Henriksen
Browse files

Escalation to manual analysis for file hashes

parent dfdeb476
No related branches found
No related tags found
1 merge request!2Merge react-branch into main.
......@@ -11,7 +11,7 @@ import (
gomail "gopkg.in/mail.v2"
)
func EscalateAnalysis(url string, result string, token string) {
func EscalateAnalysis(url string, result string, token string, hash string) {
email_pwd := os.Getenv("email_pwd")
......@@ -32,8 +32,13 @@ func EscalateAnalysis(url string, result string, token string) {
// Set E-Mail subject
m.SetHeader("Subject", "Analysis sucessfully escalated")
// Set E-Mail body. You can set plain text or html with text/html
email_body := fmt.Sprintf("Your email has been escalated to manual analysis\n Details:\n URL: %s\n RequestLink: %s\n Do not reply to this email\n\n Further contact will be made from this email address", url, result)
var email_body string
// Set E-Mail body. You can set plain text or html with text/html - The IF/Else checks if the email is an escalation of URL og File hash search
if hash == ""{
email_body = fmt.Sprintf("Your email has been escalated to manual analysis\n Details:\n URL: %s\n RequestLink: %s\n Do not reply to this email\n\n Further contact will be made from this email address", url, result)
}else{
email_body = fmt.Sprintf("Your email has been escalated to manual analysis\n Details:\n File hash: %s\n RequestLink: %s\n Do not reply to this email\n\n Further contact will be made from this email address", hash, result)
}
m.SetBody("text/plain", email_body)
......
......@@ -160,6 +160,7 @@ func main() {
token := c.Query("userAuth")
url := c.Query("url")
result := c.Query("result")
hash := c.Query("hash")
//api.EscalateAnalysis(url, result, token)
......@@ -167,7 +168,7 @@ func main() {
if !authenticated {
c.JSON(http.StatusUnauthorized, gin.H{"authenticated": "You are not authenticated. User login is invalid."})
} else {
api.EscalateAnalysis(url, result, token)
api.EscalateAnalysis(url, result, token, hash)
c.JSON(http.StatusOK, gin.H{"Successfull": "yes"})
}
......
......@@ -152,7 +152,7 @@ function Result() {
</> : renderResult}
</div>
<div className= "container w-full mb-3 sm:pl-36 sm:pr-36 flex justify-center overflow-hidden">
<button onClick={() => EscalateAnalysis(url, userAuth)} className="bg-orange-500 p-2 rounded justify-center">{t("manualAnalysisBtn")}</button>
<button onClick={() => EscalateAnalysis(url, userAuth, hash)} className="bg-orange-500 p-2 rounded justify-center">{t("manualAnalysisBtn")}</button>
</div>
<CookieDisclosure />
......@@ -161,9 +161,9 @@ function Result() {
);
}
function EscalateAnalysis(url, userAuth){
function EscalateAnalysis(url, userAuth, filehash){
fetch(process.env.REACT_APP_BACKEND_URL+'/escalate?url=' + url +"&result=" + window.location.href + "&userAuth=" + userAuth, {
fetch(process.env.REACT_APP_BACKEND_URL+'/escalate?url=' + url +"&result=" + window.location.href + "&userAuth=" + userAuth + "&hash=" + filehash, {
method: 'GET',
headers: {
Accept: 'application/json',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment