Class: Ronin::Wordlists::WordlistFile
- Inherits:
-
Object
- Object
- Ronin::Wordlists::WordlistFile
- Includes:
- WordlistMetadata
- Defined in:
- lib/ronin/wordlists/wordlist_file.rb
Overview
Represents a wordlist file.
Instance Attribute Summary collapse
-
#name ⇒ String
readonly
The name of the wordlist file.
-
#path ⇒ String
readonly
The path to the wordlist file.
Attributes included from WordlistMetadata
Class Method Summary collapse
-
.download(url, dest = Dir.pwd) ⇒ WordlistFile
Downloads a remote wordlist file.
Instance Method Summary collapse
-
#delete ⇒ Object
Deletes the wordlist file.
-
#filename ⇒ String
The name of the wordlist file.
-
#initialize(path, **kwargs) ⇒ WordlistFile
constructor
Initializes the wordlist file.
-
#to_s ⇒ String
Converts the wordlist file to a String.
-
#type ⇒ :file
The wordlist type.
-
#update ⇒ Object
Updates the wordlist file, if Ronin::Wordlists::WordlistMetadata#url is set.
Constructor Details
#initialize(path, **kwargs) ⇒ WordlistFile
Initializes the wordlist file.
60 61 62 63 64 65 |
# File 'lib/ronin/wordlists/wordlist_file.rb', line 60 def initialize(path,**kwargs) super(**kwargs) @path = path @name = File.basename(@path,File.extname(@path)) end |
Instance Attribute Details
#name ⇒ String (readonly)
The name of the wordlist file.
45 46 47 |
# File 'lib/ronin/wordlists/wordlist_file.rb', line 45 def name @name end |
#path ⇒ String (readonly)
The path to the wordlist file.
40 41 42 |
# File 'lib/ronin/wordlists/wordlist_file.rb', line 40 def path @path end |
Class Method Details
.download(url, dest = Dir.pwd) ⇒ WordlistFile
Downloads a remote wordlist file.
82 83 84 85 86 87 88 89 90 |
# File 'lib/ronin/wordlists/wordlist_file.rb', line 82 def self.download(url,dest=Dir.pwd) dest_path = begin Core::System.download(url,dest) rescue Core::System::DownloadFailed => error raise(DownloadFailed,error.) end return new(dest_path, url: url.to_s) end |
Instance Method Details
#delete ⇒ Object
Deletes the wordlist file.
125 126 127 |
# File 'lib/ronin/wordlists/wordlist_file.rb', line 125 def delete File.unlink(@path) end |
#filename ⇒ String
The name of the wordlist file.
106 107 108 |
# File 'lib/ronin/wordlists/wordlist_file.rb', line 106 def filename File.basename(@path) end |
#to_s ⇒ String
Converts the wordlist file to a String.
135 136 137 |
# File 'lib/ronin/wordlists/wordlist_file.rb', line 135 def to_s @path end |
#type ⇒ :file
The wordlist type.
97 98 99 |
# File 'lib/ronin/wordlists/wordlist_file.rb', line 97 def type :file end |
#update ⇒ Object
Updates the wordlist file, if Ronin::Wordlists::WordlistMetadata#url is set.
116 117 118 119 120 |
# File 'lib/ronin/wordlists/wordlist_file.rb', line 116 def update if @url self.class.download(@url,@path) end end |