Skip to content

Commit

Permalink
remove base64 from logging
Browse files Browse the repository at this point in the history
  • Loading branch information
mrpond committed Mar 5, 2020
1 parent c430cee commit 85df8c8
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 19 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.49 <br>
<strong>Last updated:</strong> 3 March 2020<br>
<strong>Current Version:</strong> 0.50 <br>
<strong>Last updated:</strong> 5 March 2020<br>
<strong>Last tested version:</strong> 1.1.27.472.gf6574b97
</p>
<h4 align="center">Important Notice(s)</h4>
Expand Down
Binary file modified chrome_elf.zip
Binary file not shown.
4 changes: 2 additions & 2 deletions src/Resource.rc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 0,49,0,0
PRODUCTVERSION 0,50,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -100,7 +100,7 @@ BEGIN
VALUE "LegalCopyright", "Copyright (C) 2019"
VALUE "OriginalFilename", "BlockTheSpot.dll"
VALUE "ProductName", "BlockTheSpot"
VALUE "ProductVersion", "0.49.0.0"
VALUE "ProductVersion", "0.50.0.0"
END
END
BLOCK "VarFileInfo"
Expand Down
44 changes: 29 additions & 15 deletions src/hosts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ std::wofstream Log;
bool is_blockhost (const char* nodename) {

std::string nnodename (nodename);
if (0 == nnodename.compare("wpad"))

if (0 == nnodename.compare ("wpad"))
return g_Skip_wpad ? true : false;

if (std::string::npos != nnodename.find ("google"))
return true;
if (std::string::npos != nnodename.find ("doubleclick"))
Expand All @@ -36,27 +36,31 @@ int WINAPI getaddrinfohook (DWORD RetAddr,
hints,
res);

if (0 == result && isblock.get ()) {
if (0 == result && isblock.get ()) {
for (auto ptr = *res; nullptr != ptr; ptr = ptr->ai_next) {
auto ipv4 = (struct sockaddr_in*)ptr->ai_addr;
//memset (&ipv4->sin_addr.S_un.S_addr, 0x0, sizeof ULONG);
ipv4->sin_addr.S_un.S_addr = INADDR_ANY;
}
if (Log.is_open ())
Log << "blocked - getaddrinfo " << nodename << '\n';
Log << "blocked - " << nodename << std::endl;
}

return result;
}

// block http request base on URI
bool is_blockrequest (LPCWSTR pwszObjectName) {
std::wstring npwszObjectName (pwszObjectName);
if (std::wstring::npos != npwszObjectName.compare (L"/ad-logic/"))
return true;
if (std::wstring::npos != npwszObjectName.compare (L"/ads/"))
return true;

bool is_blockrequest (const std::wstring& npwszVerb,const std::wstring& npwszObjectName) {
if (0 == npwszVerb.compare (L"POST")) {
if (0 == npwszObjectName.compare (L"/ad-logic/state/config")) {
return true;
}
}
if (0 == npwszVerb.compare (L"GET")) {
if (0 == npwszObjectName.compare (0, 5, L"/ads/", 5)) {
return true;
}
}
return false;
}

Expand All @@ -71,11 +75,21 @@ int WINAPI winhttpopenrequesthook (DWORD RetAddr,
LPCWSTR* ppwszAcceptTypes,
DWORD dwFlags)
{
if (is_blockrequest (pwszObjectName)) {
if (Log.is_open ())
Log << "blocked - WinHttpOpenRequest " << pwszVerb << " " << pwszObjectName << '\n';
std::wstring npwszVerb (pwszVerb);
std::wstring npwszObjectName (pwszObjectName);

if (is_blockrequest (npwszVerb, npwszObjectName)) {
if (Log.is_open ()) {
auto pos = npwszObjectName.find_first_of (L"="); // check if had ?payload=
if (pos != std::string::npos) {
npwszObjectName.erase (pos + 1); // trim original base64 payload out
npwszObjectName.append (L"c2VjcmV0"); // append "secret"
}
Log << "blocked - " << npwszVerb << " " << npwszObjectName << std::endl;
}
return 0;
}

return fnwinhttpopenrequest (hConnect,
pwszVerb,
pwszObjectName,
Expand Down

0 comments on commit 85df8c8

Please sign in to comment.