From 37839e819068b521c6715d6b17d0a37d6f486d28 Mon Sep 17 00:00:00 2001
From: virus2500 <virus2500@me.com>
Date: Tue, 29 Apr 2014 22:20:44 +0200
Subject: [PATCH] Path to Black and Whitelist is now set automatically

---
 README.md    | 21 +++++----------------
 blocklist.pl |  5 +++--
 2 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/README.md b/README.md
index 026da96..8fc66b3 100644
--- a/README.md
+++ b/README.md
@@ -6,6 +6,8 @@ Create an ipset based blocklist from an text file (downloaded from e.g. blocklis
 
 Changes
 --------
+V1.0.4: Path to white and blacklist is now set automatically
+
 V1.0.3: Now you can set multiple blocklist sources
 
 V1.0.2: Added a whitelist and blacklist
@@ -15,25 +17,12 @@ V1.0.2: Added a whitelist and blacklist
 
 You will need to install ipset!
 
+Also you will have to specify where your binarys are located. This settings can be made in blocklist.pl .
 
-If you want to run the script as an cronjob you will have to specify the absolute path to the whitelist.txt and blacklist.txt in blocklist.pl
-
-my $whiteList = "whitelist.txt";
-
-my $blackList = "blacklist.txt";
-
-to e.g.
-
-my $whiteList = "/scripts/blocklist/whitelist.txt";
-
-my $blackList = "/scripts/blocklist/blacklist.txt"
-
-where /scripts/blocklist/ is the path to the white and blacklist file!
-
+(You can find out where your binarys are with "which" e.g. "which iptables")
 
-While in blocklist.pl please also specify and verify where your binarys are located.
 
-(These can be found via "which" e.g. "which iptables")
+These values need to verified for your system:
 
 my $iptables = "/sbin/iptables";
 
diff --git a/blocklist.pl b/blocklist.pl
index d7dd8c8..9c0cf48 100755
--- a/blocklist.pl
+++ b/blocklist.pl
@@ -1,6 +1,7 @@
 #!/usr/bin/perl
 use strict; 
 use warnings;
+use FindBin '$Bin';
 ################################################################
 ###### Script to check Blocklist.de list. Block new IP    ###### 
 ###### and unblock deleted entrys                         ###### 
@@ -10,8 +11,8 @@ use warnings;
 my @listUrl = ("http://lists.blocklist.de/lists/all.txt", "http://www.infiltrated.net/blacklisted");
 my $tmpDir = "/tmp";
 my $logFile = "/var/log/blocklist";
-my $whiteList = "whitelist.txt";
-my $blackList = "blacklist.txt";
+my $whiteList = "$Bin/whitelist.txt";
+my $blackList = "$Bin/blacklist.txt";
 
 ## binarys ##
 my $iptables = "/sbin/iptables";
-- 
GitLab