forked from rapid7/metasploit-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
426 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# -*- coding: binary -*- | ||
|
||
# | ||
# This mixin is a simplistic implementation of X11 extensions protocol | ||
# | ||
# Wireshark dissector: https://wiki.wireshark.org/X11 | ||
# | ||
|
||
module Rex::Proto::X11::Extension | ||
# https://xcb.freedesktop.org/manual/structxcb__query__extension__reply__t.html | ||
class X11QueryExtensionResponse < BinData::Record | ||
endian :little | ||
uint8 :reply | ||
uint8 :pad0 | ||
uint16 :sequence_number # QueryExtension | ||
uint32 :response_length | ||
uint8 :present # 8bit boolean, \x01 == true \x00 == false | ||
uint8 :major_opcode # this is the ID of the extension | ||
uint8 :first_event | ||
uint8 :first_error | ||
# 64 + 64 + 32 padding 'undecoded' in wireshark | ||
uint64 :pad1 | ||
uint64 :pad2 | ||
uint32 :pad3 | ||
end | ||
|
||
# https://xcb.freedesktop.org/manual/structxcb__query__extension__request__t.html | ||
class X11QueryExtensionRequest < BinData::Record | ||
endian :little | ||
uint8 :opcode, value: 98 # QueryExtension | ||
uint8 :pad0, value: 0 | ||
uint16 :request_length, value: -> { num_bytes / 4 } | ||
uint16 :extension_length, value: -> { extension.to_s.gsub(/\x00+\z/, '').length } # cut off the \x00 padding | ||
uint16 :pad1, initial_value: 0 # seems to possibly be a counter for how many times this has been called | ||
string :extension, length: 12, trim_padding: true | ||
end | ||
|
||
# built based on Wireshark processor | ||
class X11ExtensionToggleRequest < BinData::Record | ||
endian :little | ||
uint8 :opcode # X11QueryExtensionResponse.major-opcode | ||
uint8 :toggle, initial_value: 0 # 0 enable | ||
uint16 :request_length, value: -> { num_bytes / 4 } | ||
uint16 :wanted_major, onlyif: :versions? # extension major version | ||
uint16 :wanted_minor, onlyif: :versions? # extension minor version | ||
|
||
def versions? | ||
wanted_major.nonzero? || wanted_minor.nonzero? | ||
end | ||
end | ||
|
||
# built based on Wireshark processor | ||
class X11ExtensionToggleReply < BinData::Record | ||
endian :little | ||
uint8 :reply | ||
uint8 :pad0 | ||
uint16 :reply_sequence_number | ||
uint32 :reply_length | ||
uint32 :maximum_request_length | ||
# 64 + 64 + 32 padding 'undecoded' in wireshark | ||
uint64 :pad1 | ||
uint64 :pad2 | ||
uint32 :pad3 | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.