yampelo / beagle

Beagle is an incident response and digital forensics tool which transforms security logs and data into graphs.
MIT License
1.27k stars 144 forks source link

Load existing graph from JSON #69

Closed yampelo closed 4 years ago

yampelo commented 4 years ago
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[bot] commented 4 years ago

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%) :arrow_up:
beagle/transformers/sysmon_transformer.py 97.61% <100%> (-0.19%) :arrow_down:
beagle/nodes/file.py 97.67% <100%> (+0.11%) :arrow_up:
beagle/backends/__init__.py 100% <100%> (ø) :arrow_up:
beagle/nodes/process.py 100% <100%> (ø) :arrow_up:
beagle/nodes/__init__.py 100% <100%> (ø) :arrow_up:

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.