From 89e20883577e79d4672cbbb229cfd38148b26ebe Mon Sep 17 00:00:00 2001 From: Christian Mehlmauer Date: Thu, 6 Oct 2016 20:35:29 +0200 Subject: [PATCH] fix #1008 --- dev/stats.rb | 2 +- lib/common/common_helper.rb | 2 +- lib/wpscan/wpscan_helper.rb | 2 +- spec/lib/wpscan/wp_target_spec.rb | 2 +- spec/lib/wpscan/wpscan_options_spec.rb | 2 +- spec/spec_helper.rb | 2 +- stop_user_enumeration_bypass.rb | 2 +- wpscan.rb | 4 ++-- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dev/stats.rb b/dev/stats.rb index b0b61cf0..24e70279 100755 --- a/dev/stats.rb +++ b/dev/stats.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # encoding: UTF-8 -require File.dirname(__FILE__) + '/../lib/wpscan/wpscan_helper' +require File.expand_path(File.join(__dir__, '..', 'lib', 'wpscan', 'wpscan_helper')) wordpress_json = json(WORDPRESSES_FILE) plugins_json = json(PLUGINS_FILE) diff --git a/lib/common/common_helper.rb b/lib/common/common_helper.rb index 95966ad6..152ae480 100644 --- a/lib/common/common_helper.rb +++ b/lib/common/common_helper.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 -LIB_DIR = File.expand_path(File.join(File.dirname(__FILE__), '..')) +LIB_DIR = File.expand_path(File.join(__dir__, '..')) ROOT_DIR = File.expand_path(File.join(LIB_DIR, '..')) # expand_path is used to get "wpscan/" instead of "wpscan/lib/../" DATA_DIR = File.join(ROOT_DIR, 'data') CONF_DIR = File.join(ROOT_DIR, 'conf') diff --git a/lib/wpscan/wpscan_helper.rb b/lib/wpscan/wpscan_helper.rb index 48c965c2..8b82a0c7 100644 --- a/lib/wpscan/wpscan_helper.rb +++ b/lib/wpscan/wpscan_helper.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 -require File.expand_path(File.dirname(__FILE__) + '/../common/common_helper') +require File.expand_path(File.join(__dir__, '..', 'common', 'common_helper')) require_files_from_directory(WPSCAN_LIB_DIR, '**/*.rb') diff --git a/spec/lib/wpscan/wp_target_spec.rb b/spec/lib/wpscan/wp_target_spec.rb index bd212b20..bc656848 100644 --- a/spec/lib/wpscan/wp_target_spec.rb +++ b/spec/lib/wpscan/wp_target_spec.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 -require File.expand_path(File.dirname(__FILE__) + '/wpscan_helper') +require File.expand_path(File.join(__dir__, 'wpscan_helper')) describe WpTarget do subject(:wp_target) { WpTarget.new(target_url, options) } diff --git a/spec/lib/wpscan/wpscan_options_spec.rb b/spec/lib/wpscan/wpscan_options_spec.rb index 2d689a25..c60555c1 100644 --- a/spec/lib/wpscan/wpscan_options_spec.rb +++ b/spec/lib/wpscan/wpscan_options_spec.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 -require File.expand_path(File.dirname(__FILE__) + '/wpscan_helper') +require File.expand_path(File.join(__dir__, 'wpscan_helper')) describe 'WpscanOptions' do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 4f2a9df4..31dcd4fa 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -7,7 +7,7 @@ require 'simplecov' if RUBY_VERSION >= '1.9' RSpec::Expectations.configuration.warn_about_potential_false_positives = false -require File.expand_path(File.dirname(__FILE__) + '/../lib/common/common_helper') +require File.expand_path(File.join(__dir__, '..', 'lib', 'common', 'common_helper')) SPEC_DIR = ROOT_DIR + '/spec' SPEC_LIB_DIR = SPEC_DIR + '/lib' diff --git a/stop_user_enumeration_bypass.rb b/stop_user_enumeration_bypass.rb index 390dbeb2..2d247ae0 100755 --- a/stop_user_enumeration_bypass.rb +++ b/stop_user_enumeration_bypass.rb @@ -4,7 +4,7 @@ # # Script based on http://seclists.org/fulldisclosure/2014/Feb/3 -require File.join(File.dirname(__FILE__), 'lib/wpscan/wpscan_helper') +require File.join(__dir__, 'lib', 'wpscan', 'wpscan_helper') @opts = { ids: 1..10, diff --git a/wpscan.rb b/wpscan.rb index fb750016..f5f403bd 100755 --- a/wpscan.rb +++ b/wpscan.rb @@ -5,7 +5,7 @@ $: << '.' $exit_code = 0 -require File.dirname(__FILE__) + '/lib/wpscan/wpscan_helper' +require File.join(__dir__, 'lib', 'wpscan', 'wpscan_helper') def main # delete old logfile, check if it is a symlink first. @@ -376,7 +376,7 @@ def main puts info('Enumerating usernames ...') if wp_target.has_plugin?('stop-user-enumeration') - puts warning("Stop User Enumeration plugin detected, results might be empty. However a bypass exists for v1.2.8 and below, see stop_user_enumeration_bypass.rb in #{File.expand_path(File.dirname(__FILE__))}") + puts warning("Stop User Enumeration plugin detected, results might be empty. However a bypass exists for v1.2.8 and below, see stop_user_enumeration_bypass.rb in #{__dir__}") end wp_users = WpUsers.aggressive_detection(wp_target,