mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
commit
8e7670db41
6 changed files with 15 additions and 15 deletions
|
@ -559,7 +559,7 @@ Calculates stats and displays to an LCD
|
||||||
Options:
|
Options:
|
||||||
-j, --json Output stats as JSON formatted string
|
-j, --json Output stats as JSON formatted string
|
||||||
-r, --refresh Set update frequency (in seconds)
|
-r, --refresh Set update frequency (in seconds)
|
||||||
-e, --exit Output stats and exit witout refreshing
|
-e, --exit Output stats and exit without refreshing
|
||||||
-h, --help Display this help text"
|
-h, --help Display this help text"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ flushARP(){
|
||||||
|
|
||||||
# Truncate network_addresses table in pihole-FTL.db
|
# Truncate network_addresses table in pihole-FTL.db
|
||||||
# This needs to be done before we can truncate the network table due to
|
# This needs to be done before we can truncate the network table due to
|
||||||
# foreign key contraints
|
# foreign key constraints
|
||||||
if ! output=$(sqlite3 "${DBFILE}" "DELETE FROM network_addresses" 2>&1); then
|
if ! output=$(sqlite3 "${DBFILE}" "DELETE FROM network_addresses" 2>&1); then
|
||||||
echo -e "${OVER} ${CROSS} Failed to truncate network_addresses table"
|
echo -e "${OVER} ${CROSS} Failed to truncate network_addresses table"
|
||||||
echo " Database location: ${DBFILE}"
|
echo " Database location: ${DBFILE}"
|
||||||
|
|
|
@ -244,7 +244,7 @@ initialize_debug() {
|
||||||
log_write "${INFO} $(date "+%Y-%m-%d:%H:%M:%S") debug log has been initialized."
|
log_write "${INFO} $(date "+%Y-%m-%d:%H:%M:%S") debug log has been initialized."
|
||||||
}
|
}
|
||||||
|
|
||||||
# This is a function for visually displaying the curent test that is being run.
|
# This is a function for visually displaying the current test that is being run.
|
||||||
# Accepts one variable: the name of what is being diagnosed
|
# Accepts one variable: the name of what is being diagnosed
|
||||||
# Colors do not show in the dasboard, but the icons do: [i], [✓], and [✗]
|
# Colors do not show in the dasboard, but the icons do: [i], [✓], and [✗]
|
||||||
echo_current_diagnostic() {
|
echo_current_diagnostic() {
|
||||||
|
@ -379,7 +379,7 @@ get_program_version() {
|
||||||
# Create a local variable so this function can be safely reused
|
# Create a local variable so this function can be safely reused
|
||||||
local program_version
|
local program_version
|
||||||
echo_current_diagnostic "${program_name} version"
|
echo_current_diagnostic "${program_name} version"
|
||||||
# Evalutate the program we are checking, if it is any of the ones below, show the version
|
# Evaluate the program we are checking, if it is any of the ones below, show the version
|
||||||
case "${program_name}" in
|
case "${program_name}" in
|
||||||
"lighttpd") program_version="$(${program_name} -v 2> /dev/null | head -n1 | cut -d '/' -f2 | cut -d ' ' -f1)"
|
"lighttpd") program_version="$(${program_name} -v 2> /dev/null | head -n1 | cut -d '/' -f2 | cut -d ' ' -f1)"
|
||||||
;;
|
;;
|
||||||
|
@ -641,7 +641,7 @@ detect_ip_addresses() {
|
||||||
# First argument should be a 4 or a 6
|
# First argument should be a 4 or a 6
|
||||||
local protocol=${1}
|
local protocol=${1}
|
||||||
# Use ip to show the addresses for the chosen protocol
|
# Use ip to show the addresses for the chosen protocol
|
||||||
# Store the values in an arry so they can be looped through
|
# Store the values in an array so they can be looped through
|
||||||
# Get the lines that are in the file(s) and store them in an array for parsing later
|
# Get the lines that are in the file(s) and store them in an array for parsing later
|
||||||
mapfile -t ip_addr_list < <(ip -"${protocol}" addr show dev "${PIHOLE_INTERFACE}" | awk -F ' ' '{ for(i=1;i<=NF;i++) if ($i ~ '/^inet/') print $(i+1) }')
|
mapfile -t ip_addr_list < <(ip -"${protocol}" addr show dev "${PIHOLE_INTERFACE}" | awk -F ' ' '{ for(i=1;i<=NF;i++) if ($i ~ '/^inet/') print $(i+1) }')
|
||||||
|
|
||||||
|
@ -823,7 +823,7 @@ check_x_headers() {
|
||||||
# Do it for the dashboard as well, as the header is different than above
|
# Do it for the dashboard as well, as the header is different than above
|
||||||
local dashboard
|
local dashboard
|
||||||
dashboard=$(curl -Is localhost/admin/ | awk '/X-Pi-hole/' | tr -d '\r')
|
dashboard=$(curl -Is localhost/admin/ | awk '/X-Pi-hole/' | tr -d '\r')
|
||||||
# Store what the X-Header shoud be in variables for comparison later
|
# Store what the X-Header should be in variables for comparison later
|
||||||
local block_page_working
|
local block_page_working
|
||||||
block_page_working="X-Pi-hole: A black hole for Internet advertisements."
|
block_page_working="X-Pi-hole: A black hole for Internet advertisements."
|
||||||
local dashboard_working
|
local dashboard_working
|
||||||
|
@ -842,12 +842,12 @@ check_x_headers() {
|
||||||
log_write "${COL_RED}${full_curl_output_block_page}${COL_NC}"
|
log_write "${COL_RED}${full_curl_output_block_page}${COL_NC}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Same logic applies to the dashbord as above, if the X-Header matches what a working system shoud have,
|
# Same logic applies to the dashboard as above, if the X-Header matches what a working system should have,
|
||||||
if [[ $dashboard == "$dashboard_working" ]]; then
|
if [[ $dashboard == "$dashboard_working" ]]; then
|
||||||
# then we can show a success
|
# then we can show a success
|
||||||
log_write "$TICK Web interface X-Header: ${COL_GREEN}${dashboard}${COL_NC}"
|
log_write "$TICK Web interface X-Header: ${COL_GREEN}${dashboard}${COL_NC}"
|
||||||
else
|
else
|
||||||
# Othewise, it's a failure since the X-Headers either don't exist or have been modified in some way
|
# Otherwise, it's a failure since the X-Headers either don't exist or have been modified in some way
|
||||||
log_write "$CROSS Web interface X-Header: ${COL_RED}X-Header does not match or could not be retrieved.${COL_NC}"
|
log_write "$CROSS Web interface X-Header: ${COL_RED}X-Header does not match or could not be retrieved.${COL_NC}"
|
||||||
log_write "${COL_RED}${full_curl_output_dashboard}${COL_NC}"
|
log_write "${COL_RED}${full_curl_output_dashboard}${COL_NC}"
|
||||||
fi
|
fi
|
||||||
|
@ -877,7 +877,7 @@ dig_at() {
|
||||||
local pihole_address="${IP}"
|
local pihole_address="${IP}"
|
||||||
local remote_address="2001:4860:4860::8888"
|
local remote_address="2001:4860:4860::8888"
|
||||||
local record_type="AAAA"
|
local record_type="AAAA"
|
||||||
# Othwerwise, it should be 4
|
# Otherwise, it should be 4
|
||||||
else
|
else
|
||||||
# so use the IPv4 values
|
# so use the IPv4 values
|
||||||
local local_address="127.0.0.1"
|
local local_address="127.0.0.1"
|
||||||
|
@ -911,7 +911,7 @@ dig_at() {
|
||||||
# show a success
|
# show a success
|
||||||
log_write "${TICK} ${random_url} ${COL_GREEN}is ${pihole_dig}${COL_NC} via ${COL_CYAN}Pi-hole${COL_NC} (${pihole_address})"
|
log_write "${TICK} ${random_url} ${COL_GREEN}is ${pihole_dig}${COL_NC} via ${COL_CYAN}Pi-hole${COL_NC} (${pihole_address})"
|
||||||
else
|
else
|
||||||
# Othewise, show a failure
|
# Otherwise, show a failure
|
||||||
log_write "${CROSS} ${COL_RED}Failed to resolve${COL_NC} ${random_url} via ${COL_RED}Pi-hole${COL_NC} (${pihole_address})"
|
log_write "${CROSS} ${COL_RED}Failed to resolve${COL_NC} ${random_url} via ${COL_RED}Pi-hole${COL_NC} (${pihole_address})"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1044,7 +1044,7 @@ parse_file() {
|
||||||
}
|
}
|
||||||
|
|
||||||
check_name_resolution() {
|
check_name_resolution() {
|
||||||
# Check name resoltion from localhost, Pi-hole's IP, and Google's name severs
|
# Check name resolution from localhost, Pi-hole's IP, and Google's name severs
|
||||||
# using the function we created earlier
|
# using the function we created earlier
|
||||||
dig_at 4 "${IPV4_ADDRESS%/*}"
|
dig_at 4 "${IPV4_ADDRESS%/*}"
|
||||||
# If IPv6 enabled,
|
# If IPv6 enabled,
|
||||||
|
|
|
@ -31,7 +31,7 @@ else
|
||||||
else
|
else
|
||||||
echo -e " ${CROSS} ${str}
|
echo -e " ${CROSS} ${str}
|
||||||
Script called with non-root privileges
|
Script called with non-root privileges
|
||||||
The Pi-hole requires elevated privleges to uninstall"
|
The Pi-hole requires elevated privileges to uninstall"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -363,7 +363,7 @@ gravity_DownloadBlocklists() {
|
||||||
|
|
||||||
target="$(mktemp -p "/tmp" --suffix=".gravity")"
|
target="$(mktemp -p "/tmp" --suffix=".gravity")"
|
||||||
|
|
||||||
# Use compression to reduce the amount of data that is transfered
|
# Use compression to reduce the amount of data that is transferred
|
||||||
# between the Pi-hole and the ad list provider. Use this feature
|
# between the Pi-hole and the ad list provider. Use this feature
|
||||||
# only if it is supported by the locally available version of curl
|
# only if it is supported by the locally available version of curl
|
||||||
if curl -V | grep -q "Features:.* libz"; then
|
if curl -V | grep -q "Features:.* libz"; then
|
||||||
|
@ -595,7 +595,7 @@ gravity_ParseFileIntoDomains() {
|
||||||
# Determine if we are parsing a consolidated list
|
# Determine if we are parsing a consolidated list
|
||||||
#if [[ "${source}" == "${piholeDir}/${matterAndLight}" ]]; then
|
#if [[ "${source}" == "${piholeDir}/${matterAndLight}" ]]; then
|
||||||
# Remove comments and print only the domain name
|
# Remove comments and print only the domain name
|
||||||
# Most of the lists downloaded are already in hosts file format but the spacing/formating is not contiguous
|
# Most of the lists downloaded are already in hosts file format but the spacing/formatting is not contiguous
|
||||||
# This helps with that and makes it easier to read
|
# This helps with that and makes it easier to read
|
||||||
# It also helps with debugging so each stage of the script can be researched more in depth
|
# It also helps with debugging so each stage of the script can be researched more in depth
|
||||||
# 1) Remove carriage returns
|
# 1) Remove carriage returns
|
||||||
|
|
|
@ -153,7 +153,7 @@ Available commands and options:
|
||||||
.br
|
.br
|
||||||
-r, --refresh Set update frequency (in seconds)
|
-r, --refresh Set update frequency (in seconds)
|
||||||
.br
|
.br
|
||||||
-e, --exit Output stats and exit witout refreshing
|
-e, --exit Output stats and exit without refreshing
|
||||||
.br
|
.br
|
||||||
|
|
||||||
\fB-g, updateGravity\fR
|
\fB-g, updateGravity\fR
|
||||||
|
|
Loading…
Reference in a new issue