Class: Ronin::Web::CLI::Commands::UserAgent Private
- Inherits:
-
Ronin::Web::CLI::Command
- Object
- Core::CLI::Command
- Ronin::Web::CLI::Command
- Ronin::Web::CLI::Commands::UserAgent
- Defined in:
- lib/ronin/web/cli/commands/user_agent.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Generates a random HTTP User-Agent
string.
Usage
ronin-web user_agent [options]
Options
-B, --browser chrome|firefox The desired browser
--chrome-version VERSION The desired Chrome version
--firefox-version VERSION The desired Firefox version
-D ubuntu|fedora|arch|DISTRO, The desired Linux distro
--linux-distro
-A x86-64|x86|i686|aarch64|arm64|arm,
--arch The desired architecture
-O, --os android|linux|windows The desired OS
--os-version VERSION The desired OS version
-h, --help Print help information
Instance Method Summary collapse
-
#random_kwargs ⇒ Hash{Symbol => Object}
private
Generates keyword arguments for
Ronin::Web::UserAgents.random
,Ronin::Web::UserAgents.chrome.random
, orRonin::Web::UserAgents.firefox.random
. -
#run ⇒ Object
private
Runs the
ronin-web user-agent
command.
Instance Method Details
#random_kwargs ⇒ Hash{Symbol => Object}
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Generates keyword arguments for Ronin::Web::UserAgents.random
,
Ronin::Web::UserAgents.chrome.random
, or
Ronin::Web::UserAgents.firefox.random
.
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/ronin/web/cli/commands/user_agent.rb', line 143 def random_kwargs kwargs = {} if [:chrome_version] && [:browser] == :chrome kwargs[:chrome_version] = [:chrome_version] end if [:firefox_version] && [:browser] == :firefox kwargs[:firefox_version] = [:firefox_version] end if [:os] kwargs[:os] = [:os] end if [:os_version] kwargs[:os_version] = [:os_version] end if [:linux_distro] kwargs[:linux_distro] = [:linux_distro] end if [:arch] kwargs[:arch] = [:arch] end return kwargs end |
#run ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Runs the ronin-web user-agent
command.
122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/ronin/web/cli/commands/user_agent.rb', line 122 def run case [:browser] when :chrome puts Web::UserAgents.chrome.random(**random_kwargs) when :firefox puts Web::UserAgents.firefox.random(**random_kwargs) when nil puts Web::UserAgents.random(**random_kwargs) else raise(NotImplementedError,"unsupported browser type: #{[:browser].inspect}") end end |