Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/core/main/constants/os.rb
1154 views
1
#
2
# Copyright (c) 2006-2025 Wade Alcorn - [email protected]
3
# Browser Exploitation Framework (BeEF) - https://beefproject.com
4
# See the file 'doc/COPYING' for copying permission
5
#
6
7
module BeEF
8
module Core
9
module Constants
10
# @note The OS'es strings for os detection.
11
module Os
12
OS_UNKNOWN_IMG = 'unknown.png'
13
OS_WINDOWS_UA_STR = 'Windows'
14
OS_WINDOWS_IMG = 'win.png'
15
OS_LINUX_UA_STR = 'Linux'
16
OS_LINUX_IMG = 'linux.png'
17
OS_MAC_UA_STR = 'Mac'
18
OS_MAC_IMG = 'mac.png'
19
OS_QNX_UA_STR = 'QNX'
20
OS_QNX_IMG = 'qnx.ico'
21
OS_SUNOS_UA_STR = 'SunOS'
22
OS_SUNOS_IMG = 'sunos.gif'
23
OS_BEOS_UA_STR = 'BeOS'
24
OS_BEOS_IMG = 'beos.png'
25
OS_OPENBSD_UA_STR = 'OpenBSD'
26
OS_OPENBSD_IMG = 'openbsd.ico'
27
OS_IOS_UA_STR = 'iOS'
28
OS_IOS_IMG = 'ios.png'
29
OS_IPHONE_UA_STR = 'iPhone'
30
OS_WEBOS_IMG = 'webos.png'
31
OS_AROS_UA_STR = 'AROS'
32
OS_AROS_IMG = 'icaros.png'
33
OS_IPHONE_IMG = 'iphone.jpg'
34
OS_IPAD_UA_STR = 'iPad'
35
OS_IPAD_IMG = 'ipad.png'
36
OS_IPOD_UA_STR = 'iPod'
37
OS_IPOD_IMG = 'ipod.jpg'
38
OS_MAEMO_UA_STR = 'Maemo'
39
OS_MAEMO_IMG = 'maemo.ico'
40
OS_BLACKBERRY_UA_STR = 'BlackBerry'
41
OS_BLACKBERRY_IMG = 'blackberry.png'
42
OS_ANDROID_UA_STR = 'Android'
43
OS_ANDROID_IMG = 'android.png'
44
OS_ALL_UA_STR = 'All'
45
46
# Attempt to match operating system string to constant
47
# @param [String] name Name of operating system
48
# @return [String] Constant name of matched operating system, returns 'ALL' if nothing are matched
49
def self.match_os(name)
50
case name.downcase
51
when /win/
52
OS_WINDOWS_UA_STR
53
when /lin/
54
OS_LINUX_UA_STR
55
when /os x/, /osx/, /mac/
56
OS_MAC_UA_STR
57
when /qnx/
58
OS_QNX_UA_STR
59
when /sun/
60
OS_SUNOS_UA_STR
61
when /beos/
62
OS_BEOS_UA_STR
63
when /openbsd/
64
OS_OPENBSD_UA_STR
65
when /ios/, /iphone/, /ipad/, /ipod/
66
OS_IOS_UA_STR
67
when /maemo/
68
OS_MAEMO_UA_STR
69
when /blackberry/
70
OS_BLACKBERRY_UA_STR
71
when /android/
72
OS_ANDROID_UA_STR
73
when /aros/
74
OS_AROS_UA_STR
75
else
76
'ALL'
77
end
78
end
79
end
80
end
81
end
82
end
83
84