refact: refactored commands parsing code into session.ParseCommands function

This commit is contained in:
evilsocket 2018-01-23 20:20:54 +01:00
commit 7eebea30d0
2 changed files with 15 additions and 9 deletions

View file

@ -46,6 +46,17 @@ type Session struct {
Events *EventPool `json:"-"`
}
func ParseCommands(buffer string) []string {
cmds := make([]string, 0)
for _, cmd := range strings.Split(buffer, ";") {
cmd = strings.Trim(cmd, "\r\n\t ")
if cmd != "" {
cmds = append(cmds, cmd)
}
}
return cmds
}
func New() (*Session, error) {
var err error