Skip to content
This repository has been archived by the owner on Oct 14, 2020. It is now read-only.

Commit

Permalink
Added sqlite support, added image
Browse files Browse the repository at this point in the history
  • Loading branch information
pielco11 committed Sep 8, 2018
1 parent 7276361 commit fa8e3b3
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 64 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Every icon comes from Font Awesome, I just changed colors.
![icons2](images/icons_2.png)

## Screenshots
![example](images/example_query.png)
![dashboard](images/screenshot_30.png)
![dashboard1](images/screenshot_31.png)
![dashboard2](images/screenshot_32.png)
Expand Down
Binary file added images/example_query.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 index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ app.on('ready' , function(){
}));
setTimeout(function (){
win.loadURL(url.format({
pathname: path.join(__dirname, 'pages/graph.html'),
pathname: path.join(__dirname, 'pages/graph_1.html'),
protocol: 'file:',
slashes: true
}));
Expand Down
96 changes: 48 additions & 48 deletions js/iconType.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
const solid = "../icons/solid/"
const brands = "../icons/brands/"

const email = solid + "envelope.svg";
const domain = solid + "building.svg";
const criminal = solid + "angry.svg";
const malware = solid + "bug.svg";
const vector = solid + "bus.svg";
const lightDrug = solid + "cannabis.svg";
const heavyDrug = solid + "capsules.svg";
const IOC = solid + "car-crash.svg";
const admin = solid + "crown.svg";
const child = solid + "child.svg";
const market = solid + "city.svg";
const cloud = solid + "cloud.svg";
const forum = solid + "comments.svg";
const creditCard = solid + "credit-card.svg";
const arms = solid + "crosshairs.svg";
const dumps = solid + "datasolid.svg";
const pdf = solid + "file-pdf.svg";
const audio = solid + "file-audio.svg";
const image = solid + "file-image.svg";
const ppt = solid + "file-powerpoint.svg";
const video = solid + "file-video.svg";
const docx = solid + "file-word.svg";
const fingerprint = solid + "fingerprint.svg";
const key = solid + "key.svg";
const position = solid + "map-marked-alt.svg";
const user = solid + "user-alt.svg";

const bitcoin = brands + "bitcoin.svg";
const discord = brands + "discord.svg";
const facebook = brands + "facebook.svg";
const keybase = brands + "keybase.svg";
const linkedin = brands + "linkedin.svg";
const monero = brands + "monero.svg";
const paypal = brands + "paypal.svg";
const reddit = brands + "reddit.svg";
const skype = brands + "skype.svg";
const snapchat = brands + "snapchat-square.svg";
const stackOverflow = brands + "stack-overflow.svg";
const telegram = brands + "telegram.svg";
const tumblr = brands + "tumblr-square.svg";
const twitter = brands + "twitter.svg";
const vk = brands + "vk.svg";
const whatsapp = brands + "whatsapp.svg";
const yahoo = brands + "yahoo.svg";
const youtube = brands + "youtube.svg";
solid = "../icons/solid/"
brands = "../icons/brands/"

const icons = {
"email" : solid + "envelope.svg",
"domain" : solid + "building.svg",
"criminal" : solid + "angry.svg",
"malware" : solid + "bug.svg",
"vector" : solid + "bus.svg",
"lightDrug" : solid + "cannabis.svg",
"heavyDrug" : solid + "capsules.svg",
"IOC" : solid + "car-crash.svg",
"admin" : solid + "crown.svg",
"child" : solid + "child.svg",
"market" : solid + "city.svg",
"cloud" : solid + "cloud.svg",
"forum" : solid + "comments.svg",
"creditCard" : solid + "credit-card.svg",
"arms" : solid + "crosshairs.svg",
"dumps" : solid + "datasolid.svg",
"pdf" : solid + "file-pdf.svg",
"audio" : solid + "file-audio.svg",
"image" : solid + "file-image.svg",
"ppt" : solid + "file-powerpoint.svg",
"video" : solid + "file-video.svg",
"docx" : solid + "file-word.svg",
"fingerprint" : solid + "fingerprint.svg",
"key" : solid + "key.svg",
"position" : solid + "map-marked-alt.svg",
"user" : solid + "user-alt.svg",
"bitcoin" : brands + "bitcoin.svg",
"discord" : brands + "discord.svg",
"facebook" : brands + "facebook.svg",
"keybase" : brands + "keybase.svg",
"linkedin" : brands + "linkedin.svg",
"monero" : brands + "monero.svg",
"paypal" : brands + "paypal.svg",
"reddit" : brands + "reddit.svg",
"skype" : brands + "skype.svg",
"snapchat" : brands + "snapchat-square.svg",
"stackOverflow" : brands + "stack-overflow.svg",
"telegram" : brands + "telegram.svg",
"tumblr" : brands + "tumblr-square.svg",
"twitter" : brands + "twitter.svg",
"vk" : brands + "vk.svg",
"whatsapp" : brands + "whatsapp.svg",
"yahoo" : brands + "yahoo.svg",
"youtube" : brands + "youtube.svg",
}
46 changes: 31 additions & 15 deletions pages/graph_1.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,25 @@ <h1>
<input class="uk-input uk-form-width-medium" type="text" placeholder="Graph file" id="graphFile">
</div>

<input class="uk-input uk-form-width-medium" type="text" id="tableName" placeholder="Table">
<input class="uk-input uk-form-width-medium" type="text" id="queryCondition" placeholder="Condition">
<input class="uk-input uk-form-width-medium" type="text" id="iconTypeInput" placeholder="Icon From">
<input class="uk-input uk-form-width-medium" type="text" id="iconTypeOutput" placeholder="Icon To">
<input class="uk-input uk-form-width-medium" type="text" id="centerToNode" placeholder="Center to node">
<button type="button" class="uk-button uk-button-default" onclick="centerGraph()">Center Graph</input>
</div>

<div>
<input class="uk-input uk-form-width-medium" type="text" id="rawQuery" placeholder="Raw Query">
<input class="uk-input uk-form-width-large" type="text" id="query" placeholder="Query">
<button type="button" class="uk-button uk-button-default" onclick="loadGraph()">Load data</button>
<button type="button" class="uk-button uk-button-default" onclick="drawGraph()">Draw graph</button>
<button type="button" class="uk-button uk-button-default" onclick="importNetwork()">Import Graph</input>
<button type="button" class="uk-button uk-button-default" onclick="exportNetwork()">Export Graph</input>
<button type="button" class="uk-button uk-button-default" onclick="centerGraph()">Center Graph</input>
<button type="button" class="uk-button uk-button-default" onclick="precomputeGraph()">Prerender</input>
</div>
</form>
<div id="graphHere"></div>
<script>
const sqlite3 = require('sqlite3').verbose();

var nodes = [];
var links = [];
var graph = Viva.Graph.graph();
Expand Down Expand Up @@ -205,17 +207,31 @@ <h1>
};
};
function loadGraph(){
for (let i = 0; i < 200; i++) {
loadNode('email'+i, email);
}
for (let u = 0; u < 90; u++) {
var a = u+1
loadLink('email'+u, 'email'+a);
}
for (let u = 90; u < 190; u++) {
var a = u+1
loadLink('email'+u, 'email'+a);
}
// next lines to use just as example and reference
//for (let i = 0; i < 200; i++) {
// loadNode('email'+i, email);
//}
//for (let u = 0; u < 90; u++) {
// var a = u+1
// loadLink('email'+u, 'email'+a);
//}
//for (let u = 90; u < 190; u++) {
// var a = u+1
// loadLink('email'+u, 'email'+a);
//}
var query = "";
var iconTypeFrom = icons[document.getElementById("iconTypeInput").value];
var iconTypeTo = icons[document.getElementById("iconTypeOutput").value];
var rawQuery = document.getElementById("query").value;
var db = new sqlite3.Database(document.getElementById("submitDatabase").value);
console.log(rawQuery);
// query: SELECT DISTINCT custom_column_name AS from, another_custom_name AS to FROM some_table;
// obviously you can add other options as WHERE or ORDER BY
db.each(rawQuery, (err, result) => {
loadNode(result.input, iconTypeFrom)
loadNode(result.output, iconTypeTo)
loadLink(result.input, result.output)
})
};
function precomputeGraph(){
precompute(4000, drawGraph);
Expand Down

0 comments on commit fa8e3b3

Please sign in to comment.