diff --git a/caplets/ap-config.cap b/caplets/ap-config.cap new file mode 100644 index 00000000..4e2836a7 --- /dev/null +++ b/caplets/ap-config.cap @@ -0,0 +1,3 @@ +set api.rest.username changeme +set api.rest.password changeme +set api.rest.address 0.0.0.0 diff --git a/caplets/ap.cap b/caplets/ap.cap index 7ff95390..70da11ef 100644 --- a/caplets/ap.cap +++ b/caplets/ap.cap @@ -1,6 +1,4 @@ -set api.rest.username changeme -set api.rest.password changeme -set api.rest.address 0.0.0.0 +include caplets/ap-config.cap set net.sniff.local true set net.sniff.verbose false diff --git a/session/session_core_handlers.go b/session/session_core_handlers.go index 5479e181..c01a664c 100644 --- a/session/session_core_handlers.go +++ b/session/session_core_handlers.go @@ -158,6 +158,10 @@ func (s *Session) clsHandler(args []string, sess *Session) error { return nil } +func (s *Session) includeHandler(args []string, sess *Session) error { + return s.RunCaplet(args[0]) +} + func (s *Session) registerCoreHandlers() { s.CoreHandlers = append(s.CoreHandlers, NewCommandHandler("help", "^(help|\\?)$", @@ -198,4 +202,9 @@ func (s *Session) registerCoreHandlers() { "^(clear|cls)$", "Clear the screen.", s.clsHandler)) + + s.CoreHandlers = append(s.CoreHandlers, NewCommandHandler("include CAPLET", + "^include\\s+(.+)", + "Load and run this caplet in the current session.", + s.includeHandler)) }