MCPcopy Index your code
hub / github.com/bettercap/bettercap / NewModule

Function NewModule

modules/graph/module.go:59–143  ·  view source on GitHub ↗
(s *session.Session)

Source from the content-addressed store, hash-verified

57}
58
59func NewModule(s *session.Session) *Module {
60 mod := &Module{
61 SessionModule: session.NewSessionModule("graph", s),
62 settings: settings{
63 path: filepath.Join(caplets.InstallBase, "graph"),
64 dot: dotSettings{
65 layout: "neato",
66 name: "bettergraph",
67 output: "bettergraph.dot",
68 },
69 json: jsonSettings{
70 output: "bettergraph.json",
71 },
72 },
73 }
74
75 mod.AddParam(session.NewStringParameter("graph.path",
76 mod.settings.path,
77 "",
78 "Base path for the graph database."))
79
80 mod.AddParam(session.NewStringParameter("graph.dot.name",
81 mod.settings.dot.name,
82 "",
83 "Graph name in the dot output."))
84
85 mod.AddParam(session.NewStringParameter("graph.dot.layout",
86 mod.settings.dot.layout,
87 "",
88 "Layout for dot output."))
89
90 mod.AddParam(session.NewStringParameter("graph.dot.output",
91 mod.settings.dot.output,
92 "",
93 "File name for dot output."))
94
95 mod.AddParam(session.NewStringParameter("graph.json.output",
96 mod.settings.json.output,
97 "",
98 "File name for JSON output."))
99
100 mod.AddParam(session.NewBoolParameter("graph.disconnected",
101 "false",
102 "Include disconnected edges in then output graph."))
103
104 mod.AddParam(session.NewBoolParameter("graph.privacy",
105 "false",
106 "Obfuscate mac addresses."))
107
108 mod.AddHandler(session.NewModuleHandler("graph on", "",
109 "Start the Module module.",
110 func(args []string) error {
111 return mod.Start()
112 }))
113
114 mod.AddHandler(session.NewModuleHandler("graph off", "",
115 "Stop the Module module.",
116 func(args []string) error {

Callers 1

LoadModulesFunction · 0.92

Calls 11

StartMethod · 0.95
StopMethod · 0.95
generateDotGraphMethod · 0.95
generateJSONGraphMethod · 0.95
NewSessionModuleFunction · 0.92
NewStringParameterFunction · 0.92
NewBoolParameterFunction · 0.92
NewModuleHandlerFunction · 0.92
NormalizeMacFunction · 0.92
AddParamMethod · 0.80
AddHandlerMethod · 0.80

Tested by

no test coverage detected