mirror of
https://github.com/hufrea/byedpi.git
synced 2025-01-10 16:17:47 +00:00
Added initial CMake support (including ZIP packing, NSIS and DEB setup building).
This commit is contained in:
parent
00219bd6ac
commit
4920f676a7
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
.vscode
|
||||
ciadpi.exe
|
||||
ciadpi.exe
|
||||
build
|
99
CMakeLists.txt
Normal file
99
CMakeLists.txt
Normal file
@ -0,0 +1,99 @@
|
||||
cmake_minimum_required( VERSION 3.5 )
|
||||
|
||||
project( ByeDPI
|
||||
VERSION 12
|
||||
DESCRIPTION "Local SOCKS proxy server to bypass DPI (Deep Packet Inspection)."
|
||||
HOMEPAGE_URL "https://github.com/hufrea/byedpi"
|
||||
LANGUAGES C
|
||||
)
|
||||
|
||||
set( PROJECT_VENDOR "GitHub" )
|
||||
|
||||
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY "$<CONFIG>" )
|
||||
|
||||
add_compile_options( -O3 -flto -D_XOPEN_SOURCE=500 )
|
||||
add_link_options( -s )
|
||||
|
||||
include_directories( . )
|
||||
|
||||
set( SOURCES
|
||||
packets.c
|
||||
main.c
|
||||
conev.c
|
||||
proxy.c
|
||||
desync.c
|
||||
mpool.c
|
||||
extend.c
|
||||
)
|
||||
|
||||
if( WIN32 )
|
||||
list( APPEND SOURCES
|
||||
win_service.c
|
||||
)
|
||||
link_libraries(
|
||||
ws2_32
|
||||
mswsock
|
||||
)
|
||||
endif()
|
||||
|
||||
add_executable( ciadpi ${SOURCES} )
|
||||
|
||||
# Installer
|
||||
set( CPACK_VERBATIM_VARIABLES ON )
|
||||
set( CPACK_STRIP_FILES ON )
|
||||
set( CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF )
|
||||
set( CPACK_PACKAGE_NAME ${PROJECT_NAME} )
|
||||
set( CPACK_PACKAGE_VENDOR ${PROJECT_VENDOR} )
|
||||
set( CPACK_PACKAGE_DESCRIPTION_SUMMARY ${PROJECT_NAME} )
|
||||
set( CPACK_PACKAGE_DESCRIPTION ${PROJECT_DESCRIPTION} )
|
||||
set( CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME} )
|
||||
set( CPACK_PACKAGE_CONTACT ${PROJECT_VENDOR} )
|
||||
include( GNUInstallDirs )
|
||||
|
||||
if( WIN32 )
|
||||
# NSIS package - https://sourceforge.net/projects/nsis/
|
||||
list( APPEND CPACK_GENERATOR NSIS )
|
||||
set( CPACK_NSIS_MENU_LINKS
|
||||
"readme.txt" "Read Me"
|
||||
"byedpi.bat" "Run standalone"
|
||||
"proxy_reset.bat" "Proxy reset"
|
||||
"proxy_set.bat" "Proxy setup"
|
||||
"service_delete.bat" "Service delete"
|
||||
"service_install.bat" "Service install and run"
|
||||
"service_restart.bat" "Service restart"
|
||||
)
|
||||
set( CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS "ExecWait \"sc stop ${PROJECT_NAME}\"" )
|
||||
set( CPACK_NSIS_EXTRA_INSTALL_COMMANDS "ExecWait \"$INSTDIR\\service_install.bat\"" )
|
||||
set( CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "ExecWait \"$INSTDIR\\service_delete.bat\"" )
|
||||
set( CMAKE_INSTALL_BINDIR . )
|
||||
set( CMAKE_INSTALL_DOCDIR . )
|
||||
else()
|
||||
# Debian package
|
||||
list( APPEND CPACK_GENERATOR DEB )
|
||||
endif()
|
||||
|
||||
# Zip package
|
||||
list( APPEND CPACK_GENERATOR ZIP )
|
||||
|
||||
include( CPack )
|
||||
|
||||
install( TARGETS ciadpi
|
||||
RUNTIME
|
||||
)
|
||||
|
||||
install( FILES
|
||||
readme.txt
|
||||
TYPE DOC
|
||||
)
|
||||
|
||||
if( WIN32 )
|
||||
install( FILES
|
||||
dist/windows/byedpi.bat
|
||||
dist/windows/proxy_reset.bat
|
||||
dist/windows/proxy_set.bat
|
||||
dist/windows/service_delete.bat
|
||||
dist/windows/service_install.bat
|
||||
dist/windows/service_restart.bat
|
||||
TYPE BIN
|
||||
)
|
||||
endif()
|
2
dist/windows/byedpi.bat
vendored
2
dist/windows/byedpi.bat
vendored
@ -1,4 +1,4 @@
|
||||
@echo off
|
||||
title ByeDPI
|
||||
|
||||
ciadpi.exe --split 1+s --disorder 3+s --mod-http=h,d --auto --tlsrec 1+s
|
||||
"%~dp0ciadpi.exe" --ip 127.0.0.1 --split 1+s --disorder 3+s --mod-http=h,d --auto --tlsrec 1+s
|
13
dist/windows/proxy_reset.bat
vendored
Normal file
13
dist/windows/proxy_reset.bat
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
@echo off
|
||||
|
||||
rem Run as administrator
|
||||
reg query "HKU\S-1-5-19\Environment" >nul 2>&1
|
||||
if not %errorlevel% equ 0 (
|
||||
powershell.exe -windowstyle hidden -noprofile "Start-Process '%~dpnx0' -Verb RunAs"
|
||||
exit /b 0
|
||||
)
|
||||
|
||||
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v "ProxyEnable" /f
|
||||
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v "ProxyServer" /f
|
||||
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v "MigrateProxy" /f
|
||||
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v "AutoDetect" /f
|
13
dist/windows/proxy_set.bat
vendored
Normal file
13
dist/windows/proxy_set.bat
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
@echo off
|
||||
|
||||
rem Run as administrator
|
||||
reg query "HKU\S-1-5-19\Environment" >nul 2>&1
|
||||
if not %errorlevel% equ 0 (
|
||||
powershell.exe -windowstyle hidden -noprofile "Start-Process '%~dpnx0' -Verb RunAs"
|
||||
exit /b 0
|
||||
)
|
||||
|
||||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v "ProxyEnable" /t REG_DWORD /d 1 /f
|
||||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v "ProxyServer" /t REG_SZ /d "socks=127.0.0.1:1080" /f
|
||||
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v "MigrateProxy" /f
|
||||
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v "AutoDetect" /f
|
13
dist/windows/service_delete.bat
vendored
13
dist/windows/service_delete.bat
vendored
@ -1,13 +1,16 @@
|
||||
@echo off
|
||||
title ByeDPI - Delete Service
|
||||
|
||||
echo This script should be run with administrator privileges.
|
||||
echo Right click - run as administrator.
|
||||
echo Press any key if you're running it as administrator.
|
||||
pause
|
||||
rem Run as administrator
|
||||
reg query "HKU\S-1-5-19\Environment" >nul 2>&1
|
||||
if not %errorlevel% equ 0 (
|
||||
powershell.exe -windowstyle hidden -noprofile "Start-Process '%~dpnx0' -Verb RunAs"
|
||||
exit /b 0
|
||||
)
|
||||
|
||||
set svc_name="ByeDPI"
|
||||
|
||||
sc stop %svc_name%
|
||||
sc delete %svc_name%
|
||||
pause
|
||||
|
||||
call "%~dp0proxy_reset.bat"
|
17
dist/windows/service_install.bat
vendored
17
dist/windows/service_install.bat
vendored
@ -1,17 +1,17 @@
|
||||
@echo off
|
||||
title ByeDPI - Install Service
|
||||
pushd "%~dp0"
|
||||
|
||||
echo This script should be run with administrator privileges.
|
||||
echo Right click - run as administrator.
|
||||
echo Press any key if you're running it as administrator.
|
||||
pause
|
||||
rem Run as administrator
|
||||
reg query "HKU\S-1-5-19\Environment" >nul 2>&1
|
||||
if not %errorlevel% equ 0 (
|
||||
powershell.exe -windowstyle hidden -noprofile "Start-Process '%~dpnx0' -Verb RunAs"
|
||||
exit /b 0
|
||||
)
|
||||
|
||||
set svc_name="ByeDPI"
|
||||
set svc_desc="Local SOCKS proxy server to bypass DPI (Deep Packet Inspection)."
|
||||
|
||||
:: Set up launch args (bypass methods) here.
|
||||
set svc_bin="\"%cd%\ciadpi.exe\" --split 1+s --disorder 3+s --mod-http=h,d --auto --tlsrec 1+s"
|
||||
set svc_bin="\"%~dp0ciadpi.exe\" --ip 127.0.0.1 --split 1+s --disorder 3+s --mod-http=h,d --auto --tlsrec 1+s"
|
||||
|
||||
sc stop %svc_name%
|
||||
sc delete %svc_name%
|
||||
@ -19,5 +19,4 @@ sc create %svc_name% binPath= %svc_bin% start= "auto"
|
||||
sc description %svc_name% %svc_desc%
|
||||
sc start %svc_name%
|
||||
|
||||
popd
|
||||
pause
|
||||
call "%~dp0proxy_set.bat"
|
13
dist/windows/service_restart.bat
vendored
13
dist/windows/service_restart.bat
vendored
@ -1,13 +1,16 @@
|
||||
@echo off
|
||||
title ByeDPI - Restart Service
|
||||
|
||||
echo This script should be run with administrator privileges.
|
||||
echo Right click - run as administrator.
|
||||
echo Press any key if you're running it as administrator.
|
||||
pause
|
||||
rem Run as administrator
|
||||
reg query "HKU\S-1-5-19\Environment" >nul 2>&1
|
||||
if not %errorlevel% equ 0 (
|
||||
powershell.exe -windowstyle hidden -noprofile "Start-Process '%~dpnx0' -Verb RunAs"
|
||||
exit /b 0
|
||||
)
|
||||
|
||||
set svc_name="ByeDPI"
|
||||
|
||||
sc stop %svc_name%
|
||||
sc start %svc_name%
|
||||
pause
|
||||
|
||||
call "%~dp0proxy_set.bat"
|
Loading…
Reference in New Issue
Block a user