mirror of
https://github.com/bettercap/bettercap
synced 2025-07-08 14:01:44 -07:00
new: added -eval command
This commit is contained in:
parent
a849692468
commit
59c0e1eb76
3 changed files with 12 additions and 1 deletions
|
@ -1,4 +1,7 @@
|
||||||
set arp.spoof.targets 192.168.1.53
|
# targeting the whole subnet by default, to make it selective:
|
||||||
|
#
|
||||||
|
# sudo ./bettercap-ng -caplet caplets/beef-active.cap -eval "set arp.spoof.targets 192.168.1.64"
|
||||||
|
|
||||||
# inject beef hook
|
# inject beef hook
|
||||||
set http.proxy.script caplets/beef-inject.js
|
set http.proxy.script caplets/beef-inject.js
|
||||||
# keep reading arp table for network mapping
|
# keep reading arp table for network mapping
|
||||||
|
|
|
@ -8,6 +8,7 @@ type Options struct {
|
||||||
Debug *bool
|
Debug *bool
|
||||||
Silent *bool
|
Silent *bool
|
||||||
NoHistory *bool
|
NoHistory *bool
|
||||||
|
Commands *string
|
||||||
}
|
}
|
||||||
|
|
||||||
func ParseOptions() (Options, error) {
|
func ParseOptions() (Options, error) {
|
||||||
|
@ -17,6 +18,7 @@ func ParseOptions() (Options, error) {
|
||||||
Debug: flag.Bool("debug", false, "Print debug messages."),
|
Debug: flag.Bool("debug", false, "Print debug messages."),
|
||||||
Silent: flag.Bool("silent", false, "Suppress all logs which are not errors."),
|
Silent: flag.Bool("silent", false, "Suppress all logs which are not errors."),
|
||||||
NoHistory: flag.Bool("no-history", false, "Disable history file."),
|
NoHistory: flag.Bool("no-history", false, "Disable history file."),
|
||||||
|
Commands: flag.String("eval", "", "Run a command, used to set variables via command line."),
|
||||||
}
|
}
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
6
main.go
6
main.go
|
@ -34,6 +34,12 @@ func main() {
|
||||||
|
|
||||||
defer sess.Close()
|
defer sess.Close()
|
||||||
|
|
||||||
|
if *sess.Options.Commands != "" {
|
||||||
|
if err = sess.Run(*sess.Options.Commands); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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.Fatal(err)
|
log.Fatal(err)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue