Ah, yes. Well, the crash is because you are not checking the return value of sniff_packet->GetLayer<IPLayer>(); which is probably a NULL pointer and you are dereferencing it later on the "cout" line. The return pointer is NULL because there is no IPLayer from libcrafter's points of view. Current libcrafter don't support decoding of packets on a interface in monitor mode :(. The reason is because there are a wireless_80211 and a snap_header which are not supported by libcrafter.
But there is a workaround because I did this on the past, although I can't find that code :-/. You should find the offset on the raw_payload where the IP layer begins and create another packet from that point and decoding with libcrafter. Your code will look like this :
#include <iostream>
#include <string>
#include <crafter.h>
/* Collapse namespaces */
using namespace std;
using namespace Crafter;
void PacketHandler(Packet* sniff_packet, void* user) {
cout << "packet found! - " << sniff_packet->GetSize() << endl;
cout << "beep" << endl;
/* .... You find here the offset to the IP layer ... */
int ip_offset = 32;
/* Get the raw data buffer */
const byte* read_data = sniff_packet->GetRawPtr();
size_t read_length = sniff_packet->GetSize();
/*
* Create a packet from the offset
*/
Packet ip_pck(read_data + ip_offset, read_length - ip_offset, IP::PROTO);
IP* ip_layer = ip_pck.GetLayer<IP>();
if(ip_layer) {