Module: Ronin::Web::UserAgents::InternetArchive
- Defined in:
- lib/ronin/web/user_agents/internet_archive.rb
Constant Summary collapse
- HEX_CHARS =
%w[0 1 2 3 4 5 6 7 8 9 a b c d e f]
Class Method Summary collapse
-
.build(date:, bot_id:) ⇒ String
Builds an Internet Archive crawler
User-Agent
string. -
.random(date: Date.today, bot_id: random_hex_id) ⇒ String
Generates a random Internet Archive
User-Agent
String. -
.random_hex_id ⇒ String
Generates a random hex ID.
Class Method Details
.build(date:, bot_id:) ⇒ String
Builds an Internet Archive crawler User-Agent
string.
48 49 50 51 52 |
# File 'lib/ronin/web/user_agents/internet_archive.rb', line 48 def self.build(date: , bot_id: ) = date.strftime("%Y%m%d") return "ArchiveTeam ArchiveBot/#{}.#{bot_id} (wpull 2.0.3) and not Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36" end |
.random(date: Date.today, bot_id: random_hex_id) ⇒ String
Generates a random Internet Archive User-Agent
String.
66 67 68 |
# File 'lib/ronin/web/user_agents/internet_archive.rb', line 66 def self.random(date: Date.today, bot_id: random_hex_id) build(date: date, bot_id: bot_id) end |
.random_hex_id ⇒ String
Generates a random hex ID.
32 33 34 |
# File 'lib/ronin/web/user_agents/internet_archive.rb', line 32 def self.random_hex_id Array.new(7) { HEX_CHARS.sample }.join end |