@@ -42,6 +42,7 @@ type Options struct {
4242 SourceIp string
4343 Interface string
4444 WarmUpTime int
45+ InterfacesList bool
4546}
4647
4748// ParseOptions parses the command line flags provided by a user
@@ -79,6 +80,7 @@ func ParseOptions() *Options {
7980 flag .BoolVar (& options .Unprivileged , "unprivileged" , false , "Drop root privileges" )
8081 flag .BoolVar (& options .ExcludeCDN , "exclude-cdn" , false , "Avoid scanning CDN ips" )
8182 flag .IntVar (& options .WarmUpTime , "warm-up-time" , 2 , "Time in Seconds between scan phases" )
83+ flag .BoolVar (& options .InterfacesList , "interface-list" , false , "list available interfaces and exit" )
8284 flag .Parse ()
8385
8486 // Check if stdin pipe was given
@@ -95,6 +97,12 @@ func ParseOptions() *Options {
9597 os .Exit (0 )
9698 }
9799
100+ // Show network configuration and exit if the user requested it
101+ if options .InterfacesList {
102+ showNetworkInterfaces ()
103+ os .Exit (0 )
104+ }
105+
98106 // Validate the options passed by the user and if any
99107 // invalid options have been used, exit.
100108 err := options .validateOptions ()
@@ -104,6 +112,7 @@ func ParseOptions() *Options {
104112
105113 showNetworkCapabilities ()
106114
115+ // Handle privileges - most probably elevation will fail as the process would need to invoke fork()
107116 err = handlePrivileges (options )
108117 if err != nil {
109118 gologger .Warningf ("Could not set privileges:%s\n " , err )
0 commit comments