Module: Ronin::Web::UserAgents::Firefox
- Defined in:
- lib/ronin/web/user_agents/firefox.rb
Overview
Represents all possible Firefox User-Agent
strings.
Constant Summary collapse
- DESKTOP_GECKO_VERSION =
The default
Gecko/...
version.@note: On desktop, the
Gecko/...
version is hardcoded to20100101
'20100101'
- ENCRYPTION =
Encryption Strengths.
{ usa: 'U', international: 'I', none: 'N', no: 'N', nil => nil }
- DEVICE_TYPES =
Common device types.
{ mobile: 'Mobile', tablet: 'Tablet', nil => nil }
- KNOWN_VERSIONS =
Known versions for the
rv:...
andFirefox/...
values. File.readlines( File.join(DATA_DIR,'firefox','versions.txt'), chomp: true )
- SUPPORTED_OSES =
Supported Operating Systems.
[ :windows, :macos, :linux, :android ]
- KNOWN_OS_VERSIONS =
Known OS versions grouped by OS.
{ windows: OS::Windows::VERSIONS.keys, macos: OS::MacOS::VERSIONS, linux: [], android: OS::Android::VERSIONS }
- SUPPORTED_OS_ARCHES =
Supported architectures grouped by OS.
{ windows: OS::Windows::ARCHES.keys, macos: OS::MacOS::ARCHES.keys, linux: OS::Linux::ARCHES.keys, android: OS::Android::ARCHES.keys }
- SUPPORTED_LINUX_DISTROS =
Supported Linux Distros.
OS::Linux::DISTROS.keys
- SUPPORTED_ENCRYPTION =
Supported encryption strengths.
ENCRYPTION.keys
- KNOWN_LANGS =
IETF language tags (ex:
en-GB
). File.readlines( File.join(DATA_DIR,'firefox','langs.txt'), chomp: true )
- SUPPORTED_DEVICE_TYPES =
Supported device types.
DEVICE_TYPES.keys
Class Method Summary collapse
-
.build(firefox_version:, lang: nil, encryption: nil, os:, os_version: nil, linux_distro: nil, arch: nil, device_type: nil) ⇒ String
Builds a new Firefox
User-Agent
string. -
.random(firefox_version: KNOWN_VERSIONS.sample, encryption: SUPPORTED_ENCRYPTION.sample, lang: KNOWN_LANGS.sample, os: SUPPORTED_OSES.sample, os_version: KNOWN_OS_VERSIONS[os].sample, linux_distro: SUPPORTED_LINUX_DISTROS.sample, arch: SUPPORTED_OS_ARCHES[os].sample, device_type: DEVICE_TYPES.keys.sample) ⇒ String
Generates a random Firefox
User-Agent
string.
Class Method Details
.build(firefox_version:, lang: nil, encryption: nil, os:, os_version: nil, linux_distro: nil, arch: nil, device_type: nil) ⇒ String
Builds a new Firefox User-Agent
string.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/ronin/web/user_agents/firefox.rb', line 97 def self.build(firefox_version: , lang: nil, encryption: nil, os: , os_version: nil, linux_distro: nil, arch: nil, device_type: nil) case os when :windows unless os_version raise(ArgumentError,"os: :windows also requires an os_version: value") end build_windows( windows_version: os_version, arch: arch, firefox_version: firefox_version ) when :macos unless os_version raise(ArgumentError,"os: :macos also requires an os_version: value") end build_macos( arch: arch || :intel, macos_version: os_version, firefox_version: firefox_version ) when :linux build_linux( encryption: encryption, linux_distro: linux_distro, arch: arch, lang: lang, firefox_version: firefox_version ) when :android build_android( device_type: device_type || :mobile, firefox_version: firefox_version ) else raise(ArgumentError,"unsupported os: value (#{os.inspect})") end end |
.random(firefox_version: KNOWN_VERSIONS.sample, encryption: SUPPORTED_ENCRYPTION.sample, lang: KNOWN_LANGS.sample, os: SUPPORTED_OSES.sample, os_version: KNOWN_OS_VERSIONS[os].sample, linux_distro: SUPPORTED_LINUX_DISTROS.sample, arch: SUPPORTED_OS_ARCHES[os].sample, device_type: DEVICE_TYPES.keys.sample) ⇒ String
Generates a random Firefox User-Agent
string.
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/ronin/web/user_agents/firefox.rb', line 228 def self.random(firefox_version: KNOWN_VERSIONS.sample, encryption: SUPPORTED_ENCRYPTION.sample, lang: KNOWN_LANGS.sample, os: SUPPORTED_OSES.sample, os_version: KNOWN_OS_VERSIONS[os].sample, linux_distro: SUPPORTED_LINUX_DISTROS.sample, arch: SUPPORTED_OS_ARCHES[os].sample, device_type: DEVICE_TYPES.keys.sample) build( firefox_version: firefox_version, os: os, os_version: os_version, device_type: device_type, linux_distro: linux_distro, arch: arch, lang: lang ) end |