Skip to content

Commit d59a0a6

Browse files
Merge pull request #53 from vincenzocaputo/develop
Version 0.19.0
2 parents 4437efe + 7e55659 commit d59a0a6

File tree

21 files changed

+950
-206
lines changed

21 files changed

+950
-206
lines changed

._media/Untitled Diagram.drawio

Lines changed: 55 additions & 0 deletions
Large diffs are not rendered by default.

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.19.0] - 2024-02-04
8+
### Add
9+
- Automatic graph generation
10+
- Threatbook CTI resource for domains and IP addresses
11+
- Info boxes on setting items
12+
13+
### Change
14+
- Graph UI
15+
- Settings menu
16+
17+
### Fix
18+
- Minor fixes
19+
720
## [0.18.1] - 2023-11-26
821
### Add
922
- Spam Database Lookup resource

assets/tools-icons/cymru.png

1.06 KB
Loading

assets/tools-icons/favicon.ico

-16.7 KB
Binary file not shown.

assets/tools-icons/threatbook.png

407 Bytes
Loading

manifest.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 2,
33
"name": "FoxyRecon",
4-
"version": "0.18.1",
4+
"version": "0.19.0",
55
"description": "A Firefox add-on for OSINT investigations",
66

77
"icons": {
@@ -15,7 +15,9 @@
1515
"scripts": [
1616
"src/lib/browser-polyfill.js",
1717
"src/utils/toolsFileLoader.js",
18+
"src/utils/graphNodesFileLoader.js",
1819
"src/utils/utils.js",
20+
"src/utils/graph.js",
1921
"src/background.js"
2022
]
2123
},
@@ -26,6 +28,8 @@
2628
"src/lib/browser-polyfill.js",
2729
"src/utils/indicatorparser.js",
2830
"src/utils/utils.js",
31+
"src/utils/graph.js",
32+
"src/content_scripts/graph.js",
2933
"src/content_scripts/context_menu.js",
3034
"src/content_scripts/catch.js"
3135
]

src/background.js

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,31 @@ if (installedVersion != currentVersion) {
1616
localStorage.setItem("version", currentVersion);
1717
}
1818

19+
// Setup default settings
20+
if (!localStorage.getItem("settings.newtab")) {
21+
localStorage.setItem("settings.newtab", "true");
22+
}
23+
if (!localStorage.getItem("settings.autosubmit")) {
24+
localStorage.setItem("settings.autosubmit", "false");
25+
}
26+
if (!localStorage.getItem("settings.autocatch")) {
27+
localStorage.setItem("settings.autocatch", "false");
28+
}
29+
if (!localStorage.getItem("settings.autograph")) {
30+
localStorage.setItem("settings.autograph", "false");
31+
}
32+
1933
var tools;
2034
loadToolsList(function(ts) {
2135
tools=ts;
2236
createToolsMenu(tools);
2337
})
2438

39+
var graphMapping;
40+
loadGraphMapping(function(mp) {
41+
graphMapping=mp;
42+
})
43+
2544

