Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/lib/rex/user_agent.rb
Views: 11766
# -*- coding: binary -*-12#3# A helper module for using and referencing coming user agent strings.4#5module Rex::UserAgent67#8# Taken from https://www.whatismybrowser.com/guides/the-latest-user-agent/9#10COMMON_AGENTS = [11'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36', # Chrome Windows12'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36', # Chrome MacOS1314'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36 Edg/129.0.2792.79', # Edge Windows1516'Mozilla/5.0 (iPad; CPU OS 17_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Mobile/15E148 Safari/604.1', # Safari iPad17'Mozilla/5.0 (Macintosh; Intel Mac OS X 14_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Safari/605.1.15', # Safari MacOS1819'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0', # Firefox Windows20'Mozilla/5.0 (Macintosh; Intel Mac OS X 14.7; rv:131.0) Gecko/20100101 Firefox/131.0' # Firefox MacOS21]2223#24# A randomly-selected agent that will be consistent for the duration of metasploit running25#26def self.session_agent27if @@session_agent28@@session_agent29else30@@session_agent = self.random31end32end3334@@session_agent = nil3536#37# Pick a random agent from the common agent list.38#39def self.random40COMMON_AGENTS.sample41end4243#44# Choose the agent with the shortest string (for use in payloads)45#46def self.shortest47@@shortest_agent ||= COMMON_AGENTS.min { |a, b| a.size <=> b.size }48end4950#51# Choose the most frequent user agent52#53def self.most_common54COMMON_AGENTS[0]55end5657end585960