This repository has been archived by the owner on Jun 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
67 changed files
with
1,526 additions
and
408 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
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,120 @@ | ||
{ | ||
"handlers": { | ||
"Account.Account": { | ||
"receives": ["Account.Create"], | ||
"emits": [] | ||
}, | ||
"Bank.Account": { | ||
"receives": ["Bank.Account.Password.Reveal.Processed"], | ||
"emits": ["Bank.Account.Password.Revealed"] | ||
}, | ||
"Bank.Transfer": { | ||
"receives": [ | ||
"Bank.Transfer.Completed", | ||
"Bank.Transfer.Aborted" | ||
], | ||
"emits": [] | ||
}, | ||
"Entity.Database": { | ||
"receives": [ | ||
"Server.Password.Acquired", | ||
"Bank.Account.Password.Revealed", | ||
"Bank.Token.Acquired", | ||
"Bank.Account.Login" | ||
], | ||
"emits": [] | ||
}, | ||
"Software.File.Transfer": { | ||
"receives": ["File.Transfer.Processed"], | ||
"emits": [ | ||
"File.Downloaded", | ||
"File.DownloadFailed", | ||
"File.Uploaded", | ||
"File.UploadFailed" | ||
] | ||
}, | ||
"Software.Cracker": { | ||
"receives": [ | ||
"Cracker.Bruteforce.Conclusion", | ||
"Cracker.Overflow.Conclusion" | ||
], | ||
"emits": [ | ||
"Server.Password.Acquired", | ||
"Cracker.Bruteforce.Failed", | ||
"Bank.Token.Acquired" | ||
] | ||
}, | ||
"Software.Filesystem": { | ||
"receives": [ | ||
"File.Downloaded", | ||
"File.Uploaded" | ||
], | ||
"emits": ["Filesystem.Changed"] | ||
}, | ||
"Log.Log": { | ||
"receives": [ | ||
"File.Downloaded", | ||
"File.Uploaded", | ||
"Log.Forge.Edited", | ||
"Log.Forge.Created", | ||
"Bank.Transfer.Completed", | ||
"Connection.Started" | ||
], | ||
"emits": [ | ||
"Log.Created", | ||
"Log.Modified", | ||
"Log.Deleted" | ||
] | ||
}, | ||
"Process.TOP": { | ||
"receives": ["Connection.Closed"], | ||
"emits": [] | ||
}, | ||
"Network.Connection": { | ||
"receives": [ | ||
"Bank.Transfer.Completed" | ||
], | ||
"emits": [ | ||
"Connection.Closed" | ||
] | ||
}, | ||
"Tunnel.Connection": { | ||
"receives": ["Connection.Closed"], | ||
"emits": [] | ||
} | ||
}, | ||
"flows": { | ||
"Bank.Account": [ | ||
"Bank.Account.Login", | ||
"Connection.Started" | ||
], | ||
"Bank.Transfer": [ | ||
"Connection.Started", | ||
"Process.Created" | ||
], | ||
"Software.File.Transfer": [ | ||
"Connection.Started", | ||
"Process.Created" | ||
], | ||
"Software.Software.Cracker": [ | ||
"Connection.Started", | ||
"Process.Created" | ||
], | ||
"Software.Software.Firewall": [ | ||
"Process.Created", | ||
"Firewall.Started" | ||
], | ||
"Software.Software.LogForger": [ | ||
"Process.Created" | ||
] | ||
}, | ||
"notifiable": [ | ||
"Log.Created", | ||
"Log.Modified", | ||
"Log.Deleted", | ||
"Server.Password.Acquired", | ||
"Process.Created", | ||
"Process.Conclusion", | ||
"File.Uploaded" | ||
] | ||
} |
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,57 @@ | ||
import json | ||
from graphviz import Digraph | ||
|
||
with open('events.json') as events_file: | ||
events = json.load(events_file) | ||
|
||
handlers = events["handlers"] | ||
flows = events["flows"] | ||
notifiable = events["notifiable"] | ||
|
||
def is_notifiable(name): | ||
return name in notifiable | ||
|
||
def node_event(g, name): | ||
color = 'lightblue4' if is_notifiable(name) else 'lightblue2' | ||
g.node(name, shape='box', color=color, style='filled') | ||
|
||
def node_handler(g, name): | ||
g.node(name, color='cornsilk', style='filled') | ||
|
||
def node_flow(g, name): | ||
g.node(name, color='khaki', style='filled') | ||
|
||
def handler_graph(g): | ||
for entry in handlers: | ||
handler = entry + ' Handler' | ||
|
||
for recv in handlers[entry]['receives']: | ||
node_event(g, recv) | ||
node_handler(g, handler) | ||
g.edge(recv, handler, label='handled by') | ||
|
||
for emit in handlers[entry]['emits']: | ||
node_event(g, emit) | ||
node_handler(g, handler) | ||
g.edge(handler, emit, label='emits') | ||
|
||
g.render() | ||
|
||
def flow_graph(g): | ||
for entry in flows: | ||
flow = entry + ' Flow' | ||
|
||
for emit in flows[entry]: | ||
node_event(g, emit) | ||
node_flow(g, flow) | ||
g.edge(flow, emit, label='emits') | ||
|
||
g.render() | ||
|
||
g1 = Digraph('events_handler', filename='graphs/events_handler.dot') | ||
g1.attr(rankdir='LR') | ||
g2 = Digraph('events_flow', filename='graphs/events_flow.dot') | ||
g2.attr(rankdir='LR') | ||
|
||
handler_graph(g1) | ||
flow_graph(g2) |
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,11 @@ | ||
defmodule HELL.ClientUtils do | ||
|
||
alias HELL.HETypes | ||
|
||
@spec to_timestamp(DateTime.t) :: | ||
HETypes.client_timestamp | ||
def to_timestamp(datetime) do | ||
datetime | ||
|> DateTime.to_unix() | ||
end | ||
end |
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,5 @@ | ||
defmodule HELL.HETypes do | ||
|
||
@type client_timestamp :: integer | ||
|
||
end |
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
Oops, something went wrong.