commit e3da4320b1a64d5d73dbc11a7482d67dcb742e45 Author: Félix MARQUET Date: Fri May 20 09:54:47 2022 +0200 Init diff --git a/Linux/.hosts b/Linux/.hosts new file mode 100755 index 0000000..6a4293d --- /dev/null +++ b/Linux/.hosts @@ -0,0 +1,39 @@ +#The following lines block any spotify add +0.0.0.0 adclick.g.doublecklick.net +0.0.0.0 adeventtracker.spotify.com +0.0.0.0 ads-fa.spotify.com +0.0.0.0 analytics.spotify.com +0.0.0.0 audio2.spotify.com +0.0.0.0 b.scorecardresearch.com +0.0.0.0 bounceexchange.com +0.0.0.0 bs.serving-sys.com +0.0.0.0 content.bitsontherun.com +0.0.0.0 core.insightexpressai.com +0.0.0.0 crashdump.spotify.com +0.0.0.0 d2gi7ultltnc2u.cloudfront.net +0.0.0.0 d3rt1990lpmkn.cloudfront.net +0.0.0.0 desktop.spotify.com +0.0.0.0 doubleclick.net +0.0.0.0 ds.serving-sys.com +0.0.0.0 googleadservices.com +0.0.0.0 googleads.g.doubleclick.net +0.0.0.0 gtssl2-ocsp.geotrust.com +0.0.0.0 js.moatads.com +0.0.0.0 log.spotify.com +0.0.0.0 media-match.com +0.0.0.0 omaze.com +0.0.0.0 pagead46.l.doubleclick.net +0.0.0.0 pagead2.googlesyndication.com +0.0.0.0 partner.googleadservices.com +0.0.0.0 pubads.g.doubleclick.net +0.0.0.0 redirector.gvt1.com +0.0.0.0 s0.2mdn.net +0.0.0.0 securepubads.g.doubleclick.net +0.0.0.0 spclient.wg.spotify.com +0.0.0.0 tpc.googlesyndication.com +0.0.0.0 v.jwpcdn.com +0.0.0.0 video-ad-stats.googlesyndication.com +0.0.0.0 weblb-wg.gslb.spotify.com +0.0.0.0 www.googleadservices.com +0.0.0.0 www.googletagservices.com +0.0.0.0 www.omaze.com diff --git a/Linux/.hosts_original_fedora.txt b/Linux/.hosts_original_fedora.txt new file mode 100644 index 0000000..6d3a945 --- /dev/null +++ b/Linux/.hosts_original_fedora.txt @@ -0,0 +1,7 @@ +# Loopback entries; do not change. +# For historical reasons, localhost precedes localhost.localdomain: +127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 +::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 +# See hosts(5) for proper format and other examples: +# 192.168.1.10 foo.mydomain.org foo +# 192.168.1.13 bar.mydomain.org bar \ No newline at end of file diff --git a/Linux/.state b/Linux/.state new file mode 100644 index 0000000..7940e0e --- /dev/null +++ b/Linux/.state @@ -0,0 +1 @@ +fmarquet ecovh-mobile-hpb 0 diff --git a/Linux/install.sh b/Linux/install.sh new file mode 100755 index 0000000..72788e2 --- /dev/null +++ b/Linux/install.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +detect_distro() { + if [ -f /etc/os-release ]; then + # freedesktop.org and systemd + . /etc/os-release + OS=$(echo "$ID" | awk '{print tolower($0)}') + OS_VER=$VERSION_ID + elif type lsb_release >/dev/null 2>&1; then + # linuxbase.org + OS=$(lsb_release -si | awk '{print tolower($0)}') + OS_VER=$(lsb_release -sr) + elif [ -f /etc/lsb-release ]; then + # For some versions of Debian/Ubuntu without lsb_release command + . /etc/lsb-release + OS=$(echo "$DISTRIB_ID" | awk '{print tolower($0)}') + OS_VER=$DISTRIB_RELEASE + elif [ -f /etc/debian_version ]; then + # Older Debian/Ubuntu/etc. + OS="debian" + OS_VER=$(cat /etc/debian_version) + elif [ -f /etc/SuSe-release ]; then + # Older SuSE/etc. + OS="SuSE" + OS_VER="?" + elif [ -f /etc/redhat-release ]; then + # Older Red Hat, CentOS, etc. + OS="Red Hat/CentOS" + OS_VER="?" + else + # Fall back to uname, e.g. "Linux ", also works for BSD, etc. + OS=$(uname -s) + OS_VER=$(uname -r) + fi + + OS=$(echo "$OS" | awk '{print tolower($0)}') + OS_VER_MAJOR=$(echo "$OS_VER" | cut -d. -f1) +} + +detect_distro + +state="$(head -n 1 .state)" + +if [ "$EUID" -ne 0 ] +then + echo "Please run as superuser" + exit +fi + +if [ "$state" == "$SUDO_USER $HOSTNAME 1" ] +then + echo "Service already installed, press any key to update it or ctrl-c to avoid installation" + read cap + echo "Service up to date!" + cp .hosts_original_${OS}.txt /etc/hosts +else + echo "Service is going to be installed, press any key to continue or ctrl-c to avoid installation" + read cap + echo "Service installed!" + echo "$SUDO_USER $HOSTNAME 1" > .state + cp /etc/hosts .hosts_original_${OS}.txt +fi + + +cat .hosts >> /etc/hosts diff --git a/Linux/uninstall.sh b/Linux/uninstall.sh new file mode 100755 index 0000000..b82014f --- /dev/null +++ b/Linux/uninstall.sh @@ -0,0 +1,60 @@ +#!/bin/bash +state="$(head -n 1 .state)" + +detect_distro() { + if [ -f /etc/os-release ]; then + # freedesktop.org and systemd + . /etc/os-release + OS=$(echo "$ID" | awk '{print tolower($0)}') + OS_VER=$VERSION_ID + elif type lsb_release >/dev/null 2>&1; then + # linuxbase.org + OS=$(lsb_release -si | awk '{print tolower($0)}') + OS_VER=$(lsb_release -sr) + elif [ -f /etc/lsb-release ]; then + # For some versions of Debian/Ubuntu without lsb_release command + . /etc/lsb-release + OS=$(echo "$DISTRIB_ID" | awk '{print tolower($0)}') + OS_VER=$DISTRIB_RELEASE + elif [ -f /etc/debian_version ]; then + # Older Debian/Ubuntu/etc. + OS="debian" + OS_VER=$(cat /etc/debian_version) + elif [ -f /etc/SuSe-release ]; then + # Older SuSE/etc. + OS="SuSE" + OS_VER="?" + elif [ -f /etc/redhat-release ]; then + # Older Red Hat, CentOS, etc. + OS="Red Hat/CentOS" + OS_VER="?" + else + # Fall back to uname, e.g. "Linux ", also works for BSD, etc. + OS=$(uname -s) + OS_VER=$(uname -r) + fi + + OS=$(echo "$OS" | awk '{print tolower($0)}') + OS_VER_MAJOR=$(echo "$OS_VER" | cut -d. -f1) +} + +detect_distro + + +if [ "$EUID" -ne 0 ] +then + echo "Please run as root" + exit +fi + +if [ "$state" == "$SUDO_USER $HOSTNAME 1" ] +then + echo "You are going to unninstall the service SpotifyAddBlock, press any key to continue or ctrl-c to avoid uninstallation" + read cap + echo "Service uninstalled!" + cp .hosts_original_${OS}.txt /etc/hosts +else + echo "The service is not installed on this machine" +fi + +echo "$SUDO_USER $HOSTNAME 0" > .state diff --git a/README.md b/README.md new file mode 100644 index 0000000..b0c915d --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# SpotifyAddBlock +Blocks Spotify adds in Linux machines or Windows diff --git a/Windows/hosts.txt b/Windows/hosts.txt new file mode 100755 index 0000000..343f270 --- /dev/null +++ b/Windows/hosts.txt @@ -0,0 +1,38 @@ +0.0.0.0 adclick.g.doublecklick.net +0.0.0.0 adeventtracker.spotify.com +0.0.0.0 ads-fa.spotify.com +0.0.0.0 analytics.spotify.com +0.0.0.0 audio2.spotify.com +0.0.0.0 b.scorecardresearch.com +0.0.0.0 bounceexchange.com +0.0.0.0 bs.serving-sys.com +0.0.0.0 content.bitsontherun.com +0.0.0.0 core.insightexpressai.com +0.0.0.0 crashdump.spotify.com +0.0.0.0 d2gi7ultltnc2u.cloudfront.net +0.0.0.0 d3rt1990lpmkn.cloudfront.net +0.0.0.0 desktop.spotify.com +0.0.0.0 doubleclick.net +0.0.0.0 ds.serving-sys.com +0.0.0.0 googleadservices.com +0.0.0.0 googleads.g.doubleclick.net +0.0.0.0 gtssl2-ocsp.geotrust.com +0.0.0.0 js.moatads.com +0.0.0.0 log.spotify.com +0.0.0.0 media-match.com +0.0.0.0 omaze.com +0.0.0.0 pagead46.l.doubleclick.net +0.0.0.0 pagead2.googlesyndication.com +0.0.0.0 partner.googleadservices.com +0.0.0.0 pubads.g.doubleclick.net +0.0.0.0 redirector.gvt1.com +0.0.0.0 s0.2mdn.net +0.0.0.0 securepubads.g.doubleclick.net +0.0.0.0 spclient.wg.spotify.com +0.0.0.0 tpc.googlesyndication.com +0.0.0.0 v.jwpcdn.com +0.0.0.0 video-ad-stats.googlesyndication.com +0.0.0.0 weblb-wg.gslb.spotify.com +0.0.0.0 www.googleadservices.com +0.0.0.0 www.googletagservices.com +0.0.0.0 www.omaze.com \ No newline at end of file diff --git a/Windows/hosts_original b/Windows/hosts_original new file mode 100755 index 0000000..dc9cdcd --- /dev/null +++ b/Windows/hosts_original @@ -0,0 +1,21 @@ +# Copyright (c) 1993-2009 Microsoft Corp. +# +# This is a sample HOSTS file used by Microsoft TCP/IP for Windows. +# +# This file contains the mappings of IP addresses to host names. Each +# entry should be kept on an individual line. The IP address should +# be placed in the first column followed by the corresponding host name. +# The IP address and the host name should be separated by at least one +# space. +# +# Additionally, comments (such as these) may be inserted on individual +# lines or following the machine name denoted by a '#' symbol. +# +# For example: +# +# 102.54.94.97 rhino.acme.com # source server +# 38.25.63.10 x.acme.com # x client host + +# localhost name resolution is handled within DNS itself. +# 127.0.0.1 localhost +# ::1 localhost \ No newline at end of file diff --git a/Windows/install.bat b/Windows/install.bat new file mode 100755 index 0000000..87fac17 --- /dev/null +++ b/Windows/install.bat @@ -0,0 +1,8 @@ +@echo off +cd /d %~dp0 +if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit /b) +md C:\SpotifyAddBlock +xcopy /v C:\Windows\System32\drivers\etc\hosts C:\SpotifyAddBlock\hosts_original +type hosts.txt>C:\Windows\System32\drivers\etc\hosts +echo Service installed +pause \ No newline at end of file diff --git a/Windows/uninstall.bat b/Windows/uninstall.bat new file mode 100755 index 0000000..8fc2b85 --- /dev/null +++ b/Windows/uninstall.bat @@ -0,0 +1,6 @@ +@echo off +cd /d %~dp0 +if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit /b) +type C:\SpotifyAddBlock\hosts_original>C:\Windows\System32\drivers\etc\hosts +echo Service uninstalled +pause \ No newline at end of file