mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-26 12:10:53 +03:00
Compare commits
4 Commits
42422f479c
...
0098926ca4
Author | SHA1 | Date | |
---|---|---|---|
|
0098926ca4 | ||
|
103f65b155 | ||
|
f95be5c603 | ||
|
fb7fe79022 |
Binary file not shown.
0
binaries/win64/zapret-winws/autohostlist.txt
Normal file
0
binaries/win64/zapret-winws/autohostlist.txt
Normal file
Binary file not shown.
33
nfq/nfqws.c
33
nfq/nfqws.c
@ -759,6 +759,13 @@ static bool wf_make_filter(
|
||||
return true;
|
||||
}
|
||||
|
||||
static unsigned int hash_jen(const void *data,unsigned int len)
|
||||
{
|
||||
unsigned int hash;
|
||||
HASH_JEN(data,len,hash);
|
||||
return hash;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -901,6 +908,7 @@ int main(int argc, char **argv)
|
||||
char windivert_filter[8192], wf_pf_tcp_src[256], wf_pf_tcp_dst[256], wf_pf_udp_src[256], wf_pf_udp_dst[256], wf_save_file[256];
|
||||
bool wf_ipv4=true, wf_ipv6=true;
|
||||
unsigned int IfIdx=0, SubIfIdx=0;
|
||||
unsigned int hash_wf_tcp=0,hash_wf_udp=0,hash_wf_raw=0,hash_ssid_filter=0;
|
||||
*windivert_filter = *wf_pf_tcp_src = *wf_pf_tcp_dst = *wf_pf_udp_src = *wf_pf_udp_dst = *wf_save_file = 0;
|
||||
#endif
|
||||
|
||||
@ -1502,6 +1510,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
break;
|
||||
case 52: /* wf-tcp */
|
||||
hash_wf_tcp=hash_jen(optarg,strlen(optarg));
|
||||
if (!wf_make_pf(optarg,"tcp","SrcPort",wf_pf_tcp_src,sizeof(wf_pf_tcp_src)) ||
|
||||
!wf_make_pf(optarg,"tcp","DstPort",wf_pf_tcp_dst,sizeof(wf_pf_tcp_dst)))
|
||||
{
|
||||
@ -1510,6 +1519,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
break;
|
||||
case 53: /* wf-udp */
|
||||
hash_wf_udp=hash_jen(optarg,strlen(optarg));
|
||||
if (!wf_make_pf(optarg,"udp","SrcPort",wf_pf_udp_src,sizeof(wf_pf_udp_src)) ||
|
||||
!wf_make_pf(optarg,"udp","DstPort",wf_pf_udp_dst,sizeof(wf_pf_udp_dst)))
|
||||
{
|
||||
@ -1518,6 +1528,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
break;
|
||||
case 54: /* wf-raw */
|
||||
hash_wf_raw=hash_jen(optarg,strlen(optarg));
|
||||
if (optarg[0]=='@')
|
||||
{
|
||||
size_t sz = sizeof(windivert_filter)-1;
|
||||
@ -1535,6 +1546,7 @@ int main(int argc, char **argv)
|
||||
wf_save_file[sizeof(wf_save_file) - 1] = '\0';
|
||||
break;
|
||||
case 56: /* ssid-filter */
|
||||
hash_ssid_filter=hash_jen(optarg,strlen(optarg));
|
||||
{
|
||||
char *e,*p = optarg;
|
||||
while (p)
|
||||
@ -1596,6 +1608,20 @@ int main(int argc, char **argv)
|
||||
exit_clean(1);
|
||||
}
|
||||
}
|
||||
HANDLE hMutexArg;
|
||||
{
|
||||
char mutex_name[128];
|
||||
snprintf(mutex_name,sizeof(mutex_name),"Global\\winws_arg_%u_%u_%u_%u_%u_%u_%u_%u",hash_wf_tcp,hash_wf_udp,hash_wf_raw,hash_ssid_filter,IfIdx,SubIfIdx,wf_ipv4,wf_ipv6);
|
||||
|
||||
hMutexArg = CreateMutexA(NULL,TRUE,mutex_name);
|
||||
if (hMutexArg && GetLastError()==ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
CloseHandle(hMutexArg); hMutexArg = NULL;
|
||||
printf("A copy of winws is already running with the same filter\n");
|
||||
goto exiterr;
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
// not specified - use desync_ttl value instead
|
||||
@ -1644,6 +1670,13 @@ int main(int argc, char **argv)
|
||||
ex:
|
||||
rawsend_cleanup();
|
||||
cleanup_params();
|
||||
#ifdef __CYGWIN__
|
||||
if (hMutexArg)
|
||||
{
|
||||
ReleaseMutex(hMutexArg);
|
||||
CloseHandle(hMutexArg);
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
exiterr:
|
||||
result = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user