2645
/**
2746
* Create context menu containing the tools list
@@ -56,7 +75,6 @@ function catchIndicators(e) {
5675
// Send a message to the content script
5776
browser.tabs.sendMessage(activeTab, "catch")
5877
.then((response) => {
59-
console.log(response);
6078
})
6179
.catch((error) => {
6280
browser.browserAction.setBadgeText({text: ""});
@@ -119,6 +137,7 @@ function updateToolsMenu(toolsList, indicator, type) {
119137
// Save the indicator in the local storage
120138
localStorage.setItem("type", type);
121139
localStorage.setItem("indicator", indicator);
140+
//localStorage.setItem("graph.autocreate", "true");
122141
// Add the query for autofill to localstorage
123142
if(tool["submitQuery"]) {
124143
localStorage.setItem("submit-btn-query", tool["submitQuery"]);
@@ -139,8 +158,8 @@ function updateToolsMenu(toolsList, indicator, type) {
139158
* Waiting for messages from content_script
140159
*/
141160
browser.runtime.onMessage.addListener(function(request, sender, sendResponse) {
142-
console.log("Waiting for messages");
143161
if(request.id == 1) {
162+
// Autofill feature
144163
query = localStorage.getItem("submit-btn-query");
145164
// Send the query only if auto-submit option is enabled
146165
if(localStorage.getItem("settings.autosubmit") === "true") {
@@ -149,11 +168,28 @@ browser.runtime.onMessage.addListener(function(request, sender, sendResponse) {
149168
} else {
150169
submit = "false";
151170
}
152-
console.log(query);
153-
154171
sendResponse({msg: localStorage.getItem("indicator"), query: query, submit: submit});
155172
// Consume the request (to avoid clicking the button more times for the same request)
156173
localStorage.setItem("submit-btn-query","");
174+
} else if (request.id == 2) {
175+
// Auto graph generation
176+
if (localStorage.getItem("settings.autograph") === "true" && request.msg) {
177+
const resource = request.msg;
178+
let mappings = Array();
179+
for (i=0; i<graphMapping.length; i++) {
180+
if (resource.startsWith(graphMapping[i]['source'])) {
181+
mappings.push(graphMapping[i]);
182+
}
183+
}
184+
sendResponse({msg: localStorage.getItem("indicator"), map: JSON.stringify(mappings) })
185+
}
186+
} else if (request.id == 3) {
187+
const graph = new Graph();
188+
const rel = JSON.parse(request.msg);
189+
graph.addNode(rel['source']['id'], rel['source']['type']);
190+
graph.addNode(rel['target']['id'], rel['target']['type']);
191+
graph.addRelationship(rel['source']['id'], rel['target']['id'], rel['label']);
192+
sendResponse({msg: 1});
157193
} else {
158194
updateToolsMenu(tools, request.indicator, request.type);
159195
}

src/content_scripts/autofill.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
let indicator = "";
2+
var indicator = "";
33
// Send a message to background script in order to retrieve the indicator saved in the local storage
44
function sendMessageAndFill() {
55
browser.runtime.sendMessage({
@@ -64,9 +64,13 @@ function sendMessageAndFill() {
6464
document.querySelector("#history-filterBtn").click();
6565
document.querySelector("#hashSearch").value = indicator;
6666
document.querySelector(query).click();
67-
} else {
67+
} else if(current_url.includes("cymru")) {
68+
document.querySelector("#hashes").value = indicator;
69+
if (submit === "true") {
70+
document.querySelector(query).click();
71+
}
72+
}else {
6873
var inputNodes = document.getElementsByTagName("input");
69-
console.log(inputNodes);
7074
// Get only text or email input nodes
7175
for(i=0; i<inputNodes.length; i++){
7276
if(inputNodes[i].type === "text" || inputNodes[i].type === "email" || inputNodes[i].type === "url"){

src/content_scripts/catch.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ function catchIndicators() {
1414
let indicators = [];
1515
for(indicatorType of ['domain', 'ip', 'url', 'hash', 'email', 'cve']) {
1616
let matches = bodyContent.matchAll(regexes[indicatorType]);
17-
console.log(matches);
1817
let match = matches.next();
1918
while(!match.done) {
2019
let value = match.value[0];

src/content_scripts/graph.js

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
var indicator = "";
2+
3+
function sendMessageAndAddNodes() {
4+
const current_url = window.location.href;
5+
browser.runtime.sendMessage({
6+
id: 2,
7+
msg: current_url
8+
}).then((resp) => {
9+
indicator = resp.msg;
10+
11+
const map = resp.map;
12+
13+
if (map) {
14+
const parser = new IndicatorParser();
15+
const [type, tld] = parser.getIndicatorType(indicator);
16+
const mappings = JSON.parse(map);
17+
for (const mapping of mappings) {
18+
if (type === mapping['type']) {
19+
const intervalId = setInterval(function() {
20+
document.querySelectorAll(mapping['query']).forEach((tag) => {
21+
const target = tag.textContent.trim();
22+
const [targetType, tld] = parser.getIndicatorType(target);
23+
if (targetType === mapping['nodeType']) {
24+
if (mapping['relationType'] === 'outbound') {
25+
var relationship = {
26+
'source': {
27+
'id': indicator,
28+
'type': type
29+
},
30+
'target': {
31+
'id': target,
32+
'type': targetType
33+
},
34+
'label': mapping['relationName']
35+
}
36+
browser.runtime.sendMessage({
37+
id: 3,
38+
msg: JSON.stringify(relationship)
39+
}).then((r) => {r.msg});
40+
41+
}
42+
if(mapping['relationType'] === 'inbound') {
43+
var relationship = {
44+
'source': {
45+
'id': indicator,
46+
'type': type
47+
},
48+
'target': {
49+
'id': target,
50+
'type': targetType
51+
},
52+
'label': mapping['relationName']
53+
}
54+
browser.runtime.sendMessage({
55+
id: 3,
56+
msg: JSON.stringify(relationship)
57+
}).then(() => {});
58+
}
59+
}
60+
clearInterval(intervalId);
61+
});
62+
}, 500);
63+
}
64+
}
65+
66+
}
67+
});
68+
}
69+
70+
setTimeout(sendMessageAndAddNodes(), 5000);
71+
72+

0 commit comments

Comments
 (0)