mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 23:08:07 +00:00
Merge pull request #1201 from pi-hole/development
[RELEASE] Pi-hole Core 2.12.1
This commit is contained in:
commit
5333895a9f
@ -22,7 +22,7 @@ function GetJSONValue {
|
|||||||
retVal=$(echo $1 | sed 's/\\\\\//\//g' | \
|
retVal=$(echo $1 | sed 's/\\\\\//\//g' | \
|
||||||
sed 's/[{}]//g' | \
|
sed 's/[{}]//g' | \
|
||||||
awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | \
|
awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | \
|
||||||
sed 's/\"\:\"/\|/g' | \
|
sed 's/\"\:/\|/g' | \
|
||||||
sed 's/[\,]/ /g' | \
|
sed 's/[\,]/ /g' | \
|
||||||
sed 's/\"//g' | \
|
sed 's/\"//g' | \
|
||||||
grep -w $2)
|
grep -w $2)
|
||||||
|
@ -66,7 +66,7 @@ HandleOther(){
|
|||||||
domain=$(sed -e "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/" <<< "$1")
|
domain=$(sed -e "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/" <<< "$1")
|
||||||
|
|
||||||
#check validity of domain
|
#check validity of domain
|
||||||
validDomain=$(echo "${domain}" | perl -lne 'print if /^(?!.*[^a-z0-9-\.].*)\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)*[a-z]{2,63}\b/')
|
validDomain=$(echo "${domain}" | perl -lne 'print if /(?!.*[^a-z0-9-\.].*)^((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9-]+\.)*[a-z]{2,63}/')
|
||||||
if [ -z "${validDomain}" ]; then
|
if [ -z "${validDomain}" ]; then
|
||||||
echo "::: $1 is not a valid argument or domain name"
|
echo "::: $1 is not a valid argument or domain name"
|
||||||
else
|
else
|
||||||
|
@ -105,21 +105,21 @@ GitCheckUpdateAvail() {
|
|||||||
# defaults to the current one.
|
# defaults to the current one.
|
||||||
REMOTE="$(git rev-parse @{upstream})"
|
REMOTE="$(git rev-parse @{upstream})"
|
||||||
|
|
||||||
# Change back to original directory
|
|
||||||
cd "${curdir}"
|
|
||||||
|
|
||||||
if [[ ${#LOCAL} == 0 ]]; then
|
if [[ ${#LOCAL} == 0 ]]; then
|
||||||
echo "::: Error: Local revision could not be optained, ask Pi-hole support."
|
echo "::: Error: Local revision could not be obtained, ask Pi-hole support."
|
||||||
echo "::: Additional debugging output:"
|
echo "::: Additional debugging output:"
|
||||||
git status
|
git status
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
if [[ ${#REMOTE} == 0 ]]; then
|
if [[ ${#REMOTE} == 0 ]]; then
|
||||||
echo "::: Error: Remote revision could not be optained, ask Pi-hole support."
|
echo "::: Error: Remote revision could not be obtained, ask Pi-hole support."
|
||||||
echo "::: Additional debugging output:"
|
echo "::: Additional debugging output:"
|
||||||
git status
|
git status
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Change back to original directory
|
||||||
|
cd "${curdir}"
|
||||||
|
|
||||||
if [[ "${LOCAL}" != "${REMOTE}" ]]; then
|
if [[ "${LOCAL}" != "${REMOTE}" ]]; then
|
||||||
# Local branch is behind remote branch -> Update
|
# Local branch is behind remote branch -> Update
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/var/log/pihole.log {
|
/var/log/pihole.log {
|
||||||
|
# su #
|
||||||
daily
|
daily
|
||||||
copytruncate
|
copytruncate
|
||||||
rotate 5
|
rotate 5
|
||||||
|
@ -949,7 +949,7 @@ installLogrotate() {
|
|||||||
# the local properties of the /var/log directory
|
# the local properties of the /var/log directory
|
||||||
logusergroup="$(stat -c '%U %G' /var/log)"
|
logusergroup="$(stat -c '%U %G' /var/log)"
|
||||||
if [[ ! -z $logusergroup ]]; then
|
if [[ ! -z $logusergroup ]]; then
|
||||||
echo "su ${logusergroup}" >> /etc/pihole/logrotate
|
sed -i "s/# su #/su ${logusergroup}/" /etc/pihole/logrotate
|
||||||
fi
|
fi
|
||||||
echo " done!"
|
echo " done!"
|
||||||
}
|
}
|
||||||
|
17
gravity.sh
17
gravity.sh
@ -32,6 +32,7 @@ adListDefault=/etc/pihole/adlists.default
|
|||||||
whitelistScript="pihole -w"
|
whitelistScript="pihole -w"
|
||||||
whitelistFile=/etc/pihole/whitelist.txt
|
whitelistFile=/etc/pihole/whitelist.txt
|
||||||
blacklistFile=/etc/pihole/blacklist.txt
|
blacklistFile=/etc/pihole/blacklist.txt
|
||||||
|
readonly wildcardlist="/etc/dnsmasq.d/03-pihole-wildcard.conf"
|
||||||
|
|
||||||
#Source the setupVars from install script for the IP
|
#Source the setupVars from install script for the IP
|
||||||
setupVars=/etc/pihole/setupVars.conf
|
setupVars=/etc/pihole/setupVars.conf
|
||||||
@ -235,6 +236,21 @@ gravity_Blacklist() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gravity_Wildcard() {
|
||||||
|
# Return number of wildcards in output - don't actually handle wildcards
|
||||||
|
if [[ -f "${wildcardlist}" ]]; then
|
||||||
|
num=$(grep -c ^ "${wildcardlist}")
|
||||||
|
if [[ -n "${IPV4_ADDRESS}" && -n "${IPV6_ADDRESS}" ]];then
|
||||||
|
let num/=2
|
||||||
|
fi
|
||||||
|
plural=; [[ "$num" != "1" ]] && plural=s
|
||||||
|
echo "::: Wildcard blocked domain${plural}: $numBlacklisted"
|
||||||
|
else
|
||||||
|
echo "::: No wildcards used!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
gravity_Whitelist() {
|
gravity_Whitelist() {
|
||||||
#${piholeDir}/${eventHorizon})
|
#${piholeDir}/${eventHorizon})
|
||||||
echo ":::"
|
echo ":::"
|
||||||
@ -401,6 +417,7 @@ else
|
|||||||
fi
|
fi
|
||||||
gravity_Whitelist
|
gravity_Whitelist
|
||||||
gravity_Blacklist
|
gravity_Blacklist
|
||||||
|
gravity_Wildcard
|
||||||
|
|
||||||
gravity_hostFormat
|
gravity_hostFormat
|
||||||
gravity_blackbody
|
gravity_blackbody
|
||||||
|
Loading…
Reference in New Issue
Block a user