CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/lib/rex/user_agent.rb
Views: 1904
# -*- 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# Chrome12'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36',13'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36',1415# Edge16'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.2420.65',1718# Safari19'Mozilla/5.0 (iPad; CPU OS 17_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.3.1 Mobile/15E148 Safari/604.1',20'Mozilla/5.0 (Macintosh; Intel Mac OS X 14_4_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.3.1 Safari/605.1.15',2122# Firefox23'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0',24'Mozilla/5.0 (Macintosh; Intel Mac OS X 14.4; rv:124.0) Gecko/20100101 Firefox/124.0'25]2627#28# A randomly-selected agent that will be consistent for the duration of metasploit running29#30def self.session_agent31if @@session_agent32@@session_agent33else34@@session_agent = self.random35end36end3738@@session_agent = nil3940#41# Pick a random agent from the common agent list.42#43def self.random44COMMON_AGENTS.sample45end4647#48# Choose the agent with the shortest string (for use in payloads)49#50def self.shortest51@@shortest_agent ||= COMMON_AGENTS.min { |a, b| a.size <=> b.size }52end5354#55# Choose the most frequent user agent56#57def self.most_common58COMMON_AGENTS[0]59end6061end62636465