Skip to content

Commit

Permalink
Remove warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
fedebuonco committed Oct 10, 2024
1 parent 5de67ba commit b2e07a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
7 changes: 0 additions & 7 deletions src/constants.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;

Expand Down
23 changes: 7 additions & 16 deletions src/exploit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Vec<u8>> = listen_for_packet(rx.as_mut(), is_ipcp_conf_req);
let _result: Option<Vec<u8>> = listen_for_packet(rx.as_mut(), is_ipcp_conf_req);
// let options: Vec<u8> = Vec::from(&result.unwrap()[26..42]);
// send conf ack
println!("[*] Sending IPCP configure ACK...");
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit b2e07a6

Please sign in to comment.