This commit is contained in:
Andrea Bontempi 2012-09-04 13:37:00 +02:00
parent 5bfe3de639
commit 130044b7d3
2 changed files with 14 additions and 6 deletions

View file

@ -46,7 +46,7 @@ int main ( int argc, char **argv ) {
desc.add_options()
( "help,h", "prints this" )
( "list,l", "list the available protocols.")
( "filters,f", value< vector<string> >(), "specifies a list of protocols." )
( "filters,f", value< vector<string> >()->multitoken(), "specifies a list of protocols." )
;
positional_options_description p;

View file

@ -48,10 +48,10 @@ int main ( int argc, char **argv ) {
desc.add_options()
( "help,h", "prints this" )
( "dump,d", "enable dump mode" )
( "iface,i", value<string>(), "interface to sniff from (not set = default device)" )
( "input,I", value<string>(), "reads packets from a pcap file (disable iface input)" )
( "filter,f", value<string>(), "use to filter packet with bpf" )
( "limit,l", value<int>(), "set max number of packet" )
( "iface,i", value< string >(), "interface to sniff from (not set = default device)" )
( "input,I", value< string >(), "reads packets from a pcap file (disable iface input)" )
( "filter,f", value< vector< string > >()->multitoken(), "use to filter packet with bpf" )
( "limit,l", value< int >(), "set max number of packet" )
#ifdef __linux__
( "secure,s", "Drop root privileges after initialization." )
#endif
@ -144,7 +144,15 @@ int main ( int argc, char **argv ) {
#endif
if ( vm.count ( "filter" ) ) {
string filter = vm["filter"].as<string>();
vector < string > filterraw = vm["filter"].as< vector < string > >();
string filter;
for ( int i = 0; i < filterraw.size(); i++ ) {
filter.append(filterraw[i]);
if( i != filterraw.size() - 1 ) filter.append(" ");
}
struct bpf_program fp;
bpf_u_int32 net;