Mini fix
This commit is contained in:
parent
016ea27607
commit
73922127f6
1 changed files with 5 additions and 5 deletions
10
Riddle.cpp
10
Riddle.cpp
|
@ -148,15 +148,15 @@ int main ( int argc, char **argv ) {
|
||||||
struct bpf_program fp;
|
struct bpf_program fp;
|
||||||
bpf_u_int32 net;
|
bpf_u_int32 net;
|
||||||
|
|
||||||
cerr<<">> Filtering with '"<<filter<<"'"<<endl;
|
cerr << ">> Filtering with '" << filter << "'" << endl;
|
||||||
|
|
||||||
if ( pcap_compile ( pcap_handle, &fp, filter.c_str(), 0, net ) == -1 ) {
|
if ( pcap_compile ( pcap_handle, &fp, filter.c_str(), 0, net ) == -1 ) {
|
||||||
cerr<< "ERROR >> Couldn't parse filter '"<<filter<<"': "<<pcap_geterr ( pcap_handle ) <<endl;
|
cerr << "ERROR >> Couldn't parse filter '" << filter << "': "<< pcap_geterr ( pcap_handle ) << endl;
|
||||||
return ( 2 );
|
return ( 2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pcap_setfilter ( pcap_handle, &fp ) == -1 ) {
|
if ( pcap_setfilter ( pcap_handle, &fp ) == -1 ) {
|
||||||
cerr<< "ERROR >> Couldn't install filter '"<<filter<<"': "<<pcap_geterr ( pcap_handle ) <<endl;
|
cerr << "ERROR >> Couldn't install filter '" << filter << "': "<<pcap_geterr ( pcap_handle ) << endl;
|
||||||
return ( 2 );
|
return ( 2 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -177,14 +177,14 @@ int main ( int argc, char **argv ) {
|
||||||
for ( ; maxpacket > 0; ) {
|
for ( ; maxpacket > 0; ) {
|
||||||
packet = pcap_next ( pcap_handle, &header );
|
packet = pcap_next ( pcap_handle, &header );
|
||||||
if ( packet == NULL ) {
|
if ( packet == NULL ) {
|
||||||
cerr<<">> Flow terminated"<<endl;
|
cerr << ">> Flow terminated" << endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
dumper ( packet, header );
|
dumper ( packet, header );
|
||||||
if ( maxpacket!=numeric_limits<int>::max() ) maxpacket--;
|
if ( maxpacket!=numeric_limits<int>::max() ) maxpacket--;
|
||||||
}
|
}
|
||||||
|
|
||||||
cerr<<">> I finished the job, goodbye!"<<endl;
|
cerr << ">> I finished the job, goodbye!" << endl;
|
||||||
pcap_close ( pcap_handle );
|
pcap_close ( pcap_handle );
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue