From 32cb6f86f476045cae8526916899ff6f275a99fc Mon Sep 17 00:00:00 2001 From: erwanlr Date: Sat, 9 Nov 2013 10:41:26 +0000 Subject: [PATCH 1/2] Better fix for Kali --- lib/common/common_helper.rb | 4 ++++ lib/environment.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/common/common_helper.rb b/lib/common/common_helper.rb index b8e382a8..1b32e51a 100644 --- a/lib/common/common_helper.rb +++ b/lib/common/common_helper.rb @@ -39,6 +39,10 @@ $LOAD_PATH.unshift(LIB_DIR) $LOAD_PATH.unshift(WPSCAN_LIB_DIR) $LOAD_PATH.unshift(MODELS_LIB_DIR) +def kali_linux? + %x{uname -a} =~ /kali/i +end + require 'environment' # TODO : add an exclude pattern ? diff --git a/lib/environment.rb b/lib/environment.rb index 75362c8f..479bbfd7 100644 --- a/lib/environment.rb +++ b/lib/environment.rb @@ -13,7 +13,7 @@ Encoding.default_external = Encoding::UTF_8 begin # Standard libs - require 'bundler/setup' + require 'bundler/setup' unless kali_linux? require 'getoptlong' require 'optparse' # Will replace getoptlong require 'uri' From 5e38d68adbc44968583a38bbd86dd4f14371055f Mon Sep 17 00:00:00 2001 From: erwanlr Date: Sat, 9 Nov 2013 11:26:49 +0000 Subject: [PATCH 2/2] Properly create the cache directory (Kali issue) --- .gitignore | 2 +- cache/.gitignore | 4 ---- lib/common/cache_file_store.rb | 2 +- lib/environment.rb | 1 + 4 files changed, 3 insertions(+), 6 deletions(-) delete mode 100644 cache/.gitignore diff --git a/.gitignore b/.gitignore index 67f6f665..59013f4e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -cache/* +cache coverage .bundle .DS_Store diff --git a/cache/.gitignore b/cache/.gitignore deleted file mode 100644 index 5e7d2734..00000000 --- a/cache/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# Ignore everything in this directory -* -# Except this file -!.gitignore diff --git a/lib/common/cache_file_store.rb b/lib/common/cache_file_store.rb index a9df5d5b..6f7cf2ec 100644 --- a/lib/common/cache_file_store.rb +++ b/lib/common/cache_file_store.rb @@ -24,7 +24,7 @@ class CacheFileStore # File.directory? for ruby <= 1.9 otherwise, # it makes more sense to do Dir.exist? :/ unless File.directory?(@storage_path) - Dir.mkdir(@storage_path) + FileUtils.mkdir_p(@storage_path) end end diff --git a/lib/environment.rb b/lib/environment.rb index 479bbfd7..ac7b8c0b 100644 --- a/lib/environment.rb +++ b/lib/environment.rb @@ -27,6 +27,7 @@ begin require 'rbconfig' require 'pp' require 'shellwords' + require 'fileutils' # Third party libs require 'typhoeus' require 'json'