diff options
-rw-r--r-- | CMakeLists.txt | 14 | ||||
-rw-r--r-- | README.md | 12 | ||||
-rw-r--r-- | main.cpp | 8 |
3 files changed, 30 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 9712cca..ba802f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,21 @@ cmake_minimum_required(VERSION 3.6) -project(wifi_triangulator) +include(CheckIncludeFiles) +include(CheckLibraryExists) +project(wifi-triangulator) set(CMAKE_CXX_STANDARD 14) +check_include_files("pcap.h" HAVE_PCAP_H) + +if(NOT HAVE_PCAP_H) + message(FATAL_ERROR "Missing pcap.h. You should probably install libpcap-dev or similar.") +endif() + set(SOURCE_FILES main.cpp third-party/radiotap-library/radiotap.c third-party/radiotap-library/radiotap.h third-party/radiotap-library/radiotap_iter.h third-party/radiotap-library/platform.h) -add_executable(wifi_triangulator ${SOURCE_FILES}) +add_executable(wifi-triangulator ${SOURCE_FILES}) -target_link_libraries(wifi_triangulator PUBLIC pcap) +target_link_libraries(wifi-triangulator PUBLIC pcap) diff --git a/README.md b/README.md new file mode 100644 index 0000000..8d94a33 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# Building + + mkdir build + cd build + cmake .. + make + +# Running + + sudo ifconfig wlan0 down + sudo iwconfig wlan0 mode monitor + sudo build/wifi-triangulator wlan0 @@ -327,9 +327,15 @@ void got_packet(u_char *args, const struct pcap_pkthdr *header, const u_char *pa } int main(int argc, char *argv[]) { - char *dev = argv[1]; char errbuf[1000]; + if (argc != 2) { + fprintf(stderr, "usage: %s [interface]\n", argv[0]); + return EXIT_FAILURE; + } + + char *dev = argv[1]; + pcap_t *handle; handle = pcap_open_live(dev, BUFSIZ, 1, 1000, errbuf); |