forked from hufrea/byedpi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
144 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.vscode | ||
ciadpi.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@echo off | ||
title ByeDPI | ||
|
||
ciadpi.exe --split 1+s --disorder 3+s --mod-http=h,d --auto --tlsrec 1+s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
@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 | ||
|
||
set svc_name="ByeDPI" | ||
|
||
sc stop %svc_name% | ||
sc delete %svc_name% | ||
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
@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 | ||
|
||
set svc_name="ByeDPI" | ||
set svc_desc="Local SOCKS proxy server to bypass DPI (Deep Packet Inspection)." | ||
|
||
:: Set up launch args (bypass methods) here. The "--service" arg is required; | ||
:: without it, the program will not register itself as a Windows service! | ||
set svc_bin="\"%cd%\ciadpi.exe\" --service --split 1+s --disorder 3+s --mod-http=h,d --auto --tlsrec 1+s" | ||
|
||
sc stop %svc_name% | ||
sc delete %svc_name% | ||
sc create %svc_name% binPath= %svc_bin% start= "auto" | ||
sc description %svc_name% %svc_desc% | ||
sc start %svc_name% | ||
|
||
popd | ||
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#include "win_service.h" | ||
#include <minwindef.h> | ||
#include <winsvc.h> | ||
|
||
#define SERVICE_NAME "ByeDPI" | ||
|
||
static SERVICE_STATUS ServiceStatus; | ||
static SERVICE_STATUS_HANDLE hStatus; | ||
static int svc_argc = 0; | ||
static char **svc_argv = NULL; | ||
|
||
int main(int argc, char *argv[]); | ||
|
||
void service_ctrl_handler(DWORD request) | ||
{ | ||
switch(request) | ||
{ | ||
case SERVICE_CONTROL_STOP: | ||
case SERVICE_CONTROL_SHUTDOWN: | ||
ServiceStatus.dwWin32ExitCode = 0; | ||
ServiceStatus.dwCurrentState = SERVICE_STOPPED; | ||
default: | ||
break; | ||
} | ||
SetServiceStatus(hStatus, &ServiceStatus); | ||
return; | ||
} | ||
|
||
void service_main(int argc __attribute__((unused)), char *argv[] __attribute__((unused))) | ||
{ | ||
ServiceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; | ||
ServiceStatus.dwCurrentState = SERVICE_RUNNING; | ||
ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN; | ||
ServiceStatus.dwWin32ExitCode = 0; | ||
ServiceStatus.dwServiceSpecificExitCode = 0; | ||
ServiceStatus.dwCheckPoint = 1; | ||
ServiceStatus.dwWaitHint = 0; | ||
|
||
hStatus = RegisterServiceCtrlHandler(SERVICE_NAME, (LPHANDLER_FUNCTION)service_ctrl_handler); | ||
if (hStatus == (SERVICE_STATUS_HANDLE)0) | ||
{ | ||
// Registering Control Handler failed | ||
return; | ||
} | ||
|
||
SetServiceStatus(hStatus, &ServiceStatus); | ||
|
||
// Calling main with saved argc & argv | ||
ServiceStatus.dwWin32ExitCode = (DWORD)main(svc_argc, svc_argv); | ||
ServiceStatus.dwCurrentState = SERVICE_STOPPED; | ||
SetServiceStatus(hStatus, &ServiceStatus); | ||
return; | ||
} | ||
|
||
int register_winsvc(int argc, char *argv[]) | ||
{ | ||
SERVICE_TABLE_ENTRY ServiceTable[] = { | ||
{SERVICE_NAME, (LPSERVICE_MAIN_FUNCTION)service_main}, | ||
{NULL, NULL} | ||
}; | ||
|
||
// Save args passed to the program to use instead of the service args. | ||
if (!svc_argc && !svc_argv) { | ||
svc_argc = argc; | ||
svc_argv = calloc((size_t)(argc + 1), sizeof(void*)); | ||
for (int i = 0; i < argc; i++) | ||
svc_argv[i] = strdup(argv[i]); | ||
} | ||
|
||
int result = StartServiceCtrlDispatcher(ServiceTable); | ||
|
||
if (svc_argc && svc_argv) { | ||
for (int i = 0; i < svc_argc; i++) | ||
free(svc_argv[i]); | ||
free(svc_argv); | ||
} | ||
|
||
return result; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
int register_winsvc(int argc, char *argv[]); |