# behavior. The "ESCAPE '\'" clause specifies that an underscore preceded by an '\' should be matched
# as a literal underscore character. We pretreat the $domain variable accordingly to escape underscores.
if[["${table}"=="gravity"]];then
case"${type}" in
case"${exact}" in
"exact")querystr="SELECT gravity.domain,adlist.address,adlist.enabled FROM gravity LEFT JOIN adlist ON adlist.id = gravity.adlist_id WHERE domain = '${domain}'";;
* )querystr="SELECT gravity.domain,adlist.address,adlist.enabled FROM gravity LEFT JOIN adlist ON adlist.id = gravity.adlist_id WHERE domain LIKE '%${domain//_/\\_}%' ESCAPE '\\'";;
esac
else
case"${type}" in
"exact")querystr="SELECT domain FROM ${table} WHERE domain = '${domain}'";;
* )querystr="SELECT domain FROM ${table} WHERE domain LIKE '%${domain//_/\\_}%' ESCAPE '\\'";;
case"${exact}" in
"exact")querystr="SELECT domain,enabled FROM domainlist WHERE type = '${type}' AND domain = '${domain}'";;
* )querystr="SELECT domain,enabled FROM domainlist WHERE type = '${type}' AND domain LIKE '%${domain//_/\\_}%' ESCAPE '\\'";;
esac
fi
@ -126,7 +126,7 @@ scanDatabaseTable() {
# Print table name
if[[ -z "${blockpage}"]];then
echo"${matchType^} found in ${COL_BOLD}${table^}${COL_NC}"
echo"${matchType^} found in ${COL_BOLD}exact ${table}${COL_NC}"
fi
# Loop over results and print them
@ -136,7 +136,13 @@ scanDatabaseTable() {
echo"π ${result}"
exit0
fi
echo"${result}"
domain="${result/|*}"
if[["${result#*|}"=="0"]];then
extra=" (disabled)"
else
extra=""
fi
echo"${domain}${extra}"
done
}
@ -144,9 +150,10 @@ scanRegexDatabaseTable() {
local domain list
domain="${1}"
list="${2}"
type="${3:-}"
# Query all regex from the corresponding database tables