Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load existing graph from JSON #69

Merged
merged 6 commits into from
Nov 8, 2019
Merged

Load existing graph from JSON #69

merged 6 commits into from
Nov 8, 2019

Conversation

yampelo
Copy link
Owner

@yampelo yampelo commented Nov 8, 2019

import json
from beagle.datasources import SysmonEVTX
from beagle.backends import NetworkX

# Get back a nx.MultiDiGraph object
graph = SysmonEVTX("malicious.evtx").to_graph()

# Convert the object to JSON
graph_json = NetworkX.graph_to_json(graph)

with open("my_graph.json", "w") as f:
    json.dump(graph_json, f)

# Later on:
# G is the same nx.MultiDiGraph object generated by `.to_graph()`
G = NetworkX.from_json("my_graph.json")

Closes #64

@codecov
Copy link

codecov bot commented Nov 8, 2019

Codecov Report

Merging #69 into master will increase coverage by 0.2%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master      #69     +/-   ##
=========================================
+ Coverage   78.25%   78.46%   +0.2%     
=========================================
  Files          56       56             
  Lines        2677     2703     +26     
=========================================
+ Hits         2095     2121     +26     
  Misses        582      582
Impacted Files Coverage Δ
beagle/backends/networkx.py 97.61% <100%> (+0.84%) ⬆️
beagle/transformers/sysmon_transformer.py 97.61% <100%> (-0.19%) ⬇️
beagle/nodes/file.py 97.67% <100%> (+0.11%) ⬆️
beagle/backends/__init__.py 100% <100%> (ø) ⬆️
beagle/nodes/process.py 100% <100%> (ø) ⬆️
beagle/nodes/__init__.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d014c31...5ac7970. Read the comment docs.

@yampelo yampelo merged commit 86dd5ea into master Nov 8, 2019
@yampelo yampelo deleted the load-graph-from-json branch November 8, 2019 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Load graph from JSON
1 participant