summaryrefslogtreecommitdiff
path: root/lib/rbot
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2009-01-27 21:54:59 +0100
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2009-01-27 21:54:59 +0100
commitd617583171610f5d9fce1efcff0b5b568ca79086 (patch)
tree731d3f17502f131df4fea0f75bb964a78aa5d467 /lib/rbot
parent102fab9a892f39bc77a92db37f6f77f77a7f0f2f (diff)
wordlist: exist? method
The new Wordlist.exist? method can be used to check if a wordlist file exists. It will refuse to check upstream of the wordlist base directory
Diffstat (limited to 'lib/rbot')
-rwxr-xr-xlib/rbot/core/utils/wordlist.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/rbot/core/utils/wordlist.rb b/lib/rbot/core/utils/wordlist.rb
index 63cc99a7..875a9756 100755
--- a/lib/rbot/core/utils/wordlist.rb
+++ b/lib/rbot/core/utils/wordlist.rb
@@ -52,6 +52,14 @@ class Wordlist
name[striplen..-1]
}
end
+
+ def self.exist?(path)
+ fn = path.to_s
+ # refuse to check outside of the wordlist base directory
+ return false if fn =~ /\.\.\//
+ File.exist?(File.join(self.wordlist_base, fn))
+ end
+
end
end
end