-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from vincenzocaputo/develop
Develop
- Loading branch information
Showing
52 changed files
with
535 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,86 @@ | ||
|
||
let indicator = ""; | ||
// Send a message to background script in order to retrieve the indicator saved in the local storage | ||
browser.runtime.sendMessage({ | ||
id: 1, | ||
msg: "" | ||
}).then((resp)=>{ | ||
indicator = resp.msg; | ||
// Get the query to find submit button | ||
query = resp.query; | ||
if(query) { | ||
// Check if auto-submit is enabled | ||
submit = resp.submit; | ||
window.addEventListener("load", function() { | ||
browser.runtime.sendMessage({ | ||
id: 1, | ||
msg: "" | ||
}).then((resp)=>{ | ||
indicator = resp.msg; | ||
// Get the query to find submit button | ||
query = resp.query; | ||
if(query) { | ||
// Check if auto-submit is enabled | ||
submit = resp.submit; | ||
|
||
let current_url = window.location.href; | ||
if(current_url.includes("urlscan")) { | ||
// Get input field | ||
inputNode = document.getElementById("url"); | ||
document.getElementById(query).click(); | ||
inputNode.value = indicator; | ||
setTimeout(() => { | ||
document.getElementById("submitbtn_text").click(); | ||
}, 1000); | ||
} else if(current_url.includes("virustotal")) { | ||
window.addEventListener('load', function () { | ||
// Get input field | ||
inputNode = document.querySelector('home-view').shadowRoot.querySelector('#urlSearchInput'); | ||
inputNode.value = indicator; | ||
setTimeout(() => { | ||
// "touch" the input field | ||
inputNode.dispatchEvent(new Event('input')); | ||
}, 100); | ||
setTimeout(() => { | ||
// Fill | ||
if(submit === "true" && query === "VT") { | ||
// after 100ms press "enter" | ||
document.querySelector('home-view').shadowRoot.querySelector('#searchUrlForm').dispatchEvent(new Event("submit")); | ||
} | ||
}, 100); | ||
}) | ||
} else if(current_url.includes("centralops")) { | ||
// Fill the input field | ||
document.getElementById("addr").value = indicator; | ||
|
||
// Select checkboxes | ||
document.getElementById("dom_whois").checked = true; | ||
document.getElementById("net_whois").checked = true; | ||
document.getElementById("dom_dns").checked = true; | ||
let current_url = window.location.href; | ||
if(current_url.includes("urlscan")) { | ||
// Get input field | ||
inputNode = document.getElementById("url"); | ||
document.getElementById(query).click(); | ||
inputNode.value = indicator; | ||
setTimeout(() => { | ||
document.getElementById("submitbtn_text").click(); | ||
}, 1000); | ||
} else if(current_url.includes("virustotal")) { | ||
window.addEventListener('load', function () { | ||
// Get input field | ||
inputNode = document.querySelector('home-view').shadowRoot.querySelector('#urlSearchInput'); | ||
inputNode.value = indicator; | ||
setTimeout(() => { | ||
// "touch" the input field | ||
inputNode.dispatchEvent(new Event('input')); | ||
}, 100); | ||
setTimeout(() => { | ||
// Fill | ||
if(submit === "true" && query === "VT") { | ||
// after 100ms press "enter" | ||
document.querySelector('home-view').shadowRoot.querySelector('#searchUrlForm').dispatchEvent(new Event("submit")); | ||
} | ||
}, 100); | ||
}) | ||
} else if(current_url.includes("centralops")) { | ||
// Fill the input field | ||
document.getElementById("addr").value = indicator; | ||
|
||
if(submit === "true") { | ||
document.querySelector(query).click(); | ||
} | ||
// Select checkboxes | ||
document.getElementById("dom_whois").checked = true; | ||
document.getElementById("net_whois").checked = true; | ||
document.getElementById("dom_dns").checked = true; | ||
|
||
} else if(current_url.includes("eurodns")) { | ||
let inputNode = document.getElementsByTagName("textarea")[0]; | ||
if(submit === "true") { | ||
document.querySelector(query).click(); | ||
} | ||
|
||
inputNode.value = indicator; | ||
if(submit === "true") { | ||
document.querySelector(query).click(); | ||
} | ||
} else if(current_url.includes("eurodns")) { | ||
let inputNode = document.getElementsByTagName("textarea")[0]; | ||
|
||
} else if(current_url.includes("any.run")) { | ||
document.querySelector("#history-filterBtn").click(); | ||
document.querySelector("#hashSearch").value = indicator; | ||
document.querySelector(query).click(); | ||
} else { | ||
var inputNodes = document.getElementsByTagName("input"); | ||
console.log(inputNodes); | ||
// Get only text or email input nodes | ||
for(i=0; i<inputNodes.length; i++){ | ||
if(inputNodes[i].type === "text" || inputNodes[i].type === "email" || inputNodes[i].type === "url"){ | ||
// Fill the input field | ||
inputNodes[i].value = indicator; | ||
inputNode.value = indicator; | ||
if(submit === "true") { | ||
document.querySelector(query).click(); | ||
} | ||
} | ||
if(submit === "true") { | ||
|
||
} else if(current_url.includes("any.run")) { | ||
document.querySelector("#history-filterBtn").click(); | ||
document.querySelector("#hashSearch").value = indicator; | ||
document.querySelector(query).click(); | ||
} else { | ||
var inputNodes = document.getElementsByTagName("input"); | ||
console.log(inputNodes); | ||
// Get only text or email input nodes | ||
for(i=0; i<inputNodes.length; i++){ | ||
if(inputNodes[i].type === "text" || inputNodes[i].type === "email" || inputNodes[i].type === "url"){ | ||
// Fill the input field | ||
inputNodes[i].value = indicator; | ||
} | ||
} | ||
if(submit === "true") { | ||
document.querySelector(query).click(); | ||
} | ||
} | ||
} | ||
} | ||
|
||
},(error)=>{ | ||
console.error(error); | ||
}); | ||
},(error)=>{ | ||
console.error(error); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,48 @@ | ||
const regexes = { | ||
'domain': new RegExp(/((?!-)[_A-Za-z0-9-]{1,63}(?<!-)\.)+[A-Za-z]{2,6}/,'g'), | ||
'ip': new RegExp(/((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))*/,'g'), | ||
'url': new RegExp(/(?:http[s]?):\/\/((?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6})\b(?:[-a-zA-Z0-9@:%_\+.~#?&//=]*)/,'g'), | ||
'domain': new RegExp(/((?!-)[_A-Za-z0-9-]{1,63}(?<!-)(?:(\[\.\]|\.)))+[A-Za-z]{2,6}/,'g'), | ||
'ip': new RegExp(/(?!0)((2[0-4][0-9]|25[0-5]|1[0-9][0-9]|[1-9][0-9]|\d)(?:(\[\.\]|\.))){3}(2[0-4][0-9]|25[0-5]|1[0-9][0-9]|[1-9][0-9]|\d)/,'g'), | ||
'url': new RegExp(/(?:h(xx|XX|tt)p[s]?):\/\/((?:www(?:(\[\.\]|\.)))?[-a-zA-Z0-9@:%._\+~#=]{2,256}(?:(\[\.\]|\.))[a-z]{2,6})\b(?:[-a-zA-Z0-9@:%_\+.~#?&//=]*)/,'g'), | ||
'hash': new RegExp(/([a-z0-9]{64})|([a-z0-9]{40})|([a-z0-9]{32})/,'g'), | ||
'email': new RegExp(/[a-z0-9]+(\.[_a-z0-9]+)*@([a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,15}))/,'g'), | ||
'email': new RegExp(/[a-z0-9]+(\.[_a-z0-9]+)*(\[at\]|@)([a-z0-9-]+((?:(\[\.\]|\.))[a-z0-9-]+)*((?:(\[\.\]|\.))[a-z]{2,15}))/,'g'), | ||
'cve': new RegExp(/CVE-\d{4}-\d{4,7}/,'g') | ||
} | ||
|
||
browser.runtime.onMessage.addListener(function(message) { | ||
if (message === "catch") { | ||
let indParser = new IndicatorParser(); | ||
const bodyContent = document.body.innerText; | ||
|
||
let indicators = []; | ||
for(indicatorType of ['domain', 'ip', 'url', 'hash', 'email', 'cve']) { | ||
let matches = bodyContent.matchAll(regexes[indicatorType]); | ||
let match = matches.next(); | ||
while(!match.done) { | ||
let value = match.value[0]; | ||
if(value) { | ||
indicators.push({'type': indicatorType, 'value': match.value[0]}); | ||
function catchIndicators() { | ||
let indParser = new IndicatorParser(); | ||
const bodyContent = document.body.innerText; | ||
|
||
let indicators = []; | ||
for(indicatorType of ['domain', 'ip', 'url', 'hash', 'email', 'cve']) { | ||
let matches = bodyContent.matchAll(regexes[indicatorType]); | ||
let match = matches.next(); | ||
while(!match.done) { | ||
let value = match.value[0]; | ||
if(value) { | ||
let [type, tld] = indParser.getIndicatorType(value); | ||
if(type == "defanged") { | ||
refangedValue = indParser.refangIndicator(value); | ||
[type, tld] = indParser.getIndicatorType(refangedValue); | ||
} | ||
match = matches.next(); | ||
indicators.push({'type': type, 'value': value}); | ||
} | ||
match = matches.next(); | ||
} | ||
if(indicators) { | ||
browser.runtime.sendMessage({ | ||
"indicators": JSON.stringify(indicators) | ||
}).then(message=>{console.log(message)},error=>{console.error(error)}); | ||
} | ||
} | ||
if(indicators) { | ||
browser.runtime.sendMessage({ | ||
"indicators": JSON.stringify(indicators) | ||
}).then(message=>{console.log(message)},error=>{console.error(error)}); | ||
} | ||
} | ||
|
||
browser.runtime.onMessage.addListener(function(message) { | ||
if (message === "catch") { | ||
catchIndicators(); | ||
} else if (message['cmd'] === 'find') { | ||
if(!window.find(message['indicator'])) { | ||
window.find(message['indicator'], false, true, false, false, false, false); | ||
} | ||
} | ||
}); | ||
|
||
window.addEventListener("load", catchIndicators); |
Oops, something went wrong.