Skip to content

Commit

Permalink
Merge pull request #46 from vincenzocaputo/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
vincenzocaputo committed Oct 3, 2023
2 parents 9927b20 + 0a47aa2 commit 7612c54
Show file tree
Hide file tree
Showing 16 changed files with 895 additions and 61 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.18.0] - 2023-10-03
### Add
- Graph

### Change
- Censys URL (Certificates and Host)
- Added domain for Censys Host resource

### Fix
- Tools first loading bug in context menu

## [0.17.0] - 2023-07-26
### Add
- Web Check resource for domains and urls
Expand Down
Binary file added assets/icons/del.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/link.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/plus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "FoxyRecon",
"version": "0.17.0",
"version": "0.18.0",
"description": "A Firefox add-on for OSINT investigations",

"icons": {
Expand Down
6 changes: 5 additions & 1 deletion src/customtools/customtools.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
html, body {
height: 100%;
width: 100%;
}

#header-pane {
padding: 10px;
width: 100%;
Expand All @@ -22,7 +27,6 @@
}

#left-pane {
//background-color: yellow;
float: left;
height: 90%;
width: 45%;
Expand Down
155 changes: 155 additions & 0 deletions src/graph/graph.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
#header-pane {
display: block;
padding: 10px;
width: 100%;
border-bottom: 1px solid black;
}

#header-pane img {
height: 48px;
width: 48px;
float: left;
display: block;
}

#header-pane div {
display: block;
margin-left: 10px;
font-size: 32px;
height: 48px;
width: 50%;
margin-left: 60px;
}

#option-palette {
margin: 2px;
background-color: #D9D9D9;
border: 1px outset black;
display: block;
width: 100%;
margin-left: 0;
padding: 5px;
}



/* CSS */
.button {
appearance: none;
background-color: #fa6400;
border: 1px solid rgba(27, 31, 35, .15);
border-radius: 6px;
box-shadow: rgba(27, 31, 35, .1) 0 1px 0;
box-sizing: border-box;
color: #fff;
cursor: pointer;
display: inline-block;
font-family: -apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";
font-size: 14px;
font-weight: 600;
line-height: 20px;
padding: 6px 16px;
position: relative;
text-align: center;
text-decoration: none;
user-select: none;
-webkit-user-select: none;
touch-action: manipulation;
vertical-align: middle;
white-space: nowrap;
}

.button:focus:not(:focus-visible):not(.focus-visible) {
box-shadow: none;
outline: none;
}

.button:hover {
background-color: #fb8332;
}

.button:focus {
box-shadow: rgba(46, 164, 79, .4) 0 0 0 3px;
outline: none;
}

.button:disabled {
background-color: #94d3a2;
border-color: rgba(27, 31, 35, .1);
color: rgba(255, 255, 255, .8);
cursor: default;
}

.button:active {
background-color: #c85000;
box-shadow: rgba(0, 0, 0, .06) 0 2px 4px;
transform: translateY(0);
}



/* GRAPH SECTION */
#graph-pane {
float: left;
clear: right;
margin-top: 10px;
width: 100%;
height: 100%;
}


.node {
stroke-width: 2px;
stroke: #111111;
}

.domain {
fill: #BB0000;
}

.ip {
fill: #00BB00;
}

.url {
fill: #FF4D00;
}

.hash {
fill: #00FFCC;
}

.email {
fill: #001EFF;
}

.cve {
fill: #FFE136;
}

.invalid {
fill: #999999;
}

.node-label {
font-size: 10px;
}

.link {
stroke: #000000;
stroke-width: 1px;
}

.link-label {
font-size: 12px; /* Adjust the font size */
fill: #333; /* Adjust the label color */
text-anchor: middle; /* Center-align the text */
}

.arrowhead {
fill: #000000;
}

#graph {
background-color: #F5EFE1;
}
23 changes: 23 additions & 0 deletions src/graph/graph.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="graph.css">
<title>FoxyRecon Graph</title>
<script src="../lib/d3.v7.min.js"></script>
</head>
<body>
<div id="header-pane">
<img src="../../assets/icons/foxyrecon-icon-48.png"/>
<div>Graph</div>
</div>
<div id="option-palette">
<button class="button" id="delete-button">Delete Graph</button>
</div>
<div id="graph-pane">
<svg width="100%" height="600" preserveAspectRatio="none" id="graph"></svg>
</div>
<script src="graph.js"></script>
</body>
</html>
129 changes: 129 additions & 0 deletions src/graph/graph.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@

const graph = JSON.parse(localStorage.getItem("graph"));

