mirror of
https://github.com/egor-white/zaprett.git
synced 2026-01-21 01:59:42 +05:00
Compare commits
39 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b038b6c977 | ||
|
|
9fe7810374 | ||
|
|
93763862ad | ||
|
|
84389db3a0 | ||
|
|
fde07bae80 | ||
|
|
349e55a968 | ||
|
|
0b339eb2f9 | ||
|
|
86defa0cb3 | ||
|
|
54e0e421ec | ||
|
|
a473e5c64b | ||
|
|
d503b4229a | ||
|
|
a89008497f | ||
|
|
979c100259 | ||
|
|
725510bafb | ||
|
|
32b1bc9de9 | ||
|
|
0dabe2f4e7 | ||
|
|
634f9245b2 | ||
|
|
4526c6d313 | ||
|
|
cceed3a1d7 | ||
|
|
60f112656a | ||
|
|
389e350746 | ||
|
|
5d714e3591 | ||
|
|
8e399bc791 | ||
|
|
c38dff2ada | ||
|
|
d6ec35d1e2 | ||
|
|
f873420b6a | ||
|
|
e04c349383 | ||
|
|
b3828babe7 | ||
|
|
dabdd9adb1 | ||
|
|
4230027933 | ||
|
|
48672aa0c3 | ||
|
|
91a2990eb6 | ||
|
|
b12b6e1bb2 | ||
|
|
4cbda8bc52 | ||
|
|
5ddea2675f | ||
|
|
6b35a0673a | ||
|
|
59e7970bf2 | ||
|
|
18e1ad9ebd | ||
|
|
85a3f9321c |
29
.github/workflows/workflow.yml
vendored
29
.github/workflows/workflow.yml
vendored
@@ -42,15 +42,28 @@ jobs:
|
||||
|
||||
- name: Setup Git submodules
|
||||
run: git submodule update --init --recursive
|
||||
|
||||
|
||||
- name: Install dependencies
|
||||
run: sudo apt install build-essential pkg-config just unzip
|
||||
run: |
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt update
|
||||
sudo apt install -y build-essential pkg-config just unzip libc6-dev-i386 gcc-multilib
|
||||
|
||||
- name: Build zaprett
|
||||
run: just -f rust/justfile build-android --release
|
||||
|
||||
- name: Make build dirs
|
||||
run: mkdir -p zaprett/system/bin zaprett-hosts/system/bin zaprett/system/etc/zaprett/lists out lists zapret-hosts/system/etc/zaprett/lists
|
||||
run: |
|
||||
mkdir -p zaprett/system/bin
|
||||
mkdir -p zaprett/zaprett/bin
|
||||
mkdir -p zaprett/zaprett/lists/include
|
||||
|
||||
mkdir -p zaprett-hosts/system/bin
|
||||
mkdir -p zaprett-hosts/system/etc
|
||||
mkdir -p zaprett-hosts/zaprett/bin
|
||||
mkdir -p zaprett-hosts/zaprett/lists/include
|
||||
|
||||
mkdir -p out lists
|
||||
|
||||
- name: Copy files to dirs
|
||||
run: |
|
||||
@@ -60,17 +73,15 @@ jobs:
|
||||
|
||||
cp -a src/* zaprett/
|
||||
cp -r zaprett/* zaprett-hosts/
|
||||
|
||||
|
||||
- name: Download and copy actual lists
|
||||
run: |
|
||||
wget https://raw.githubusercontent.com/CherretGit/zaprett-repo/refs/heads/main/lists/include/list-youtube.txt -O lists/list-youtube.txt
|
||||
wget https://raw.githubusercontent.com/CherretGit/zaprett-repo/refs/heads/main/lists/include/list-discord.txt -O lists/list-discord.txt
|
||||
|
||||
cp lists/list-youtube.txt zaprett/system/etc/zaprett/lists/
|
||||
cp lists/list-youtube.txt zaprett-hosts/system/etc/zaprett/lists/
|
||||
cp lists/* zaprett/zaprett/lists/include
|
||||
|
||||
cp lists/list-discord.txt zaprett/system/etc/zaprett/lists/
|
||||
cp lists/list-discord.txt zaprett-hosts/system/etc/zaprett/lists/
|
||||
cp lists/* zaprett-hosts/zaprett/lists/include
|
||||
|
||||
cp hosts/hosts zaprett-hosts/system/etc
|
||||
|
||||
@@ -103,7 +114,7 @@ jobs:
|
||||
|
||||
mv zaprett.zip out/
|
||||
mv zaprett-hosts.zip out/
|
||||
|
||||
|
||||
- name: Create release
|
||||
if: ${{ inputs.create_release == 'true' }}
|
||||
uses: softprops/action-gh-release@v2
|
||||
|
||||
33
.github/workflows/workflow_without_post.yml
vendored
33
.github/workflows/workflow_without_post.yml
vendored
@@ -42,15 +42,28 @@ jobs:
|
||||
|
||||
- name: Setup Git submodules
|
||||
run: git submodule update --init --recursive
|
||||
|
||||
|
||||
- name: Install dependencies
|
||||
run: sudo apt install build-essential pkg-config just unzip
|
||||
run: |
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt update
|
||||
sudo apt install -y build-essential pkg-config just unzip libc6-dev-i386 gcc-multilib
|
||||
|
||||
- name: Build zaprett
|
||||
run: just -f rust/justfile build-android --release
|
||||
|
||||
- name: Make build dirs
|
||||
run: mkdir -p zaprett/system/bin zaprett-hosts/system/bin zaprett/system/etc/zaprett/lists out lists zapret-hosts/system/etc/zaprett/lists
|
||||
run: |
|
||||
mkdir -p zaprett/system/bin
|
||||
mkdir -p zaprett/zaprett/bin
|
||||
mkdir -p zaprett/zaprett/lists/include
|
||||
|
||||
mkdir -p zaprett-hosts/system/bin
|
||||
mkdir -p zaprett-hosts/system/etc
|
||||
mkdir -p zaprett-hosts/zaprett/bin
|
||||
mkdir -p zaprett-hosts/zaprett/lists/include
|
||||
|
||||
mkdir -p out lists
|
||||
|
||||
- name: Copy files to dirs
|
||||
run: |
|
||||
@@ -61,20 +74,19 @@ jobs:
|
||||
|
||||
cp -a src/* zaprett/
|
||||
cp -r zaprett/* zaprett-hosts/
|
||||
|
||||
|
||||
- name: Download and copy actual lists
|
||||
run: |
|
||||
wget https://raw.githubusercontent.com/CherretGit/zaprett-repo/refs/heads/main/lists/include/list-youtube.txt -O lists/list-youtube.txt
|
||||
wget https://raw.githubusercontent.com/CherretGit/zaprett-repo/refs/heads/main/lists/include/list-discord.txt -O lists/list-discord.txt
|
||||
|
||||
cp lists/list-youtube.txt zaprett/system/etc/zaprett/lists/
|
||||
cp lists/list-youtube.txt zaprett-hosts/system/etc/zaprett/lists/
|
||||
cp lists/* zaprett/zaprett/lists/include/
|
||||
|
||||
cp lists/list-discord.txt zaprett/system/etc/zaprett/lists/
|
||||
cp lists/list-discord.txt zaprett-hosts/system/etc/zaprett/lists/
|
||||
cp lists/* zaprett-hosts/zaprett/lists/include/
|
||||
|
||||
cp hosts/hosts zaprett-hosts/system/etc
|
||||
|
||||
|
||||
- name: Create module.prop
|
||||
run: |
|
||||
cat > zaprett/module.prop <<EOF
|
||||
@@ -104,7 +116,7 @@ jobs:
|
||||
|
||||
mv zaprett.zip out/
|
||||
mv zaprett-hosts.zip out/
|
||||
|
||||
|
||||
- name: Create release
|
||||
if: ${{ inputs.create_release == 'true' }}
|
||||
uses: softprops/action-gh-release@v2
|
||||
@@ -146,11 +158,10 @@ jobs:
|
||||
"changelog": "https://raw.githubusercontent.com/${{ github.repository }}/refs/heads/main/changelog.md"
|
||||
}
|
||||
EOF
|
||||
|
||||
|
||||
- name: Commit jsons and changelog
|
||||
if: ${{ inputs.create_release == 'true' }}
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "Update update's.json and changelog"
|
||||
file_pattern: "update.json update_hosts.json changelog.md"
|
||||
|
||||
|
||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +1,6 @@
|
||||
[submodule "rust/crates/libnfqws/zapret"]
|
||||
path = rust/crates/libnfqws/zapret
|
||||
url = https://github.com/bol-van/zapret.git
|
||||
[submodule "rust/crates/libnfqws2/zapret2"]
|
||||
path = rust/crates/libnfqws2/zapret2
|
||||
url = https://github.com/bol-van/zapret2
|
||||
|
||||
@@ -1 +1 @@
|
||||
Исправление ошибки запуска сервиса
|
||||
1. Исправление hosts версии 2. Обновление hosts файла
|
||||
|
||||
3774
hosts/hosts
3774
hosts/hosts
File diff suppressed because it is too large
Load Diff
11
rust/Cargo.lock
generated
11
rust/Cargo.lock
generated
@@ -385,6 +385,16 @@ dependencies = [
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libnfqws2"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
"cc",
|
||||
"glob",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.14"
|
||||
@@ -1113,6 +1123,7 @@ dependencies = [
|
||||
"getset",
|
||||
"libc",
|
||||
"libnfqws",
|
||||
"libnfqws2",
|
||||
"log",
|
||||
"nix",
|
||||
"pretty_env_logger",
|
||||
|
||||
Submodule rust/crates/libnfqws/zapret updated: 1408c38522...afce40981c
11
rust/crates/libnfqws2/Cargo.toml
Normal file
11
rust/crates/libnfqws2/Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "libnfqws2"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[build-dependencies]
|
||||
cc = "1.2.43"
|
||||
once_cell = "1.21.3"
|
||||
glob = "0.3.3"
|
||||
bindgen = "0.72.1"
|
||||
71
rust/crates/libnfqws2/build.rs
Normal file
71
rust/crates/libnfqws2/build.rs
Normal file
@@ -0,0 +1,71 @@
|
||||
use once_cell::sync::Lazy;
|
||||
use std::env;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
macro_rules! rel_manifest_path {
|
||||
($name:ident, $path:expr) => {
|
||||
static $name: Lazy<PathBuf> = Lazy::new(|| {
|
||||
let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
||||
Path::new(&manifest_dir).join($path)
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
rel_manifest_path!(NFQ, "zapret2/nfq2");
|
||||
rel_manifest_path!(NFQ_CRYPTO, "zapret2/nfq2/crypto");
|
||||
|
||||
fn main() {
|
||||
cc::Build::new()
|
||||
.files(
|
||||
glob::glob(&format!("{}/*.c", NFQ.display()))
|
||||
.unwrap()
|
||||
.filter_map(Result::ok),
|
||||
)
|
||||
.files(
|
||||
glob::glob(&format!("{}/*.c", NFQ_CRYPTO.display()))
|
||||
.unwrap()
|
||||
.filter_map(Result::ok),
|
||||
)
|
||||
.include(&*NFQ)
|
||||
.include(&*NFQ_CRYPTO)
|
||||
.flag("-w")
|
||||
.define("main", "nfqws2_main")
|
||||
.compile("libnfqws2.a");
|
||||
|
||||
println!("cargo:rustc-link-lib=z");
|
||||
println!("cargo:rustc-link-lib=netfilter_queue");
|
||||
println!("cargo:rustc-link-lib=nfnetlink");
|
||||
println!("cargo:rustc-link-lib=mnl");
|
||||
|
||||
let _ = env::var("NETFILTER_LIBS")
|
||||
.map(|libs| println!("cargo:rustc-link-search=native={libs}/lib"));
|
||||
|
||||
println!("cargo:rustc-link-lib=static=nfqws2");
|
||||
println!("cargo:rerun-if-changed={}", NFQ.display());
|
||||
println!("cargo:rerun-if-changed={}", NFQ_CRYPTO.display());
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
|
||||
let mut builder = bindgen::Builder::default();
|
||||
|
||||
for header in glob::glob(&format!("{}/*.h", NFQ.display()))
|
||||
.unwrap()
|
||||
.filter_map(Result::ok)
|
||||
{
|
||||
builder = builder.header(header.to_string_lossy());
|
||||
}
|
||||
if let Ok(luajit) = env::var("LUAJIT") {
|
||||
builder = builder
|
||||
.clang_arg(format!("-I{}", luajit))
|
||||
.clang_arg("-Dmain=nfqws2_main");
|
||||
}
|
||||
|
||||
let bindings = builder
|
||||
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
|
||||
.generate()
|
||||
.expect("Unable to generate libnfqws2");
|
||||
|
||||
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||
bindings
|
||||
.write_to_file(out_path.join("libnfqws2.rs"))
|
||||
.expect("Couldn't write libnfqws2");
|
||||
}
|
||||
2
rust/crates/libnfqws2/src/lib.rs
Normal file
2
rust/crates/libnfqws2/src/lib.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
#![allow(warnings)]
|
||||
include!(concat!(env!("OUT_DIR"), "/libnfqws2.rs"));
|
||||
1
rust/crates/libnfqws2/zapret2
Submodule
1
rust/crates/libnfqws2/zapret2
Submodule
Submodule rust/crates/libnfqws2/zapret2 added at 36ee42bc8c
@@ -15,6 +15,7 @@ serde_json = { workspace = true }
|
||||
sysctl ={ workspace = true }
|
||||
tokio = { workspace = true }
|
||||
libnfqws = { path = "../libnfqws" }
|
||||
libnfqws2 = { path = "../libnfqws2" }
|
||||
daemonize = { workspace = true }
|
||||
pretty_env_logger = { workspace = true }
|
||||
log = { workspace = true }
|
||||
|
||||
@@ -5,7 +5,7 @@ use commands::Command;
|
||||
use getset::Getters;
|
||||
|
||||
#[derive(Parser, Getters)]
|
||||
#[command(version)]
|
||||
// #[command(version)]
|
||||
#[getset(get = "pub")]
|
||||
pub struct CliApp {
|
||||
#[command(subcommand)]
|
||||
|
||||
@@ -2,7 +2,6 @@ use crate::autostart::{get_autostart, set_autostart};
|
||||
use crate::service::{restart_service, service_status, start_service, stop_service};
|
||||
use crate::{bin_version, module_version, run_nfqws};
|
||||
use clap::Subcommand;
|
||||
use log::error;
|
||||
|
||||
#[derive(Subcommand)]
|
||||
pub enum Command {
|
||||
@@ -40,11 +39,9 @@ pub enum Command {
|
||||
impl Command {
|
||||
pub async fn exec(&self) -> anyhow::Result<()> {
|
||||
match self {
|
||||
Command::Start => return start_service().await,
|
||||
Command::Stop => {
|
||||
let _ = stop_service().await;
|
||||
}
|
||||
Command::Restart => return restart_service().await,
|
||||
Command::Start => start_service().await?,
|
||||
Command::Stop => stop_service().await?,
|
||||
Command::Restart => restart_service().await?,
|
||||
Command::Status => {
|
||||
println!(
|
||||
"zaprett is {}",
|
||||
@@ -55,11 +52,7 @@ impl Command {
|
||||
}
|
||||
);
|
||||
}
|
||||
Command::SetAutostart => {
|
||||
if let Err(err) = set_autostart().await {
|
||||
error!("Failed to set auto start: {err}")
|
||||
}
|
||||
}
|
||||
Command::SetAutostart => set_autostart().await?,
|
||||
Command::GetAutostart => println!("{}", get_autostart()),
|
||||
Command::ModuleVersion => println!("{}", module_version().await?),
|
||||
Command::BinaryVersion => println!("{}", bin_version()),
|
||||
|
||||
@@ -90,7 +90,8 @@ pub async fn stop_service() -> anyhow::Result<()> {
|
||||
};
|
||||
|
||||
if !service_status().await? {
|
||||
bail!("zaprett service already stopped")
|
||||
info!("zaprett service already stopped");
|
||||
return Ok(())
|
||||
}
|
||||
|
||||
clear_iptables_rules().expect("clear iptables rules");
|
||||
|
||||
@@ -20,7 +20,7 @@ _download_android_ndk:
|
||||
|
||||
curl -L -C - -o "$TMPFILE" "https://dl.google.com/android/repository/android-ndk-{{ANDROID_NDK_VERSION}}.zip"
|
||||
|
||||
unzip "$TMPFILE" -d "$TMPDIR"
|
||||
unzip -q "$TMPFILE" -d "$TMPDIR"
|
||||
|
||||
inner_folder=$(find "$TMPDIR" -mindepth 1 -maxdepth 1 -type d | head -n 1)
|
||||
mv -T "$inner_folder" "$NDK_HOME"
|
||||
@@ -61,6 +61,32 @@ _build_netfilter_libs target_arch:
|
||||
patch -p1 -d libnetfilter_queue-* -i $PATCH
|
||||
fi
|
||||
|
||||
if [ ! -d "luajit2-*" ]; then
|
||||
wget -qO- https://github.com/openresty/luajit2/archive/refs/tags/v2.1-20250826.tar.gz | tar -xz
|
||||
fi
|
||||
|
||||
case "{{target_arch}}" in
|
||||
*64*)
|
||||
HOSTCC="cc"
|
||||
;;
|
||||
*)
|
||||
HOSTCC="cc -m32"
|
||||
esac
|
||||
|
||||
(
|
||||
cd luajit2-*
|
||||
make BUILDMODE=static XCFLAGS=-DLUAJIT_DISABLE_FFI \
|
||||
HOST_CC="$HOSTCC" CROSS= CC="$CC" \
|
||||
TARGET_AR="$AR rcus" TARGET_STRIP=$STRIP \
|
||||
CFLAGS="-Os -flto=auto $CFLAGS" -j$(nproc)
|
||||
|
||||
make install PREFIX= DESTDIR=$NETFILTER_LIBS-{{target_arch}}
|
||||
)
|
||||
|
||||
LJIT=1
|
||||
LCFLAGS="-I${NETFILTER_LIBS-{{target_arch}}}/include/luajit-2.1"
|
||||
LLIB="-L${NETFILTER_LIBS-{{target_arch}}}/lib -lluajit-2.1"
|
||||
|
||||
for i in libmnl libnfnetlink libnetfilter_queue ; do
|
||||
(
|
||||
cd $i-*
|
||||
@@ -98,9 +124,13 @@ build-android *args: prepare-android
|
||||
t=${targets[$i]}
|
||||
(
|
||||
echo "Building target $t"
|
||||
export CFLAGS="-I$NETFILTER_LIBS-$t/include"
|
||||
export CFLAGS="-I$NETFILTER_LIBS-$t/include -I$NETFILTER_LIBS-$t/include/luajit-2.1"
|
||||
export LUAJIT="$NETFILTER_LIBS-$t/include/luajit-2.1"
|
||||
export LDFLAGS="-L$NETFILTER_LIBS-$t/lib"
|
||||
export CXXFLAGS="$CFLAGS"
|
||||
export LJIT=1
|
||||
export LCFLAGS="-I$NETFILTER_LIBS-$t/include -I$NETFILTER_LIBS-$t/include/luajit-2.1"
|
||||
export LLIB="-L$NETFILTER_LIBS-$t/lib -lluajit-2.1"
|
||||
|
||||
just _build_netfilter_libs $t
|
||||
just _instal_rust_target $t
|
||||
|
||||
@@ -11,17 +11,11 @@ ui_print "Module by: egor-white, Cherret"
|
||||
ui_print "App by: egor-white, Cherret"
|
||||
ui_print "####################"
|
||||
|
||||
ui_print "Unpacking archive..."
|
||||
unzip -o "$ZIPFILE" -x 'META-INF/*' -d $MODPATH >&2
|
||||
|
||||
ui_print "Creating zaprett directory..."
|
||||
mkdir /sdcard/zaprett; mkdir /sdcard/zaprett/lists; mkdir /sdcard/zaprett/bin; mkdir /sdcard/zaprett/strategies;
|
||||
|
||||
ui_print "Copying lists and binaries to /sdcard/zaprett..."
|
||||
cp -r $MODPATH/system/etc/zaprett/. /sdcard/zaprett/
|
||||
|
||||
ui_print "Remove exiting config.json"
|
||||
rm /sdcard/zaprett/config.json
|
||||
cp -r $MODPATH/zaprett/. /sdcard/zaprett/
|
||||
|
||||
ui_print "Copying files to /bin"
|
||||
arch=$(uname -m)
|
||||
@@ -44,10 +38,7 @@ mv $MODPATH/system/bin/$zaprett_bin $MODPATH/system/bin/zaprett
|
||||
rm $MODPATH/system/bin/zaprett-*
|
||||
mkdir $MODPATH/tmp
|
||||
|
||||
ui_print "Setting permissions..."
|
||||
chmod 777 /sdcard/zaprett; chmod 777 $MODPATH/service.sh
|
||||
|
||||
ui_print "Cleaning temp files..."
|
||||
rm -rf $MODPATH/system/etc/zaprett
|
||||
rm -rf $MODPATH/zaprett
|
||||
|
||||
ui_print "Installation done. Join us in Telegram: https://t.me/zaprett_module"
|
||||
|
||||
BIN
src/zaprett/bin/tls_clienthello_4pda_to.bin
Normal file
BIN
src/zaprett/bin/tls_clienthello_4pda_to.bin
Normal file
Binary file not shown.
BIN
src/zaprett/bin/tls_clienthello_max_ru.bin
Normal file
BIN
src/zaprett/bin/tls_clienthello_max_ru.bin
Normal file
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"version": "6.1",
|
||||
"versionCode": 61,
|
||||
"zipUrl": "https://github.com/egor-white/zaprett/releases/download/6.0.0/zaprett-hosts.zip",
|
||||
"version": "6.5",
|
||||
"versionCode": 65,
|
||||
"zipUrl": "https://github.com/egor-white/zaprett/releases/download/6.5.0/zaprett-hosts.zip",
|
||||
"changelog": "https://raw.githubusercontent.com/egor-white/zaprett/refs/heads/main/changelog.md"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"version": "6.0",
|
||||
"versionCode": 60,
|
||||
"zipUrl": "https://github.com/egor-white/zaprett/releases/download/6.0.0/zaprett.zip",
|
||||
"version": "6.4",
|
||||
"versionCode": 100,
|
||||
"zipUrl": "https://github.com/egor-white/zaprett/releases/download/6.4.0/zaprett.zip",
|
||||
"changelog": "https://raw.githubusercontent.com/egor-white/zaprett/refs/heads/main/changelog.md"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"version": "6.1",
|
||||
"versionCode": 61,
|
||||
"zipUrl": "https://github.com/egor-white/zaprett/releases/download/6.0.0/zaprett.zip",
|
||||
"version": "6.5",
|
||||
"versionCode": 65,
|
||||
"zipUrl": "https://github.com/egor-white/zaprett/releases/download/6.5.0/zaprett.zip",
|
||||
"changelog": "https://raw.githubusercontent.com/egor-white/zaprett/refs/heads/main/changelog.md"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user