Update 24/11/2011 09:33

This commit is contained in:
Andrea Bontempi 2011-11-24 09:33:21 +01:00
commit 931c01b1a8
2 changed files with 16 additions and 8 deletions

View file

@ -23,6 +23,7 @@ int main(int argc, char **argv) {
options_description desc("Cigarette - Network Packet Parser");
desc.add_options()
("help", "prints this")
("dump", "enable dump mode")
("ipv4", "show only IPv4 Packets")
("ipv6", "show only IPv6 Packets")
("arp", "show only ARP Packets")
@ -59,14 +60,21 @@ int main(int argc, char **argv) {
if(flag)
{
cout<<"---- Packet ("<<dec<<line.length()<<" byte)"<<endl;
cout<<"EtherAddr | "<<etherhead.mac_src<<" --> "<<etherhead.mac_dst<<endl;
cout<<"EtherType | 0x"<<hex<<etherhead.ether_type<<" ("<<ether_type_decode(etherhead.ether_type)<<")"<<endl;
if(etherhead.ether_type == ETHER_TYPE_ARP)
if(vm.count("dump"))
{
arphead = parseArp(line);
cout<<"ARP | "<<arphead.mac_src<<" ("<<arphead.ip_src<<") --> "<<arphead.mac_dst<<" ("<<arphead.ip_dst<<")"<<endl;
cout<<"---- Packet ("<<dec<<line.length()<<" byte)"<<endl;
cout<<"EtherAddr | "<<etherhead.mac_src<<" --> "<<etherhead.mac_dst<<endl;
cout<<"EtherType | 0x"<<hex<<etherhead.ether_type<<" ("<<ether_type_decode(etherhead.ether_type)<<")"<<endl;
if(etherhead.ether_type == ETHER_TYPE_ARP)
{
arphead = parseArp(line);
cout<<"ARP | "<<arphead.mac_src<<" ("<<arphead.ip_src<<") --> "<<arphead.mac_dst<<" ("<<arphead.ip_dst<<")"<<endl;
}
}
else
{
cout<<line;
}
cout<<endl;

View file

@ -57,7 +57,7 @@ int main(int argc, char **argv) {
pcap_t *pcap_handle;
// Apre il device in modalità promiscua
// Apre il device in mod promiscua
pcap_handle = pcap_open_live(pcap_device.c_str(), 4096, 1, 0, error_buffer);
if(pcap_handle == NULL){
pcap_fatal("pcap_open_live", error_buffer);