CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/rex/proto/ipmi/channel_auth_reply.rb
Views: 11704
1
# -*- coding: binary -*-
2
3
require 'bindata'
4
5
module Rex
6
module Proto
7
module IPMI
8
9
class Channel_Auth_Reply < BinData::Record
10
endian :little
11
uint8 :rmcp_version ,label: "RMCP Version"
12
uint8 :rmcp_padding ,label: "RMCP Padding"
13
uint8 :rmcp_sequence ,label: "RMCP Sequence"
14
bit1 :rmcp_mtype ,label: "RMCP Message Type"
15
bit7 :rmcp_class ,label: "RMCP Message Class"
16
17
uint8 :session_auth_type ,label: "Session Auth Type"
18
uint32 :session_sequence ,label: "Session Sequence Number"
19
uint32 :session_id ,label: "Session ID"
20
uint8 :message_length ,label: "Message Length"
21
22
uint8 :ipmi_tgt_address ,label: "IPMI Target Address"
23
uint8 :ipmi_tgt_lun ,label: "IPMI Target LUN"
24
uint8 :ipmi_header_checksum ,label: "IPMI Header Checksum"
25
uint8 :ipmi_src_address ,label: "IPMI Source Address"
26
uint8 :ipmi_src_luna ,label: "IPMI Source LUN"
27
uint8 :ipmi_command ,label: "IPMI Command"
28
uint8 :ipmi_completion_code ,label: "IPMI Completion Code"
29
30
uint8 :ipmi_channel ,label: "IPMI Channel"
31
32
bit1 :ipmi_compat_20 ,label: "IPMI Version Compatibility: IPMI 2.0+"
33
bit1 :ipmi_compat_reserved1 ,label: "IPMI Version Compatibility: Reserved 1"
34
bit1 :ipmi_compat_oem_auth ,label: "IPMI Version Compatibility: OEM Authentication"
35
bit1 :ipmi_compat_password ,label: "IPMI Version Compatibility: Straight Password"
36
bit1 :ipmi_compat_reserved2 ,label: "IPMI Version Compatibility: Reserved 2"
37
bit1 :ipmi_compat_md5 ,label: "IPMI Version Compatibility: MD5"
38
bit1 :ipmi_compat_md2 ,label: "IPMI Version Compatibility: MD2"
39
bit1 :ipmi_compat_none ,label: "IPMI Version Compatibility: None"
40
41
bit2 :ipmi_user_reserved1 ,label: "IPMI User Compatibility: Reserved 1"
42
bit1 :ipmi_user_kg ,label: "IPMI User Compatibility: KG Set to Default"
43
bit1 :ipmi_user_disable_message_auth ,label: "IPMI User Compatibility: Disable Per-Message Authentication"
44
bit1 :ipmi_user_disable_user_auth ,label: "IPMI User Compatibility: Disable User-Level Authentication"
45
bit1 :ipmi_user_non_null ,label: "IPMI User Compatibility: Non-Null Usernames Enabled"
46
bit1 :ipmi_user_null ,label: "IPMI User Compatibility: Null Usernames Enabled"
47
bit1 :ipmi_user_anonymous ,label: "IPMI User Compatibility: Anonymous Login Enabled"
48
49
bit6 :ipmi_conn_reserved1 ,label: "IPMI Connection Compatibility: Reserved 1"
50
bit1 :ipmi_conn_20 ,label: "IPMI Connection Compatibility: 2.0"
51
bit1 :ipmi_conn_15 ,label: "IPMI Connection Compatibility: 1.5"
52
bit24 :ipmi_oem_id ,label: "IPMI OEM ID"
53
54
rest :ipm_oem_data ,label: "IPMI OEM Data + Checksum Byte"
55
56
def to_banner
57
info = self
58
banner = "#{(info.ipmi_compat_20 == 1) ? "IPMI-2.0" : "IPMI-1.5"} "
59
60
pass_info = []
61
pass_info << "oem_auth" if info.ipmi_compat_oem_auth == 1
62
pass_info << "password" if info.ipmi_compat_password == 1
63
pass_info << "md5" if info.ipmi_compat_md5 == 1
64
pass_info << "md2" if info.ipmi_compat_md2 == 1
65
pass_info << "null" if info.ipmi_compat_none == 1
66
67
user_info = []
68
user_info << "kg_default" if (info.ipmi_compat_20 == 1 and info.ipmi_user_kg == 1)
69
user_info << "auth_msg" unless info.ipmi_user_disable_message_auth == 1
70
user_info << "auth_user" unless info.ipmi_user_disable_user_auth == 1
71
user_info << "non_null_user" if info.ipmi_user_non_null == 1
72
user_info << "null_user" if info.ipmi_user_null == 1
73
user_info << "anonymous_user" if info.ipmi_user_anonymous == 1
74
75
conn_info = []
76
conn_info << "1.5" if info.ipmi_conn_15 == 1
77
conn_info << "2.0" if info.ipmi_conn_20 == 1
78
79
if info.ipmi_oem_id != 0
80
banner << "OEMID:#{info.ipmi_oem_id} "
81
end
82
83
banner << "UserAuth(#{user_info.join(", ")}) PassAuth(#{pass_info.join(", ")}) Level(#{conn_info.join(", ")}) "
84
banner
85
end
86
end
87
88
end
89
end
90
end
91
92