연구용으로 Mac에서 모니터 모드로 패킷을 캡처하려고합니다. 이러한 패킷에서 나는 특별한 정보가 필요하다. rssi. 불행히도, linktype DLT_IEEE802_11_RADIO 말합니다,하지만 실제로 DLT_PRISM_HEADER 기대, 모니터 모드를 켜야하기 때문에. 이것은 radiotap 헤더가 RSSI 값이나 내가 필요한 다른 것들을 제공하지 않기 때문에 문제가된다.mac osx prism header pcap
int main(int argc, char *argv[])
{
pcap_t *handle; /* Session handle */
char *dev; /* The device to sniff on */
char errbuf[PCAP_ERRBUF_SIZE]; /* Error string */
struct pcap_pkthdr header; /* The header that pcap gives us */
const u_char *packet; /* The actual packet */
struct ether_header *ether; /* net/ethernet.h */
/* Define the device */
dev = pcap_lookupdev(errbuf);
if(dev == NULL) {
printf("Couldn't find default device: %s\n", errbuf);
exit(EXIT_FAILURE);
}
printf("Device: %s\n", dev);
//handle = pcap_open_live(dev, 1562, 1, 500, errbuf);
handle = pcap_create(dev, errbuf);
if(handle == NULL) {
printf("pcap_create failed: %s\n", errbuf);
exit(EXIT_FAILURE);
}
/* set monitor mode on */
if(pcap_set_rfmon(handle, 1) != 0) {
printf("monitor mode not available\n");
exit(EXIT_FAILURE);
}
pcap_set_snaplen(handle, 2048); // Set the snapshot length to 2048
pcap_set_promisc(handle, 1); // Turn promiscuous mode on
pcap_set_timeout(handle, 512); // Set the timeout to 512 milliseconds
int status = pcap_activate(handle);
if(status != 0) {
printf("activation failed: %d\n", status);
}
printf("link-type: %s\n", pcap_datalink_val_to_name(pcap_datalink(handle)));
int loop = pcap_loop(handle, 1, process_packet, NULL);
if(loop != 0) {
printf("loop terminated before exhaustion: %d\n", loop);
}
/* And close the session */
pcap_close(handle);
return(0);
}
그래서 아무도 알고 있지, 왜 내가 radiotap하지 프리즘 내가 대신 할 방법을 수신하고 있습니다 : 여기
(나는 등 콜백 방법을두고) 내 코드? 다시 OSX에서 코딩하고 있습니다.
감사합니다. PPI 프레임 형식을 사용하여 도움을 받았습니다. – Cravid