diff --git a/README.md b/README.md index 9955ad7..24c4463 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ This project depends on [pcap](https://github.com/the-tcpdump-group/libpcap), cm You can also add cmake option `-DUSE_SYSTEM_PCAP=OFF` to compile pcap from source (can be used when cross-compiling). ```shell -# native build (macOS, Linux, mingw) +# native build (macOS, Linux) cmake -B build cmake --build build pppwn @@ -50,7 +50,7 @@ cmake --build build pppwn # cross compile for Windows # https://npcap.com/dist/npcap-sdk-1.13.zip -cmake -B build -DZIG_TARGET=x86_64-windows-gnu -DUSE_SYSTEM_PCAP=OFF -DPacket_ROOT= +cmake -B build -DZIG_TARGET=x86_64-windows-gnu -DPCAP_ROOT= cmake --build build pppwn ``` diff --git a/include/defines.h b/include/defines.h index c7dd2e1..6fa536c 100644 --- a/include/defines.h +++ b/include/defines.h @@ -43,10 +43,14 @@ #define CR0_ORI CR0_PG | CR0_AM | CR0_WP | CR0_NE | CR0_ET | CR0_TS | CR0_MP | CR0_PE +#undef VM_PROT_READ #define VM_PROT_READ 0x01 +#undef VM_PROT_WRITE #define VM_PROT_WRITE 0x02 +#undef VM_PROT_EXECUTE #define VM_PROT_EXECUTE 0x04 +#undef VM_PROT_ALL #define VM_PROT_ALL (VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE) #define LLE_STATIC 0x0002 diff --git a/src/main.cpp b/src/main.cpp index 3a845d9..0b86a43 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,6 +5,9 @@ #include #include #include +#if defined(__APPLE__) +#include +#endif #include "exploit.h" @@ -57,8 +60,8 @@ std::vector readBinary(const std::string &filename) { } int startExploit(const std::string &interface, enum FirmwareVersion fw, - const std::string &stage1, const std::string &stage2, - bool retry) { + const std::string &stage1, const std::string &stage2, + bool retry) { Exploit exploit; if (exploit.setFirmwareVersion(fw)) cleanup(1); if (exploit.setInterface(interface)) cleanup(1); @@ -74,10 +77,36 @@ int startExploit(const std::string &interface, enum FirmwareVersion fw, void listInterfaces() { std::cout << "[+] interfaces: " << std::endl; +#if defined(__APPLE__) + CFArrayRef interfaces = SCNetworkInterfaceCopyAll(); + if (!interfaces) { + std::cerr << "[-] Failed to get interfaces" << std::endl; + exit(1); + } + CFIndex serviceCount = CFArrayGetCount(interfaces); + char buffer[1024]; + for (CFIndex i = 0; i < serviceCount; ++i) { + auto interface = (SCNetworkInterfaceRef) CFArrayGetValueAtIndex(interfaces, i); + auto serviceName = SCNetworkInterfaceGetLocalizedDisplayName(interface); + auto bsdName = SCNetworkInterfaceGetBSDName(interface); + if (bsdName) { + CFStringGetCString(bsdName, buffer, sizeof(buffer), kCFStringEncodingUTF8); + printf("\t%s ", buffer); + if (serviceName) { + CFStringGetCString(serviceName, buffer, sizeof(buffer), kCFStringEncodingUTF8); + printf("%s", buffer); + } + printf("\n"); + } + } + CFRelease(interfaces); +#else std::vector devList = pcpp::PcapLiveDeviceList::getInstance().getPcapLiveDevicesList(); for (pcpp::PcapLiveDevice *dev: devList) { + if (dev->getLoopback()) continue; std::cout << "\t" << dev->getName() << " " << dev->getDesc() << std::endl; } +#endif exit(0); }