spoofagent 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/spoof.rb +72 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7a9007c7093bee86853c3ca576088bdd9f38ca6e12ea5e76babb5cdd940fecdb
|
4
|
+
data.tar.gz: 8593dcde3b81b089321043f9c4fe4bc16cb8b6618cfad1f582498e9bdb563252
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8b4870d4ef8dd3e3f8768d894ce0078cae769a1c1cd31fa7ea910d6e16212f766b011468c65d48acce1a13b1dba5804814e4c3882a8685dea3701cada89d0648
|
7
|
+
data.tar.gz: 4284887abc1334f2df60f70a408e10b0e7ccc624b59b23adc8a53502515f7d02567110615ab4b6759a4444215a4c3eb5423f4e255f0165fd605712cf46778d8c
|
data/lib/spoof.rb
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'securerandom'
|
2
|
+
|
3
|
+
class UserAgentGenerator
|
4
|
+
def initialize
|
5
|
+
@user_agents = {
|
6
|
+
'chrome' => [
|
7
|
+
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%{version}.0.%{build}.0 Safari/537.36',
|
8
|
+
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%{version}.0.%{build}.0 Safari/537.36',
|
9
|
+
'Mozilla/5.0 (Linux; Android %{android_version}; Nexus 5X Build/N2G48H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%{version}.0.%{build}.0 Mobile Safari/537.36',
|
10
|
+
],
|
11
|
+
'firefox' => [
|
12
|
+
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:%{version}.0) Gecko/20100101 Firefox/%{version}.0',
|
13
|
+
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7; rv:%{version}.0) Gecko/20100101 Firefox/%{version}.0',
|
14
|
+
'Mozilla/5.0 (Linux; Android %{android_version}; Nexus 5 Build/MRA58N) Gecko/20100101 Firefox/%{version}.0',
|
15
|
+
],
|
16
|
+
'safari' => [
|
17
|
+
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/%{version}.0.0.0 Safari/605.1.15',
|
18
|
+
'Mozilla/5.0 (iPhone; CPU iPhone OS %{ios_version} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/%{version}.0 Mobile/15E148 Safari/604.1',
|
19
|
+
],
|
20
|
+
'edge' => [
|
21
|
+
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%{version}.0.%{build}.0 Safari/537.36 Edg/%{version}.0.%{build}',
|
22
|
+
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; Trident/7.0; AS; rv:%{version}.0) like Gecko',
|
23
|
+
],
|
24
|
+
'ie' => [
|
25
|
+
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; Trident/7.0; AS; rv:%{version}.0) like Gecko',
|
26
|
+
'Mozilla/5.0 (compatible; MSIE %{version}.0; Windows NT 10.0; Trident/7.0)',
|
27
|
+
],
|
28
|
+
'android' => [
|
29
|
+
'Mozilla/5.0 (Linux; Android %{android_version}; Nexus 5X Build/N2G48H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%{version}.0.%{build}.0 Mobile Safari/537.36',
|
30
|
+
'Mozilla/5.0 (Linux; Android %{android_version}; SAMSUNG SM-G920F Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%{version}.0.%{build}.0 Mobile Safari/537.36',
|
31
|
+
'Mozilla/5.0 (Linux; Android %{android_version}; Redmi 6A) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%{version}.0.%{build}.0 Mobile Safari/537.36',
|
32
|
+
'Mozilla/5.0 (Linux; Android %{android_version}; Infinix X6837 Build/TP1A.220624.014; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/%{version}.0.%{build}.0 Mobile Safari/',
|
33
|
+
],
|
34
|
+
'ios' => [
|
35
|
+
'Mozilla/5.0 (iPhone; CPU iPhone OS %{ios_version} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/%{version}.0 Mobile/15E148 Safari/604.1',
|
36
|
+
'Mozilla/5.0 (iPad; CPU OS %{ios_version} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/%{version}.0 Mobile/15E148 Safari/604.1',
|
37
|
+
],
|
38
|
+
'linux' => [
|
39
|
+
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%{version}.0.%{build}.0 Safari/537.36',
|
40
|
+
'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%{version}.0.%{build}.0 Safari/537.36',
|
41
|
+
],
|
42
|
+
'mac' => [
|
43
|
+
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%{version}.0.%{build}.0 Safari/537.36',
|
44
|
+
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7; rv:%{version}.0) Gecko/20100101 Firefox/%{version}.0',
|
45
|
+
],
|
46
|
+
'windows' => [
|
47
|
+
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%{version}.0.%{build}.0 Safari/537.36',
|
48
|
+
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; Trident/7.0; AS; rv:%{version}.0) like Gecko',
|
49
|
+
]
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
def generate_user_agent(platform, version = nil, build = nil, android_version = nil, ios_version = nil)
|
54
|
+
raise ArgumentError, "Platform not supported. Choose from: #{@user_agents.keys.join(', ')}" unless @user_agents.key?(platform)
|
55
|
+
|
56
|
+
user_agent_template = @user_agents[platform].sample
|
57
|
+
|
58
|
+
version ||= rand(80..100).to_s
|
59
|
+
build ||= rand(1000..9999).to_s
|
60
|
+
android_version ||= rand(4..14).to_s
|
61
|
+
ios_version ||= rand(10..15).to_s
|
62
|
+
|
63
|
+
user_agent = user_agent_template % {
|
64
|
+
version: version,
|
65
|
+
build: build,
|
66
|
+
android_version: android_version,
|
67
|
+
ios_version: ios_version
|
68
|
+
}
|
69
|
+
|
70
|
+
user_agent
|
71
|
+
end
|
72
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spoofagent
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- VampXDH
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-09-28 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A Ruby library for generating fake user agents from multiple platforms.
|
14
|
+
email:
|
15
|
+
- bagasmuhammadriszki2@gmail.com@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/spoof.rb
|
21
|
+
homepage: https://github.com/VampXDH/spoofagentrb
|
22
|
+
licenses:
|
23
|
+
- MIT
|
24
|
+
metadata: {}
|
25
|
+
post_install_message:
|
26
|
+
rdoc_options: []
|
27
|
+
require_paths:
|
28
|
+
- lib
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
requirements: []
|
40
|
+
rubygems_version: 3.5.16
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Generate random user agents for various platforms.
|
44
|
+
test_files: []
|