-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Playbook: Email Address Enrichment - Generic #1173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- GetStringDistance - EmailDomainSquattingReputation
…m/demisto/content into playbook-email-address-enrichment
@JonathanMeler |
Test demo run: https://demo2.demisto.com/#/WorkPlan/37812 |
var domains = argToList(args.domain); | ||
var threshold = parseInt(args.threshold); | ||
|
||
var emailParts = email.split('@',2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use python convention. emailParts => email_parts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change in all scripts
if (emailParts.length < 2){ | ||
return { ContentsFormat: formats.text, Type: entryTypes.error, Contents: email.toString() + " - is not a valid email address" }; | ||
} | ||
var emailObj = {Username: emailParts[0], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent and format json objects properly
var emailParts = email.split('@',2); | ||
|
||
if (emailParts.length < 2){ | ||
return { ContentsFormat: formats.text, Type: entryTypes.error, Contents: email.toString() + " - is not a valid email address" }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent and format json objects properly
|
||
if(suspicious && suspicious.length > 0){ | ||
//add dbot score, suspicious | ||
ec.DBotScore = {Indicator: email, Type: 'email', Vendor: 'DomainSquatting', Score: 2}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format json
}; | ||
|
||
domains.forEach(function(domain){ | ||
var resp = executeCommand("GetStringsDistance", {inputString: emailObj.Domain, compareString: domain}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format and indent object
'ReadableContentsFormat' : formats['markdown']}) | ||
|
||
else: | ||
res.append({'Type': entryTypes['error'], 'ContentsFormat': formats['text'], 'Contents': 'Unable to extract inputString - ' + inputString}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format
'LevenshteinDistance' : levenshteinDistance, | ||
'TooClose' : levenshteinDistance > 0 and levenshteinDistance < closeDistanceInt | ||
}) | ||
res.append({'Type' : entryTypes['note'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format
distances = [] | ||
for curString in compareString: | ||
levenshteinDistance = levenshtein(curString, inputString) | ||
distances.append({'StringA' : inputString, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format
} | ||
} | ||
demisto.results({ "Type" : entryTypes["note"], | ||
"ContentsFormat" : formats["json"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format
@@ -0,0 +1,214 @@ | |||
id: test_-_email_address_enrichment_-_generic | |||
name: Test - Email Address Enrichment - Generic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change the name to be Email Address Enrichment - Generic - Test
…book-Email Address Enrichment - Generic - Test
fixes https://github.com/demisto/etc/issues/10313