document.getElementById("delete-button").addEventListener("click", (e) => {
const res = confirm("Are you sure you want to delete this graph? This operation cannot be undone")
if (res == true) {
const newEmptyGraph = {
'nodes': [],
'links': []
}
localStorage.setItem("graph", JSON.stringify(newEmptyGraph));
d3.select("#graph").remove();
}
});


const nodes = graph["nodes"];
const links = graph["links"];


const dragstarted = (event, d) => {
if (!event.active) simulation.alphaTarget(0.3).restart();
d.fx = d.x;
d.fy = d.y;
};

const dragged = (event, d) => {
d.fx = event.x;
d.fy = event.y;
};

const dragended = (event, d) => {
if (!event.active) simulation.alphaTarget(0);
d.fx = null;
d.fy = null;
};


const svg = d3.select("#graph");

const width = document.getElementById("graph").getBoundingClientRect().width;
const height = document.getElementById("graph").getBoundingClientRect().height;

const simulation = d3.forceSimulation()
.force("link", d3.forceLink().id(d => d.id).distance(200))
.force("charge", d3.forceManyBody().strength(-100))
.force("center", d3.forceCenter(width / 2, height / 2));


const nodeSelection = svg.selectAll(".node")
.data(nodes)
.enter().append("g")

nodeSelection.append("circle")
.attr("r", 10)
.attr("class", d => "node " + d.type)
.call(d3.drag()
.on("start", dragstarted)
.on("drag", dragged)
.on("end", dragended));

nodeSelection.append("title")
.text(d=>d.id);

const labels = nodeSelection.append("text")
.attr("x", 15)
.attr("dy", -5)
.text(d=>d.id)


svg.append("defs").append("marker")
.attr("id", "arrowhead")
.attr("viewBox", "0 -5 10 10")
.attr("refX", 20) // Adjust the position for better alignment
.attr("refY", 0)
.attr("markerWidth", 10)
.attr("markerHeight", 10)
.attr("orient", "auto")
.append("path")
.attr("d", "M0,-5L10,0L0,5")
.attr("class", "arrowhead");

const linkSelection = svg.selectAll(".link")
.data(links)
.enter().append("line")
.attr("class", "link")
.attr("marker-end", "url(#arrowhead)")
.attr("x1", d => d.source.x)
.attr("y1", d => d.source.y)
.attr("x2", d => d.target.x)
.attr("y2", d => d.target.y)
.lower();

const linkLabelSelection = svg.selectAll(".link-label-group")
.data(links)
.enter().append("g")
.attr("class", "link-label-group");

// Append text to the link label group
linkLabelSelection.append("text")
.attr("class", "link-label")
.attr("dy", -5)
.attr("text-anchor", "middle")
.text(d => d.label);


simulation.nodes(nodes)
.on("tick", ticked);

simulation.force("link")
.links(links);

function ticked() {
linkSelection
.attr("x1", d => d.source.x)
.attr("y1", d => d.source.y)
.attr("x2", d => d.target.x)
.attr("y2", d => d.target.y);

nodeSelection.attr("transform", d => `translate(${d.x},${d.y})`);

// Position the link label group in the middle of the link
linkLabelSelection.attr("transform", d => {
const x = (d.source.x + d.target.x) / 2;
const y = (d.source.y + d.target.y) / 2;
return `translate(${x},${y})`;
});
}

7 changes: 4 additions & 3 deletions src/json/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
{
"name": "Censys Certificates",
"url": {
"domain": "https://search.censys.io/certificates?q=%s"
"domain": "https://search.censys.io/search?resource=certificates&sort=RELEVANCE&per_page=25&virtual_hosts=EXCLUDE&q=%s"
},
"desc": "Hosts and networks search engine",
"icon": "censys.png",
Expand All @@ -112,12 +112,13 @@
{
"name": "Censys Hosts",
"url": {
"ip": "https://search.censys.io/hosts/%s"
"ip": "https://search.censys.io/search?resource=hosts&sort=RELEVANCE&per_page=25&virtual_hosts=EXCLUDE&q=%s",
"domain": "https://search.censys.io/search?resource=hosts&sort=RELEVANCE&per_page=25&virtual_hosts=EXCLUDE&q=%s"
},
"desc": "Hosts and networks search engine",
"icon": "censys.png",
"color": "#FF7A38",
"types": ["ip"],
"types": ["ip", "domain"],
"tags": ["open-ports"]
},
{
Expand Down
2 changes: 2 additions & 0 deletions src/lib/d3.v7.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 7612c54

Please sign in to comment.