-
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 #46 from vincenzocaputo/develop
Develop
- Loading branch information
Showing
16 changed files
with
895 additions
and
61 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.
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 |
---|---|---|
@@ -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; | ||
} |
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 |
---|---|---|
@@ -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> |
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 |
---|---|---|
@@ -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})`; | ||
}); | ||
} | ||
|
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
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.