diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index b57b257..2c12090 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -15,7 +15,7 @@
FROM rust:1-alpine
-RUN apk add bash docker git cmake make automake musl-dev \
+RUN apk add bash docker git cmake make automake musl-dev autoconf libtool \
flex bison linux-headers openssl-dev apache2-utils docker-compose && \
mkdir /etc/docker && \
echo '{ "storage-driver": "vfs" }' > /etc/docker/daemon.json
\ No newline at end of file
diff --git a/.gitmodules b/.gitmodules
index 26e9998..490f35b 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,6 @@
[submodule "pcap-sys/libpcap"]
path = pcap-sys/libpcap
url = https://github.com/the-tcpdump-group/libpcap
+[submodule "nl-sys/libnl"]
+ path = nl-sys/libnl
+ url = https://github.com/thom311/libnl
diff --git a/Cargo.lock b/Cargo.lock
index be5a701..5abce7f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -25,6 +25,15 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
+[[package]]
+name = "autotools"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "aef8da1805e028a172334c3b680f93e71126f2327622faef2ec3d893c0a4ad77"
+dependencies = [
+ "cc",
+]
+
[[package]]
name = "beacon"
version = "0.1.0"
@@ -363,6 +372,7 @@ dependencies = [
name = "nl-sys"
version = "0.1.0"
dependencies = [
+ "autotools",
"libc",
]
diff --git a/Cargo.toml b/Cargo.toml
index 1398d40..4b48f8d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,5 @@
[workspace]
-members = ["pcap-sys", "examples/bind-shell/*", "examples/reverse-shell/*", "nl-sys"]
+members = ["pcap-sys", "nl-sys", "examples/*/*"]
[profile.release]
strip = true
diff --git a/nl-sys/Cargo.toml b/nl-sys/Cargo.toml
index 3b88df7..42fb58c 100644
--- a/nl-sys/Cargo.toml
+++ b/nl-sys/Cargo.toml
@@ -6,4 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-libc = "0.2.142"
\ No newline at end of file
+libc = "0.2.142"
+
+[build-dependencies]
+autotools = "0.2"
\ No newline at end of file
diff --git a/nl-sys/build.rs b/nl-sys/build.rs
new file mode 100644
index 0000000..67d4255
--- /dev/null
+++ b/nl-sys/build.rs
@@ -0,0 +1,24 @@
+// Copyright (C) 2023 Andrew Rioux
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+fn main() {
+ let dst = autotools::Config::new("libnl")
+ .reconf("-vi")
+ .build();
+
+ println!("cargo:rustc-link-search=native={}/lib", dst.display());
+ println!("cargo:rustc-link-lib=static=nl-3");
+ println!("cargo:rustc-link-lib=static=nl-route-3");
+}
\ No newline at end of file
diff --git a/nl-sys/libnl b/nl-sys/libnl
new file mode 160000
index 0000000..cbafad9
--- /dev/null
+++ b/nl-sys/libnl
@@ -0,0 +1 @@
+Subproject commit cbafad9ddf24caef5230fef715d34f0539603be0
diff --git a/nl-sys/src/lib.rs b/nl-sys/src/lib.rs
deleted file mode 100644
index 7d12d9a..0000000
--- a/nl-sys/src/lib.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-pub fn add(left: usize, right: usize) -> usize {
- left + right
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
-
- #[test]
- fn it_works() {
- let result = add(2, 2);
- assert_eq!(result, 4);
- }
-}
diff --git a/nl-sys/src/main.rs b/nl-sys/src/main.rs
new file mode 100644
index 0000000..60594ec
--- /dev/null
+++ b/nl-sys/src/main.rs
@@ -0,0 +1,24 @@
+// Copyright (C) 2023 Andrew Rioux
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+enum nl_sock {}
+
+extern {
+ fn nl_socket_alloc() -> nl_sock;
+}
+
+fn main() {
+ unsafe { nl_socket_alloc(); }
+}
\ No newline at end of file