mirror of
https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker.git
synced 2025-09-02 18:50:13 +00:00
REMOVE Old Patch Files
This commit is contained in:
parent
dad9f912e1
commit
27e488120e
2 changed files with 0 additions and 172 deletions
64
patch.diff
64
patch.diff
|
@ -1,64 +0,0 @@
|
||||||
diff --git a/install-ngxblocker b/install-ngxblocker
|
|
||||||
index 2ca0f62..4ebb34a 100755
|
|
||||||
--- a/install-ngxblocker
|
|
||||||
+++ b/install-ngxblocker
|
|
||||||
@@ -141,16 +141,6 @@ download_files() {
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
-set_mode() {
|
|
||||||
- local mode=$1 dir=$2 file=
|
|
||||||
- local file_list="$(echo $@ | awk '{$1=$2=""; print}' | sed -e 's/^[ \t]*//')"
|
|
||||||
-
|
|
||||||
- for file in $file_list; do
|
|
||||||
- printf "Setting mode: $mode => $dir/$file\n"
|
|
||||||
- chmod $mode $dir/$file
|
|
||||||
- done
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
check_config() {
|
|
||||||
local x= dirs="$*"
|
|
||||||
|
|
||||||
@@ -293,11 +283,6 @@ main() {
|
|
||||||
download_files conf.d $CONF_DIR $CONF_FILES
|
|
||||||
download_files bots.d $BOTS_DIR $BOT_FILES
|
|
||||||
download_files / $SCRIPT_DIR $SCRIPT_FILES
|
|
||||||
-
|
|
||||||
- # ensures scripts are executable
|
|
||||||
- if [ "$DRY_RUN" = "N" ]; then
|
|
||||||
- set_mode 700 $SCRIPT_DIR $SCRIPT_FILES
|
|
||||||
- fi
|
|
||||||
}
|
|
||||||
|
|
||||||
## START ##
|
|
||||||
diff --git a/setup-ngxblocker b/setup-ngxblocker
|
|
||||||
index 30f24d7..c84e552 100755
|
|
||||||
--- a/setup-ngxblocker
|
|
||||||
+++ b/setup-ngxblocker
|
|
||||||
@@ -186,9 +186,8 @@ find_line() {
|
|
||||||
local file=$1 find_str=$2 first_last=$3
|
|
||||||
|
|
||||||
case "$first_last" in
|
|
||||||
- # ignore file #comments
|
|
||||||
- first) grep -nE "^[ ]+$find_str" $file | head -n1 | awk -F: '{print $1}'
|
|
||||||
- last) grep -nE "^[ ]+$find_str" $file | tail -n1 | awk -F: '{print $1}'
|
|
||||||
+ first) awk "/$find_str/{ print NR; exit }" $file;;
|
|
||||||
+ last) awk "/$find_str/{ print NR }" $file | tail -n1;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/update-ngxblocker b/update-ngxblocker
|
|
||||||
index b3869e5..186a513 100755
|
|
||||||
--- a/update-ngxblocker
|
|
||||||
+++ b/update-ngxblocker
|
|
||||||
@@ -194,8 +194,8 @@ check_args() {
|
|
||||||
}
|
|
||||||
|
|
||||||
check_mail_depends() {
|
|
||||||
- if [ ! -f /usr/bin/mail ] && [ ! -f /bin/mail ]; then # mailx + ssmtp are enough to send emails
|
|
||||||
- printf "${BOLDYELLOW}WARN${RESET}: missing mail command => ${BOLDWHITE}disabling emails${RESET}.\n\n"
|
|
||||||
+ if [ ! -f /usr/bin/mail ]; then # mailx + ssmtp are enough to send emails
|
|
||||||
+ printf "${BOLDYELLOW}WARN${RESET}: missing /usr/bin/mail => ${BOLDWHITE}disabling emails${RESET}.\n\n"
|
|
||||||
SEND_EMAIL="N"
|
|
||||||
fi
|
|
||||||
}
|
|
108
regex.patch
108
regex.patch
|
@ -1,108 +0,0 @@
|
||||||
diff --git .dev-tools/generate-regex-format-referrers.php .dev-tools/generate-regex-format-referrers.php
|
|
||||||
index d42c289..6f63814 100755
|
|
||||||
--- .dev-tools/generate-regex-format-referrers.php
|
|
||||||
+++ .dev-tools/generate-regex-format-referrers.php
|
|
||||||
@@ -1,17 +1,20 @@
|
|
||||||
<?php
|
|
||||||
- /* Regex Formatting Generator Script for the Nginx Ultimate Bad Bot Blocker
|
|
||||||
- * Adapted from Script Copyright (c) 2017 Stevie-Ray - https://github.com/Stevie-Ray
|
|
||||||
- * Adapted by: Mitchell Krog (mitchellkrog@gmail.com) - https://github.com/mitchellkrogza
|
|
||||||
- * Repo Url: https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker
|
|
||||||
- */
|
|
||||||
+
|
|
||||||
+/* Regex Formatting Generator Script for the Nginx Ultimate Bad Bot Blocker
|
|
||||||
+ * Adapted from Script Copyright (c) 2017 Stevie-Ray - https://github.com/Stevie-Ray
|
|
||||||
+ * Adapted by: Mitchell Krog (mitchellkrog@gmail.com) - https://github.com/mitchellkrogza
|
|
||||||
+ * Repo Url: https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
namespace mitchellkrogza;
|
|
||||||
|
|
||||||
use Mso\IdnaConvert\IdnaConvert;
|
|
||||||
|
|
||||||
class Generator
|
|
||||||
{
|
|
||||||
-
|
|
||||||
+
|
|
||||||
private $projectUrl = "https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker";
|
|
||||||
+
|
|
||||||
public function generateFiles()
|
|
||||||
{
|
|
||||||
date_default_timezone_set('Africa/Johannesburg');
|
|
||||||
@@ -20,7 +23,6 @@ class Generator
|
|
||||||
$this->createNginx($lines);
|
|
||||||
}
|
|
||||||
|
|
||||||
-
|
|
||||||
/**
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
@@ -42,7 +44,6 @@ class Generator
|
|
||||||
$IDN = new IdnaConvert();
|
|
||||||
|
|
||||||
$line = $IDN->encode($line);
|
|
||||||
-
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($line)) {
|
|
||||||
@@ -50,9 +51,12 @@ class Generator
|
|
||||||
}
|
|
||||||
$lines[] = $line;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
fclose($handle);
|
|
||||||
$uniqueLines = array_unique($lines, SORT_STRING);
|
|
||||||
sort($uniqueLines, SORT_STRING);
|
|
||||||
+
|
|
||||||
+
|
|
||||||
if (is_writable($domainsFile)) {
|
|
||||||
file_put_contents($domainsFile, implode("\n", $uniqueLines));
|
|
||||||
} else {
|
|
||||||
@@ -62,35 +66,37 @@ class Generator
|
|
||||||
return $lines;
|
|
||||||
}
|
|
||||||
|
|
||||||
- /**
|
|
||||||
+ /**
|
|
||||||
* Write to File Function
|
|
||||||
* @param $filename
|
|
||||||
* @param $data
|
|
||||||
*/
|
|
||||||
protected function writeToFile($filename, $data)
|
|
||||||
{
|
|
||||||
- $file = "/home/travis/build/mitchellkrogza/nginx-ultimate-bad-bot-blocker/.dev-tools/referrers-regex-format.txt";
|
|
||||||
- $handle = fopen($file, 'w') or die('Cannot open file: '.$file);
|
|
||||||
- fwrite($handle, $data);
|
|
||||||
+ $file = "/home/travis/build/mitchellkrogza/nginx-ultimate-bad-bot-blocker/.dev-tools/referrers-regex-format.txt";
|
|
||||||
+ $handle = fopen($file, 'w') or die('Cannot open file: ' . $file);
|
|
||||||
+ fwrite($handle, $data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $date
|
|
||||||
* @param array $lines
|
|
||||||
*/
|
|
||||||
- public function createNginx(array $lines)
|
|
||||||
+ public function createNginx(array $lines)
|
|
||||||
{
|
|
||||||
- $file = "/home/travis/build/mitchellkrogza/nginx-ultimate-bad-bot-blocker/.dev-tools/referrers-regex-format.txt";
|
|
||||||
+ $file = "/home/travis/build/mitchellkrogza/nginx-ultimate-bad-bot-blocker/.dev-tools/referrers-regex-format.txt";
|
|
||||||
$data = "";
|
|
||||||
- {
|
|
||||||
+
|
|
||||||
foreach ($lines as $line) {
|
|
||||||
//$data .= "\"~*" "\\" "b" . preg_quote($line) . "\\" "b" "\" \t1;\n";
|
|
||||||
//$data .= "\" . "~*\\" . 'b' . preg_quote($line) . "\" . '\\' . 'b' "\" "\t1;\n";
|
|
||||||
- $data .= "\" . "~\" . '\b' . preg_quote($line) . "\" . '\' . '\b' "\t1;\n";
|
|
||||||
+ //$data .= "\" . "~\\" . '\b' . preg_quote($line) . "\" . '\' . '\b' "\t1\n";
|
|
||||||
+ $data .= '\\' . '~\\' . "\\" . "b" . preg_quote($line) . "\\" . "b \t1\n";
|
|
||||||
}
|
|
||||||
$this->writeToFile($file, $data);
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
}
|
|
||||||
+
|
|
||||||
$generator = new Generator();
|
|
||||||
$generator->generateFiles();
|
|
Loading…
Add table
Reference in a new issue