mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 21:43:18 -07:00
fix: commands passed with -eval are executed after modules in autostart are activated
This commit is contained in:
parent
a72801f9b5
commit
6980b864f5
1 changed files with 10 additions and 10 deletions
20
main.go
20
main.go
|
@ -42,28 +42,28 @@ func main() {
|
||||||
log.Fatal("%s", err)
|
log.Fatal("%s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Some modules are enabled by default in order
|
||||||
|
// to make the interactive session useful.
|
||||||
|
for _, modName := range str.Comma(*sess.Options.AutoStart) {
|
||||||
|
if err = sess.Run(modName + " on"); err != nil {
|
||||||
|
log.Fatal("error while starting module %s: %s", modName, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Commands sent with -eval are used to set specific
|
// Commands sent with -eval are used to set specific
|
||||||
// caplet parameters (i.e. arp.spoof.targets) via command
|
// caplet parameters (i.e. arp.spoof.targets) via command
|
||||||
// line, therefore they need to be executed first otherwise
|
// line, therefore they need to be executed first otherwise
|
||||||
// modules might already be started.
|
// modules might already be started.
|
||||||
for _, cmd := range session.ParseCommands(*sess.Options.Commands) {
|
for _, cmd := range session.ParseCommands(*sess.Options.Commands) {
|
||||||
if err = sess.Run(cmd); err != nil {
|
if err = sess.Run(cmd); err != nil {
|
||||||
log.Error("Error while running '%s': %s", tui.Bold(cmd), tui.Red(err.Error()))
|
log.Error("error while running '%s': %s", tui.Bold(cmd), tui.Red(err.Error()))
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Some modules are enabled by default in order
|
|
||||||
// to make the interactive session useful.
|
|
||||||
for _, modName := range str.Comma(*sess.Options.AutoStart) {
|
|
||||||
if err = sess.Run(modName + " on"); err != nil {
|
|
||||||
log.Fatal("Error while starting module %s: %s", modName, err)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then run the caplet if specified.
|
// Then run the caplet if specified.
|
||||||
if *sess.Options.Caplet != "" {
|
if *sess.Options.Caplet != "" {
|
||||||
if err = sess.RunCaplet(*sess.Options.Caplet); err != nil {
|
if err = sess.RunCaplet(*sess.Options.Caplet); err != nil {
|
||||||
log.Error("Error while running caplet %s: %s", tui.Bold(*sess.Options.Caplet), tui.Red(err.Error()))
|
log.Error("error while running caplet %s: %s", tui.Bold(*sess.Options.Caplet), tui.Red(err.Error()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue