Module: Ronin::Support::Network::HTTP::UserAgents
- Defined in:
- lib/ronin/support/network/http/user_agents.rb
Overview
Contains built-in User-Agent
strings for Ronin::Support::Network::HTTP.
Constant Summary collapse
- ALIASES =
Built-in
User-Agent
strings for impersonating various browsers. { chrome_linux: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36', chrome_macos: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36', chrome_windows: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36', chrome_iphone: 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/102.0.5005.87 Mobile/15E148 Safari/604.1', chrome_ipad: 'Mozilla/5.0 (iPad; CPU OS 15_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/102.0.5005.87 Mobile/15E148 Safari/604.1', chrome_android: 'Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.99 Mobile Safari/537.36', firefox_linux: 'Mozilla/5.0 (Linux x86_64; rv:101.0) Gecko/20100101 Firefox/101.0', firefox_macos: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 12.4; rv:101.0) Gecko/20100101 Firefox/101.0', firefox_windows: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0', firefox_iphone: 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/101.0 Mobile/15E148 Safari/605.1.15', firefox_ipad: 'Mozilla/5.0 (iPad; CPU OS 12_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/101.0 Mobile/15E148 Safari/605.1.15', firefox_android: 'Mozilla/5.0 (Android 12; Mobile; rv:68.0) Gecko/68.0 Firefox/101.0', safari_macos: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 12_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Safari/605.1.15', safari_iphone: 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1', safari_ipad: 'Mozilla/5.0 (iPad; CPU OS 15_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1', edge: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36 Edg/102.0.1245.33' }
Class Method Summary collapse
-
.[](id) ⇒ String
Returns a
User-Agent
string for the given ID.
Class Method Details
.[](id) ⇒ String
Returns a User-Agent
string for the given ID.
The new User-Agent
string to use. The acceptable values are:
:random
- a random value from ALIASES will be returned.:chrome
- a random ChromeUser-Agent
from ALIASES will be returned.:firefox
- a random FirefoxUser-Agent
from ALIASES will be returned.:safari
- a random SafariUser-Agent
from ALIASES will be returned.:linux
- a random LinuxUser-Agent
from ALIASES will be returned.:macos
- a random macOSUser-Agent
from ALIASES will be returned.:windows
- a random WindowsUser-Agent
from ALIASES will be returned.:iphone
- a random iPhoneUser-Agent
from ALIASES will be returned.:ipad
- a random iPadUser-Agent
from ALIASES will be returned.:android
- a random AndroidUser-Agent
from ALIASES will be returned.- Otherwise, the
User-Agent
String in ALIASES with the matching ID will be returned.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/ronin/support/network/http/user_agents.rb', line 94 def self.[](id) case id when :random ALIASES.values.sample when :chrome, :firefox, :safari # prefix ALIASES.select { |k,v| k =~ /^#{id}_/ }.values.sample when :linux, :macos, :windows, :iphone, :ipad, :android # suffix ALIASES.select { |k,v| k =~ /_#{id}$/ }.values.sample when Symbol ALIASES.fetch(id) do raise(ArgumentError,"unknown user agent alias: #{id.inspect}") end else raise(ArgumentError,"User-Agent ID must be a Symbol") end end |