Skip to content

Commit

Permalink
Add end2end test
Browse files Browse the repository at this point in the history
  • Loading branch information
fedebuonco committed Jun 15, 2024
1 parent 244106a commit 15d9ce2
Show file tree
Hide file tree
Showing 10 changed files with 270 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[target.aarch64-apple-darwin]
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/target
.venv
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "end2end/PPPwn"]
path = end2end/PPPwn
url = https://github.com/fedebuonco/PPPwn.git
234 changes: 222 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
[package]
name = "yappwn"
name = "yapppwn"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
pcap = "2.0.0"
pyo3 = { version = "0.21.2", features = ["extension-module"] }


[lib]
name = "py_yapppwn"
# "cdylib" is necessary to produce a shared library for Python to import from.
crate-type = ["cdylib"]
path = "src/py_yapppwn.rs"

[[bin]]
name = "yapppwn"
path = "src/main.rs"
Binary file added end2end/.DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions end2end/PPPwn
Submodule PPPwn added at fe8043
2 changes: 1 addition & 1 deletion src/exploit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ fn extract_ps4_source_mac(packet: &Packet) -> Result<MacAddress64, Box<dyn std::

Ok(MacAddress64(mac_address))
}
fn build_fake_ifnet(pppoe_softc: u64) -> Vec<u8> {
pub fn build_fake_ifnet(pppoe_softc: u64) -> Vec<u8> {
// Fake ifnet
let mut fake_ifnet = vec![0x41; 0x48]; // Fill with 'A' initially
fake_ifnet.extend(&constants::ZERO.to_le_bytes()); // if_addrhead
Expand Down
20 changes: 20 additions & 0 deletions src/py_yapppwn.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
mod constants;
mod exploit;
mod macaddress;
use crate::exploit::build_fake_ifnet;
use macaddress::MacAddress64;
use pcap::Device;

use pyo3::prelude::*;
use pyo3::wrap_pyfunction;

#[pyfunction]
fn py_build_fake_ifnet(pppoe_softc: u64) -> PyResult<Vec<u8>> {
Ok(build_fake_ifnet(pppoe_softc))
}

#[pymodule]
fn py_yapppwn(_py: Python, m: &PyModule) -> PyResult<()> {
m.add_function(wrap_pyfunction!(py_build_fake_ifnet, m)?)?;
Ok(())
}
4 changes: 4 additions & 0 deletions src/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import py_yapppwn

result = py_yapppwn.py_build_fake_ifnet(1)
print(result)

0 comments on commit 15d9ce2

Please sign in to comment.