new: caplets can now include other caplets

This commit is contained in:
evilsocket 2018-01-13 14:07:37 +01:00
parent 892659ba7f
commit 1ab8711d79
3 changed files with 13 additions and 3 deletions

3
caplets/ap-config.cap Normal file
View file

@ -0,0 +1,3 @@
set api.rest.username changeme
set api.rest.password changeme
set api.rest.address 0.0.0.0

View file

@ -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

View file

@ -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))
}