Skip to content

Commit

Permalink
v0.25 json trick
Browse files Browse the repository at this point in the history
  • Loading branch information
mrpond committed Sep 23, 2019
1 parent c74ce41 commit d6439bc
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 10 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<h4 align="center">A multi-purpose adblocker and skip bypass for the <strong>Windows</strong> Spotify Desktop Application.</h4>
<h5 align="center">Please support Spotify by purchasing premium</h5>
<p align="center">
<strong>Current Version:</strong> 0.24 <br>
<strong>Last updated:</strong> 22 September 2019 <br>
<strong>Current Version:</strong> 0.25 <br>
<strong>Last updated:</strong> 23 September 2019 <br>
<strong>Last tested version:</strong> 1.1.15.448.g00fba0e3
</p>
<h4 align="center">Important Notice(s)</h4>
Expand Down
Binary file modified chrome_elf.zip
Binary file not shown.
11 changes: 8 additions & 3 deletions src/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,23 @@ BOOL APIENTRY DllMain (HMODULE hModule,
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls (hModule);
// block the ads banner by hostname.
// block ads banner by hostname.
InstallHookApi ("ws2_32.dll", "getaddrinfo", getaddrinfohook);
InstallHookApi ("Winhttp.dll", "WinHttpOpenRequest", winhttpopenrequesthook);
// block ads by manipulate json response.
InstallHookApi ("Winhttp.dll", "WinHttpReadData", winhttpreaddatahook);

// real ads block, no data out. bug on fb login...
// ==== archive ====
// real (ads) block, no data out. bug on facebook login/search.
//InstallHookApi ("Winhttp.dll", "WinHttpSendRequest", winhttpsendrequesthook);
//InstallHookApi ("Winhttp.dll", "WinHttpSetStatusCallback", winhttpsetstatuscallbackhook);

// we don't need it, for future only.
//InstallHookApi ("Winhttp.dll", "WinHttpWriteData", winhttpwritedatahook);
//InstallHookApi ("Winhttp.dll", "WinHttpReceiveResponse", winhttpreceiveresponsehook);
//InstallHookApi ("Winhttp.dll", "WinHttpQueryDataAvailable", winhttpquerydataavailablehook);

// block ads request but it keep retrying.
//InstallHookApi ("Winhttp.dll", "WinHttpOpenRequest", winhttpopenrequesthook);
break;
}
return TRUE;
Expand Down
26 changes: 24 additions & 2 deletions src/hosts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ int WINAPI getaddrinfohook (DWORD RetAddr,
{
for (size_t i = 0; i < sizeof (whitelist) / sizeof (whitelist[0]); i++)
{
if (strstr (nodename, whitelist[i]) != 0)
if (strstr (nodename, whitelist[i]) != NULL)
return fngetaddrinfo (nodename, servname, hints, res);
}
for (size_t i = 0; i < sizeof (blockhost) / sizeof (blockhost[0]); i++)
{
if (strstr (nodename, blockhost[i]) != 0)
if (strstr (nodename, blockhost[i]) != NULL)
return WSANO_RECOVERY;
}
return fngetaddrinfo (nodename, servname, hints, res);
Expand Down Expand Up @@ -114,3 +114,25 @@ int WINAPI winhttpsetstatuscallbackhook (DWORD RetAddr,
// lpfnInternetCallback - Set this to NULL to remove the existing callback function.
return fnwinhttpsetstatuscallback (hInternet, NULL, dwNotificationFlags, NULL);
}

// withthis you can replace other json response as well
int WINAPI winhttpreaddatahook (DWORD RetAddr,
pfnwinhttpreaddata fnwinhttpreaddata,
HINTERNET hRequest,
LPVOID lpBuffer,
DWORD dwNumberOfBytesToRead,
LPDWORD lpdwNumberOfBytesRead)
{
if (!fnwinhttpreaddata (hRequest,
lpBuffer,
dwNumberOfBytesToRead,
lpdwNumberOfBytesRead)) {
return false;
}
char* pdest = strstr ((LPSTR)lpBuffer, "pod");
if (pdest != NULL) {
//"pod" -> "xod"
*pdest = 'x';
}
return true;
}
18 changes: 15 additions & 3 deletions src/hosts.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ typedef int (__stdcall* pfnwinhttpsetstatuscallback) (HINTERNET hInternet,
DWORD dwNotificationFlags,
DWORD_PTR dwReserved);

typedef int (__stdcall* pfnwinhttpreaddata) (HINTERNET hRequest,
LPVOID lpBuffer,
DWORD dwNumberOfBytesToRead,
LPDWORD lpdwNumberOfBytesRead);

int WINAPI winhttpopenrequesthook (DWORD RetAddr,
pfnwinhttpopenrequest fnwinhttpopenrequest,
HINTERNET hConnect,
Expand All @@ -56,12 +61,12 @@ int WINAPI getaddrinfohook (DWORD RetAddr,
const struct addrinfo* hints,
struct addrinfo** res);

int WINAPI winhttpquerydataavailablehook (DWORD RetAddr,
int WINAPI winhttpquerydataavailablehook (DWORD RetAddr,
pfnwinhttpquerydataavailable fnwinhttpquerydataavailable,
HINTERNET hRequest,
LPDWORD lpdwNumberOfBytesAvailable);

int WINAPI winhttpsendrequesthook (DWORD RetAddr,
int WINAPI winhttpsendrequesthook (DWORD RetAddr,
pfnwinhttpsendrequest fnwinhttpsendrequest,
HINTERNET hRequest,
LPCWSTR pwszHeaders,
Expand All @@ -83,13 +88,20 @@ int WINAPI winhttpreceiveresponsehook (DWORD RetAddr,
HINTERNET hRequest,
LPVOID lpReserved);

int WINAPI winhttpsetstatuscallbackhook (DWORD RetAddr,
int WINAPI winhttpsetstatuscallbackhook (DWORD RetAddr,
pfnwinhttpsetstatuscallback fnwinhttpsetstatuscallback,
HINTERNET hInternet,
WINHTTP_STATUS_CALLBACK lpfnInternetCallback,
DWORD dwNotificationFlags,
DWORD_PTR dwReserved);

int WINAPI winhttpreaddatahook (DWORD RetAddr,
pfnwinhttpreaddata fnwinhttpreaddata,
HINTERNET hRequest,
LPVOID lpBuffer,
DWORD dwNumberOfBytesToRead,
LPDWORD lpdwNumberOfBytesRead);

static const char* blockhost[] = {
// fork this if you found more... I'll check if had time.
"google.",
Expand Down

0 comments on commit d6439bc

Please sign in to comment.