librex 0.0.68 → 0.0.70
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 +15 -0
- data/README.markdown +1 -1
- data/Rakefile +18 -16
- data/lib/rex.rb +14 -10
- data/lib/rex/LICENSE +2 -2
- data/lib/rex/arch.rb +76 -76
- data/lib/rex/arch/sparc.rb +57 -58
- data/lib/rex/arch/x86.rb +506 -496
- data/lib/rex/assembly/nasm.rb +83 -84
- data/lib/rex/compat.rb +228 -173
- data/lib/rex/constants.rb +47 -37
- data/lib/rex/elfparsey.rb +0 -3
- data/lib/rex/elfparsey/elf.rb +107 -110
- data/lib/rex/elfparsey/elfbase.rb +244 -247
- data/lib/rex/elfparsey/exceptions.rb +0 -3
- data/lib/rex/elfscan.rb +0 -3
- data/lib/rex/elfscan/scanner.rb +184 -166
- data/lib/rex/elfscan/search.rb +35 -38
- data/lib/rex/encoder/alpha2.rb +1 -2
- data/lib/rex/encoder/alpha2/alpha_mixed.rb +52 -53
- data/lib/rex/encoder/alpha2/alpha_upper.rb +62 -63
- data/lib/rex/encoder/alpha2/generic.rb +77 -78
- data/lib/rex/encoder/alpha2/unicode_mixed.rb +101 -97
- data/lib/rex/encoder/alpha2/unicode_upper.rb +106 -107
- data/lib/rex/encoder/bloxor/bloxor.rb +326 -0
- data/lib/rex/encoder/ndr.rb +68 -68
- data/lib/rex/encoder/nonalpha.rb +50 -51
- data/lib/rex/encoder/nonupper.rb +50 -51
- data/lib/rex/encoder/xdr.rb +78 -78
- data/lib/rex/encoder/xor.rb +52 -53
- data/lib/rex/encoder/xor/dword.rb +1 -2
- data/lib/rex/encoder/xor/dword_additive.rb +1 -2
- data/lib/rex/encoders/xor_dword.rb +17 -18
- data/lib/rex/encoders/xor_dword_additive.rb +35 -36
- data/lib/rex/encoding/xor.rb +0 -1
- data/lib/rex/encoding/xor/byte.rb +3 -4
- data/lib/rex/encoding/xor/dword.rb +3 -4
- data/lib/rex/encoding/xor/dword_additive.rb +72 -73
- data/lib/rex/encoding/xor/exceptions.rb +2 -3
- data/lib/rex/encoding/xor/generic.rb +129 -130
- data/lib/rex/encoding/xor/qword.rb +3 -4
- data/lib/rex/encoding/xor/word.rb +3 -4
- data/lib/rex/exceptions.rb +100 -101
- data/lib/rex/exploitation/cmdstager.rb +3 -3
- data/lib/rex/exploitation/cmdstager/base.rb +170 -156
- data/lib/rex/exploitation/cmdstager/bourne.rb +105 -0
- data/lib/rex/exploitation/cmdstager/debug_asm.rb +110 -113
- data/lib/rex/exploitation/cmdstager/debug_write.rb +106 -109
- data/lib/rex/exploitation/cmdstager/echo.rb +164 -0
- data/lib/rex/exploitation/cmdstager/printf.rb +122 -0
- data/lib/rex/exploitation/cmdstager/tftp.rb +34 -27
- data/lib/rex/exploitation/cmdstager/vbs.rb +95 -98
- data/lib/rex/exploitation/egghunter.rb +359 -346
- data/lib/rex/exploitation/encryptjs.rb +60 -60
- data/lib/rex/exploitation/heaplib.rb +76 -76
- data/lib/rex/exploitation/js.rb +6 -0
- data/lib/rex/exploitation/js/detect.rb +69 -0
- data/lib/rex/exploitation/js/memory.rb +81 -0
- data/lib/rex/exploitation/js/network.rb +84 -0
- data/lib/rex/exploitation/js/utils.rb +33 -0
- data/lib/rex/exploitation/jsobfu.rb +448 -424
- data/lib/rex/exploitation/obfuscatejs.rb +301 -301
- data/lib/rex/exploitation/omelet.rb +257 -257
- data/lib/rex/exploitation/opcodedb.rb +699 -699
- data/lib/rex/exploitation/ropdb.rb +189 -0
- data/lib/rex/exploitation/seh.rb +68 -68
- data/lib/rex/file.rb +96 -49
- data/lib/rex/image_source.rb +0 -3
- data/lib/rex/image_source/disk.rb +45 -48
- data/lib/rex/image_source/image_source.rb +33 -36
- data/lib/rex/image_source/memory.rb +17 -20
- data/lib/rex/io/bidirectional_pipe.rb +118 -115
- data/lib/rex/io/datagram_abstraction.rb +13 -14
- data/lib/rex/io/ring_buffer.rb +273 -273
- data/lib/rex/io/stream.rb +284 -284
- data/lib/rex/io/stream_abstraction.rb +183 -181
- data/lib/rex/io/stream_server.rb +193 -193
- data/lib/rex/job_container.rb +167 -167
- data/lib/rex/logging.rb +0 -1
- data/lib/rex/logging/log_dispatcher.rb +113 -113
- data/lib/rex/logging/log_sink.rb +17 -17
- data/lib/rex/logging/sinks/flatfile.rb +36 -36
- data/lib/rex/logging/sinks/stderr.rb +27 -27
- data/lib/rex/mac_oui.rb +16572 -16571
- data/lib/rex/machparsey.rb +0 -1
- data/lib/rex/machparsey/exceptions.rb +0 -1
- data/lib/rex/machparsey/mach.rb +160 -161
- data/lib/rex/machparsey/machbase.rb +367 -368
- data/lib/rex/machscan.rb +0 -1
- data/lib/rex/machscan/scanner.rb +175 -176
- data/lib/rex/mime/encoding.rb +17 -0
- data/lib/rex/mime/header.rb +58 -58
- data/lib/rex/mime/message.rb +140 -137
- data/lib/rex/mime/part.rb +41 -12
- data/lib/rex/nop/opty2.rb +90 -90
- data/lib/rex/nop/opty2_tables.rb +273 -273
- data/lib/rex/ole.rb +0 -4
- data/lib/rex/ole/clsid.rb +26 -30
- data/lib/rex/ole/difat.rb +121 -125
- data/lib/rex/ole/directory.rb +205 -209
- data/lib/rex/ole/direntry.rb +217 -221
- data/lib/rex/ole/fat.rb +79 -83
- data/lib/rex/ole/header.rb +178 -182
- data/lib/rex/ole/minifat.rb +49 -53
- data/lib/rex/ole/propset.rb +113 -117
- data/lib/rex/ole/samples/create_ole.rb +8 -9
- data/lib/rex/ole/samples/dir.rb +10 -11
- data/lib/rex/ole/samples/dump_stream.rb +14 -15
- data/lib/rex/ole/samples/ole_info.rb +5 -6
- data/lib/rex/ole/storage.rb +372 -376
- data/lib/rex/ole/stream.rb +33 -37
- data/lib/rex/ole/substorage.rb +20 -24
- data/lib/rex/ole/util.rb +137 -141
- data/lib/rex/parser/acunetix_nokogiri.rb +398 -398
- data/lib/rex/parser/apple_backup_manifestdb.rb +116 -116
- data/lib/rex/parser/appscan_nokogiri.rb +359 -359
- data/lib/rex/parser/arguments.rb +88 -88
- data/lib/rex/parser/burp_session_nokogiri.rb +258 -258
- data/lib/rex/parser/ci_nokogiri.rb +184 -184
- data/lib/rex/parser/foundstone_nokogiri.rb +334 -333
- data/lib/rex/parser/fusionvm_nokogiri.rb +94 -94
- data/lib/rex/parser/ini.rb +167 -167
- data/lib/rex/parser/ip360_aspl_xml.rb +84 -84
- data/lib/rex/parser/ip360_xml.rb +77 -77
- data/lib/rex/parser/mbsa_nokogiri.rb +224 -224
- data/lib/rex/parser/nessus_xml.rb +100 -100
- data/lib/rex/parser/netsparker_xml.rb +89 -75
- data/lib/rex/parser/nexpose_raw_nokogiri.rb +677 -677
- data/lib/rex/parser/nexpose_simple_nokogiri.rb +322 -322
- data/lib/rex/parser/nexpose_xml.rb +105 -105
- data/lib/rex/parser/nmap_nokogiri.rb +386 -386
- data/lib/rex/parser/nmap_xml.rb +116 -116
- data/lib/rex/parser/nokogiri_doc_mixin.rb +223 -221
- data/lib/rex/parser/openvas_nokogiri.rb +162 -162
- data/lib/rex/parser/outpost24_nokogiri.rb +239 -0
- data/lib/rex/parser/retina_xml.rb +90 -90
- data/lib/rex/parser/unattend.rb +171 -0
- data/lib/rex/parser/wapiti_nokogiri.rb +89 -89
- data/lib/rex/payloads/win32/common.rb +14 -14
- data/lib/rex/payloads/win32/kernel.rb +36 -36
- data/lib/rex/payloads/win32/kernel/common.rb +32 -32
- data/lib/rex/payloads/win32/kernel/recovery.rb +27 -27
- data/lib/rex/payloads/win32/kernel/stager.rb +170 -170
- data/lib/rex/peparsey.rb +0 -3
- data/lib/rex/peparsey/exceptions.rb +0 -3
- data/lib/rex/peparsey/pe.rb +196 -199
- data/lib/rex/peparsey/pe_memdump.rb +35 -38
- data/lib/rex/peparsey/pebase.rb +1633 -1652
- data/lib/rex/peparsey/section.rb +115 -124
- data/lib/rex/pescan.rb +0 -3
- data/lib/rex/pescan/analyze.rb +351 -351
- data/lib/rex/pescan/scanner.rb +182 -182
- data/lib/rex/pescan/search.rb +59 -59
- data/lib/rex/platforms/windows.rb +37 -37
- data/lib/rex/poly.rb +111 -110
- data/lib/rex/poly/block.rb +419 -417
- data/lib/rex/poly/machine.rb +12 -0
- data/lib/rex/poly/machine/machine.rb +829 -0
- data/lib/rex/poly/machine/x86.rb +508 -0
- data/lib/rex/poly/register.rb +70 -70
- data/lib/rex/poly/register/x86.rb +22 -22
- data/lib/rex/post.rb +0 -1
- data/lib/rex/post/dir.rb +35 -36
- data/lib/rex/post/file.rb +140 -141
- data/lib/rex/post/file_stat.rb +198 -199
- data/lib/rex/post/io.rb +167 -168
- data/lib/rex/post/meterpreter.rb +1 -1
- data/lib/rex/post/meterpreter/channel.rb +389 -390
- data/lib/rex/post/meterpreter/channel_container.rb +33 -34
- data/lib/rex/post/meterpreter/channels/pool.rb +129 -130
- data/lib/rex/post/meterpreter/channels/pools/file.rb +35 -36
- data/lib/rex/post/meterpreter/channels/pools/stream_pool.rb +72 -73
- data/lib/rex/post/meterpreter/channels/stream.rb +62 -63
- data/lib/rex/post/meterpreter/client.rb +442 -436
- data/lib/rex/post/meterpreter/client_core.rb +326 -310
- data/lib/rex/post/meterpreter/dependencies.rb +0 -1
- data/lib/rex/post/meterpreter/extension.rb +12 -13
- data/lib/rex/post/meterpreter/extensions/espia/espia.rb +35 -36
- data/lib/rex/post/meterpreter/extensions/extapi/adsi/adsi.rb +71 -0
- data/lib/rex/post/meterpreter/extensions/extapi/clipboard/clipboard.rb +169 -0
- data/lib/rex/post/meterpreter/extensions/extapi/extapi.rb +45 -0
- data/lib/rex/post/meterpreter/extensions/extapi/service/service.rb +104 -0
- data/lib/rex/post/meterpreter/extensions/extapi/tlv.rb +77 -0
- data/lib/rex/post/meterpreter/extensions/extapi/window/window.rb +56 -0
- data/lib/rex/post/meterpreter/extensions/extapi/wmi/wmi.rb +75 -0
- data/lib/rex/post/meterpreter/extensions/incognito/incognito.rb +70 -71
- data/lib/rex/post/meterpreter/extensions/kiwi/kiwi.rb +361 -0
- data/lib/rex/post/meterpreter/extensions/kiwi/tlv.rb +76 -0
- data/lib/rex/post/meterpreter/extensions/lanattacks/dhcp/dhcp.rb +78 -0
- data/lib/rex/post/meterpreter/extensions/lanattacks/lanattacks.rb +22 -78
- data/lib/rex/post/meterpreter/extensions/lanattacks/tftp/tftp.rb +49 -0
- data/lib/rex/post/meterpreter/extensions/lanattacks/tlv.rb +4 -4
- data/lib/rex/post/meterpreter/extensions/mimikatz/mimikatz.rb +128 -0
- data/lib/rex/post/meterpreter/extensions/mimikatz/tlv.rb +16 -0
- data/lib/rex/post/meterpreter/extensions/networkpug/networkpug.rb +38 -39
- data/lib/rex/post/meterpreter/extensions/networkpug/tlv.rb +1 -1
- data/lib/rex/post/meterpreter/extensions/priv/fs.rb +95 -96
- data/lib/rex/post/meterpreter/extensions/priv/passwd.rb +39 -40
- data/lib/rex/post/meterpreter/extensions/priv/priv.rb +80 -85
- data/lib/rex/post/meterpreter/extensions/sniffer/sniffer.rb +94 -95
- data/lib/rex/post/meterpreter/extensions/stdapi/constants.rb +207 -147
- data/lib/rex/post/meterpreter/extensions/stdapi/fs/dir.rb +258 -259
- data/lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb +366 -301
- data/lib/rex/post/meterpreter/extensions/stdapi/fs/file_stat.rb +72 -73
- data/lib/rex/post/meterpreter/extensions/stdapi/fs/io.rb +24 -25
- data/lib/rex/post/meterpreter/extensions/stdapi/net/arp.rb +59 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/net/config.rb +227 -149
- data/lib/rex/post/meterpreter/extensions/stdapi/net/interface.rb +107 -108
- data/lib/rex/post/meterpreter/extensions/stdapi/net/netstat.rb +97 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/net/resolve.rb +106 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/net/route.rb +41 -42
- data/lib/rex/post/meterpreter/extensions/stdapi/net/socket.rb +102 -101
- data/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_client_channel.rb +151 -152
- data/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_server_channel.rb +142 -142
- data/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/udp_channel.rb +185 -185
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/api_constants.rb +38118 -38117
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/buffer_item.rb +7 -7
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_advapi32.rb +2086 -2084
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_crypt32.rb +15 -15
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_iphlpapi.rb +80 -80
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_kernel32.rb +3835 -3833
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_netapi32.rb +84 -28
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_ntdll.rb +151 -137
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_shell32.rb +15 -6
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_user32.rb +3155 -3155
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_version.rb +41 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_wlanapi.rb +70 -70
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_wldap32.rb +128 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_ws2_32.rb +596 -596
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll.rb +310 -301
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_function.rb +71 -61
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_helper.rb +100 -100
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_wrapper.rb +14 -14
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/mock_magic.rb +488 -488
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/multicall.rb +273 -264
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/platform_util.rb +5 -5
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/railgun.rb +240 -238
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/tlv.rb +17 -15
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/type/pointer_util.rb +61 -61
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/util.rb +654 -635
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/win_const_manager.rb +49 -49
- data/lib/rex/post/meterpreter/extensions/stdapi/stdapi.rb +103 -102
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/config.rb +98 -68
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/event_log.rb +165 -166
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/event_log_subsystem/event_record.rb +16 -17
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/power.rb +34 -36
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/process.rb +363 -364
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/process_subsystem/image.rb +102 -103
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/process_subsystem/io.rb +28 -29
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/process_subsystem/memory.rb +303 -304
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/process_subsystem/thread.rb +113 -114
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/registry.rb +260 -261
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_key.rb +165 -166
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_value.rb +69 -70
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/remote_registry_key.rb +160 -161
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/thread.rb +143 -144
- data/lib/rex/post/meterpreter/extensions/stdapi/tlv.rb +29 -12
- data/lib/rex/post/meterpreter/extensions/stdapi/ui.rb +230 -231
- data/lib/rex/post/meterpreter/extensions/stdapi/webcam/webcam.rb +181 -44
- data/lib/rex/post/meterpreter/inbound_packet_handler.rb +12 -13
- data/lib/rex/post/meterpreter/object_aliases.rb +56 -57
- data/lib/rex/post/meterpreter/packet.rb +591 -592
- data/lib/rex/post/meterpreter/packet_dispatcher.rb +506 -496
- data/lib/rex/post/meterpreter/packet_parser.rb +72 -73
- data/lib/rex/post/meterpreter/packet_response_waiter.rb +56 -57
- data/lib/rex/post/meterpreter/ui/console.rb +112 -112
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher.rb +53 -53
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb +911 -854
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/espia.rb +86 -86
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi.rb +65 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi/adsi.rb +198 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi/clipboard.rb +444 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi/service.rb +199 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi/window.rb +118 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi/wmi.rb +108 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/incognito.rb +220 -220
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/kiwi.rb +509 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/lanattacks.rb +60 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/lanattacks/dhcp.rb +254 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/lanattacks/tftp.rb +159 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/mimikatz.rb +182 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/networkpug.rb +173 -173
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/priv.rb +40 -40
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/priv/elevate.rb +75 -77
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/priv/passwd.rb +30 -30
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/priv/timestomp.rb +105 -105
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/sniffer.rb +182 -182
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi.rb +37 -37
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/fs.rb +504 -482
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb +401 -330
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/sys.rb +883 -581
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/ui.rb +296 -299
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/webcam.rb +320 -153
- data/lib/rex/post/meterpreter/ui/console/interactive_channel.rb +78 -78
- data/lib/rex/post/permission.rb +0 -1
- data/lib/rex/post/process.rb +39 -40
- data/lib/rex/post/thread.rb +41 -42
- data/lib/rex/post/ui.rb +35 -36
- data/lib/rex/proto/addp.rb +218 -0
- data/lib/rex/proto/dcerpc/client.rb +344 -344
- data/lib/rex/proto/dcerpc/exceptions.rb +128 -128
- data/lib/rex/proto/dcerpc/handle.rb +32 -32
- data/lib/rex/proto/dcerpc/ndr.rb +56 -56
- data/lib/rex/proto/dcerpc/packet.rb +249 -245
- data/lib/rex/proto/dcerpc/response.rb +170 -170
- data/lib/rex/proto/dcerpc/uuid.rb +65 -65
- data/lib/rex/proto/dcerpc/wdscp.rb +3 -0
- data/lib/rex/proto/dcerpc/wdscp/constants.rb +89 -0
- data/lib/rex/proto/dcerpc/wdscp/packet.rb +94 -0
- data/lib/rex/proto/dhcp.rb +0 -1
- data/lib/rex/proto/dhcp/constants.rb +0 -1
- data/lib/rex/proto/dhcp/server.rb +303 -304
- data/lib/rex/proto/drda/constants.rb +1 -1
- data/lib/rex/proto/drda/packet.rb +186 -186
- data/lib/rex/proto/drda/utils.rb +104 -104
- data/lib/rex/proto/http.rb +1 -0
- data/lib/rex/proto/http/client.rb +692 -820
- data/lib/rex/proto/http/client_request.rb +472 -0
- data/lib/rex/proto/http/handler.rb +25 -25
- data/lib/rex/proto/http/handler/erb.rb +104 -104
- data/lib/rex/proto/http/handler/proc.rb +37 -37
- data/lib/rex/proto/http/header.rb +149 -149
- data/lib/rex/proto/http/packet.rb +388 -382
- data/lib/rex/proto/http/request.rb +332 -335
- data/lib/rex/proto/http/response.rb +132 -72
- data/lib/rex/proto/http/server.rb +348 -338
- data/lib/rex/proto/iax2/call.rb +310 -310
- data/lib/rex/proto/iax2/client.rb +197 -197
- data/lib/rex/proto/iax2/codecs/alaw.rb +4 -4
- data/lib/rex/proto/iax2/codecs/mulaw.rb +4 -4
- data/lib/rex/proto/ipmi.rb +57 -0
- data/lib/rex/proto/ipmi/channel_auth_reply.rb +88 -0
- data/lib/rex/proto/ipmi/open_session_reply.rb +35 -0
- data/lib/rex/proto/ipmi/rakp2.rb +35 -0
- data/lib/rex/proto/ipmi/utils.rb +125 -0
- data/lib/rex/proto/natpmp.rb +1 -5
- data/lib/rex/proto/natpmp/constants.rb +4 -4
- data/lib/rex/proto/natpmp/packet.rb +25 -25
- data/lib/rex/proto/ntlm/base.rb +271 -271
- data/lib/rex/proto/ntlm/constants.rb +61 -61
- data/lib/rex/proto/ntlm/crypt.rb +348 -352
- data/lib/rex/proto/ntlm/exceptions.rb +3 -3
- data/lib/rex/proto/ntlm/message.rb +468 -471
- data/lib/rex/proto/ntlm/utils.rb +746 -746
- data/lib/rex/proto/pjl.rb +30 -0
- data/lib/rex/proto/pjl/client.rb +162 -0
- data/lib/rex/proto/proxy/socks4a.rb +440 -440
- data/lib/rex/proto/rfb.rb +1 -8
- data/lib/rex/proto/rfb/cipher.rb +46 -49
- data/lib/rex/proto/rfb/client.rb +179 -182
- data/lib/rex/proto/rfb/constants.rb +18 -21
- data/lib/rex/proto/smb/client.rb +1954 -1843
- data/lib/rex/proto/smb/constants.rb +533 -516
- data/lib/rex/proto/smb/crypt.rb +21 -21
- data/lib/rex/proto/smb/evasions.rb +43 -43
- data/lib/rex/proto/smb/exceptions.rb +791 -791
- data/lib/rex/proto/smb/simpleclient.rb +142 -286
- data/lib/rex/proto/smb/simpleclient/open_file.rb +106 -0
- data/lib/rex/proto/smb/simpleclient/open_pipe.rb +57 -0
- data/lib/rex/proto/smb/utils.rb +81 -81
- data/lib/rex/proto/sunrpc/client.rb +158 -158
- data/lib/rex/proto/tftp.rb +0 -1
- data/lib/rex/proto/tftp/client.rb +289 -289
- data/lib/rex/proto/tftp/constants.rb +9 -10
- data/lib/rex/proto/tftp/server.rb +466 -467
- data/lib/rex/random_identifier_generator.rb +176 -0
- data/lib/rex/registry.rb +1 -1
- data/lib/rex/registry/hive.rb +88 -88
- data/lib/rex/registry/lfkey.rb +25 -25
- data/lib/rex/registry/nodekey.rb +30 -30
- data/lib/rex/registry/regf.rb +10 -10
- data/lib/rex/registry/valuekey.rb +43 -43
- data/lib/rex/registry/valuelist.rb +13 -13
- data/lib/rex/ropbuilder/rop.rb +254 -253
- data/lib/rex/script.rb +21 -22
- data/lib/rex/script/base.rb +51 -50
- data/lib/rex/script/meterpreter.rb +2 -2
- data/lib/rex/service.rb +24 -24
- data/lib/rex/service_manager.rb +132 -132
- data/lib/rex/services/local_relay.rb +398 -398
- data/lib/rex/socket.rb +758 -763
- data/lib/rex/socket/comm.rb +95 -95
- data/lib/rex/socket/comm/local.rb +507 -440
- data/lib/rex/socket/ip.rb +118 -118
- data/lib/rex/socket/parameters.rb +351 -350
- data/lib/rex/socket/range_walker.rb +445 -368
- data/lib/rex/socket/ssl_tcp.rb +323 -317
- data/lib/rex/socket/ssl_tcp_server.rb +173 -158
- data/lib/rex/socket/subnet_walker.rb +48 -48
- data/lib/rex/socket/switch_board.rb +259 -259
- data/lib/rex/socket/tcp.rb +58 -56
- data/lib/rex/socket/tcp_server.rb +42 -42
- data/lib/rex/socket/udp.rb +152 -152
- data/lib/rex/sslscan/result.rb +200 -0
- data/lib/rex/sslscan/scanner.rb +205 -0
- data/lib/rex/struct2.rb +0 -1
- data/lib/rex/struct2/c_struct.rb +162 -163
- data/lib/rex/struct2/c_struct_template.rb +21 -22
- data/lib/rex/struct2/constant.rb +6 -7
- data/lib/rex/struct2/element.rb +30 -31
- data/lib/rex/struct2/generic.rb +60 -61
- data/lib/rex/struct2/restraint.rb +40 -41
- data/lib/rex/struct2/s_string.rb +60 -61
- data/lib/rex/struct2/s_struct.rb +97 -98
- data/lib/rex/sync.rb +0 -1
- data/lib/rex/sync/event.rb +62 -72
- data/lib/rex/sync/read_write_lock.rb +149 -149
- data/lib/rex/sync/ref.rb +42 -42
- data/lib/rex/sync/thread_safe.rb +59 -59
- data/lib/rex/text.rb +1803 -1315
- data/lib/rex/thread_factory.rb +25 -25
- data/lib/rex/time.rb +44 -44
- data/lib/rex/transformer.rb +91 -91
- data/lib/rex/ui/interactive.rb +265 -265
- data/lib/rex/ui/output.rb +66 -60
- data/lib/rex/ui/progress_tracker.rb +79 -79
- data/lib/rex/ui/subscriber.rb +144 -134
- data/lib/rex/ui/text/color.rb +76 -76
- data/lib/rex/ui/text/dispatcher_shell.rb +512 -505
- data/lib/rex/ui/text/input.rb +96 -96
- data/lib/rex/ui/text/input/buffer.rb +58 -58
- data/lib/rex/ui/text/input/readline.rb +114 -114
- data/lib/rex/ui/text/input/socket.rb +77 -77
- data/lib/rex/ui/text/input/stdio.rb +24 -24
- data/lib/rex/ui/text/irb_shell.rb +45 -41
- data/lib/rex/ui/text/output.rb +64 -60
- data/lib/rex/ui/text/output/buffer.rb +42 -42
- data/lib/rex/ui/text/output/buffer/stdout.rb +25 -0
- data/lib/rex/ui/text/output/file.rb +24 -24
- data/lib/rex/ui/text/output/socket.rb +24 -24
- data/lib/rex/ui/text/output/stdio.rb +29 -29
- data/lib/rex/ui/text/output/tee.rb +36 -36
- data/lib/rex/ui/text/progress_tracker.rb +37 -37
- data/lib/rex/ui/text/shell.rb +371 -361
- data/lib/rex/ui/text/table.rb +320 -284
- data/lib/rex/zip.rb +0 -1
- data/lib/rex/zip/archive.rb +115 -94
- data/lib/rex/zip/blocks.rb +101 -100
- data/lib/rex/zip/entry.rb +108 -99
- data/lib/rex/zip/jar.rb +261 -206
- data/lib/rex/zip/samples/comment.rb +1 -2
- data/lib/rex/zip/samples/mkwar.rb +12 -13
- data/lib/rex/zip/samples/mkzip.rb +1 -2
- data/lib/rex/zip/samples/recursive.rb +29 -30
- metadata +424 -446
- data/lib/rex/arch/sparc.rb.ut.rb +0 -19
- data/lib/rex/arch/x86.rb.ut.rb +0 -94
- data/lib/rex/assembly/nasm.rb.ut.rb +0 -23
- data/lib/rex/encoder/ndr.rb.ut.rb +0 -45
- data/lib/rex/encoder/xdr.rb.ut.rb +0 -30
- data/lib/rex/encoders/xor_dword_additive.rb.ut.rb +0 -13
- data/lib/rex/encoding/xor.rb.ts.rb +0 -15
- data/lib/rex/encoding/xor/byte.rb.ut.rb +0 -22
- data/lib/rex/encoding/xor/dword.rb.ut.rb +0 -16
- data/lib/rex/encoding/xor/dword_additive.rb.ut.rb +0 -16
- data/lib/rex/encoding/xor/generic.rb.ut.rb +0 -121
- data/lib/rex/encoding/xor/word.rb.ut.rb +0 -14
- data/lib/rex/exceptions.rb.ut.rb +0 -45
- data/lib/rex/exploitation/egghunter.rb.ut.rb +0 -28
- data/lib/rex/exploitation/javascriptosdetect.js +0 -1014
- data/lib/rex/exploitation/javascriptosdetect.rb +0 -43
- data/lib/rex/exploitation/omelet.rb.ut.rb +0 -27
- data/lib/rex/exploitation/opcodedb.rb.ut.rb +0 -280
- data/lib/rex/exploitation/seh.rb.ut.rb +0 -20
- data/lib/rex/file.rb.ut.rb +0 -17
- data/lib/rex/io/ring_buffer.rb.ut.rb +0 -135
- data/lib/rex/nop/opty2.rb.ut.rb +0 -24
- data/lib/rex/parser/arguments.rb.ut.rb +0 -68
- data/lib/rex/parser/ini.rb.ut.rb +0 -30
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun.rb.ts.rb +0 -18
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/api_constants.rb.ut.rb +0 -39
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/buffer_item.rb.ut.rb +0 -37
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll.rb.ut.rb +0 -52
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_function.rb.ut.rb +0 -43
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_helper.rb.ut.rb +0 -128
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_wrapper.rb.ut.rb +0 -64
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/platform_util.rb.ut.rb +0 -29
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/railgun.rb.ut.rb +0 -155
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/type/pointer_util.rb.ut.rb +0 -128
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/win_const_manager.rb.ut.rb +0 -124
- data/lib/rex/proto.rb.ts.rb +0 -9
- data/lib/rex/proto/dcerpc.rb.ts.rb +0 -10
- data/lib/rex/proto/dcerpc/client.rb.ut.rb +0 -492
- data/lib/rex/proto/dcerpc/handle.rb.ut.rb +0 -86
- data/lib/rex/proto/dcerpc/ndr.rb.ut.rb +0 -42
- data/lib/rex/proto/dcerpc/packet.rb.ut.rb +0 -57
- data/lib/rex/proto/dcerpc/response.rb.ut.rb +0 -16
- data/lib/rex/proto/dcerpc/uuid.rb.ut.rb +0 -47
- data/lib/rex/proto/drda.rb.ts.rb +0 -18
- data/lib/rex/proto/drda/constants.rb.ut.rb +0 -24
- data/lib/rex/proto/drda/packet.rb.ut.rb +0 -110
- data/lib/rex/proto/drda/utils.rb.ut.rb +0 -85
- data/lib/rex/proto/http.rb.ts.rb +0 -13
- data/lib/rex/proto/http/client.rb.ut.rb +0 -96
- data/lib/rex/proto/http/handler/erb.rb.ut.rb +0 -22
- data/lib/rex/proto/http/handler/erb.rb.ut.rb.rhtml +0 -1
- data/lib/rex/proto/http/handler/proc.rb.ut.rb +0 -25
- data/lib/rex/proto/http/header.rb.ut.rb +0 -47
- data/lib/rex/proto/http/packet.rb.ut.rb +0 -166
- data/lib/rex/proto/http/request.rb.ut.rb +0 -215
- data/lib/rex/proto/http/response.rb.ut.rb +0 -150
- data/lib/rex/proto/http/server.rb.ut.rb +0 -80
- data/lib/rex/proto/ntlm.rb.ut.rb +0 -181
- data/lib/rex/proto/rfb.rb.ut.rb +0 -40
- data/lib/rex/proto/smb.rb.ts.rb +0 -9
- data/lib/rex/proto/smb/client.rb.ut.rb +0 -224
- data/lib/rex/proto/smb/constants.rb.ut.rb +0 -19
- data/lib/rex/proto/smb/simpleclient.rb.ut.rb +0 -129
- data/lib/rex/proto/smb/utils.rb.ut.rb +0 -21
- data/lib/rex/proto/tftp/server.rb.ut.rb +0 -29
- data/lib/rex/service_manager.rb.ut.rb +0 -33
- data/lib/rex/socket.rb.ut.rb +0 -108
- data/lib/rex/socket/comm/local.rb.ut.rb +0 -76
- data/lib/rex/socket/parameters.rb.ut.rb +0 -52
- data/lib/rex/socket/range_walker.rb.ut.rb +0 -56
- data/lib/rex/socket/ssl_tcp.rb.ut.rb +0 -40
- data/lib/rex/socket/ssl_tcp_server.rb.ut.rb +0 -62
- data/lib/rex/socket/subnet_walker.rb.ut.rb +0 -29
- data/lib/rex/socket/switch_board.rb.ut.rb +0 -53
- data/lib/rex/socket/tcp.rb.ut.rb +0 -65
- data/lib/rex/socket/tcp_server.rb.ut.rb +0 -45
- data/lib/rex/socket/udp.rb.ut.rb +0 -45
- data/lib/rex/test.rb +0 -36
- data/lib/rex/text.rb.ut.rb +0 -193
- data/lib/rex/transformer.rb.ut.rb +0 -39
- data/lib/rex/ui/text/color.rb.ut.rb +0 -19
- data/lib/rex/ui/text/progress_tracker.rb.ut.rb +0 -35
- data/lib/rex/ui/text/table.rb.ut.rb +0 -56
|
@@ -147,21 +147,21 @@ NETBIOS_REDIR = 'CACACACACACACACACACACACACACACAAA'
|
|
|
147
147
|
|
|
148
148
|
|
|
149
149
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
150
|
+
# 0 = open2
|
|
151
|
+
# 1 = find_first
|
|
152
|
+
# 2 = find_next
|
|
153
|
+
# 3 = query_fs_info
|
|
154
|
+
# 4 = set_fs_quota
|
|
155
|
+
# 5 = query_path_info
|
|
156
|
+
# 6 = set_path_info
|
|
157
|
+
# 7 = query_file_info
|
|
158
|
+
# 8 = set_file_info
|
|
159
|
+
# 9 = fsctl
|
|
160
|
+
# 10 = ioctl2
|
|
161
|
+
# 11 = find_notify_first
|
|
162
|
+
# 12 = find_notify_next
|
|
163
|
+
# 13 = create_directory
|
|
164
|
+
# 14 = session_setup
|
|
165
165
|
|
|
166
166
|
|
|
167
167
|
# SMB_COM_TRANSACTION2 Commands
|
|
@@ -261,11 +261,28 @@ FILE_FILE_COMPRESSION = 0x00000008
|
|
|
261
261
|
FILE_VOLUME_QUOTAS = 0x00000010
|
|
262
262
|
FILE_VOLUME_IS_COMPRESSED = 0x00008000
|
|
263
263
|
|
|
264
|
+
# SMB_EXT_FILE_ATTR
|
|
265
|
+
# http://msdn.microsoft.com/en-us/library/ee878573(prot.20).aspx
|
|
266
|
+
SMB_EXT_FILE_ATTR_READONLY = 0x00000001
|
|
267
|
+
SMB_EXT_FILE_ATTR_HIDDEN = 0x00000002
|
|
268
|
+
SMB_EXT_FILE_ATTR_SYSTEM = 0x00000004
|
|
269
|
+
SMB_EXT_FILE_ATTR_DIRECTORY = 0x00000010
|
|
270
|
+
SMB_EXT_FILE_ATTR_ARCHIVE = 0x00000020
|
|
271
|
+
SMB_EXT_FILE_ATTR_NORMAL = 0x00000080
|
|
272
|
+
SMB_EXT_FILE_ATTR_TEMPORARY = 0x00000100
|
|
273
|
+
SMB_EXT_FILE_ATTR_COMPRESSED = 0x00000800
|
|
274
|
+
SMB_EXT_FILE_POSIX_SEMANTICS = 0x01000000
|
|
275
|
+
SMB_EXT_FILE_BACKUP_SEMANTICS = 0x02000000
|
|
276
|
+
SMB_EXT_FILE_DELETE_ON_CLOSE = 0x04000000
|
|
277
|
+
SMB_EXT_FILE_SEQUENTIAL_SCAN = 0x08000000
|
|
278
|
+
SMB_EXT_FILE_RANDOM_ACCESS = 0x10000000
|
|
279
|
+
SMB_EXT_FILE_NO_BUFFERING = 0x20000000
|
|
280
|
+
SMB_EXT_FILE_WRITE_THROUGH = 0x80000000
|
|
264
281
|
|
|
265
282
|
# SMB Error Codes
|
|
266
283
|
SMB_STATUS_SUCCESS = 0x00000000
|
|
267
284
|
SMB_ERROR_BUFFER_OVERFLOW = 0x80000005
|
|
268
|
-
SMB_STATUS_MORE_PROCESSING_REQUIRED = 0xC0000016
|
|
285
|
+
SMB_STATUS_MORE_PROCESSING_REQUIRED = 0xC0000016
|
|
269
286
|
SMB_STATUS_ACCESS_DENIED = 0xC0000022
|
|
270
287
|
SMB_STATUS_LOGON_FAILURE = 0xC000006D
|
|
271
288
|
|
|
@@ -273,157 +290,157 @@ SMB_STATUS_LOGON_FAILURE = 0xC000006D
|
|
|
273
290
|
DIALECT = {}
|
|
274
291
|
|
|
275
292
|
DIALECT['PC NETWORK PROGRAM 1.0'] = [
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
293
|
+
SMB_COM_CHECK_DIRECTORY,
|
|
294
|
+
SMB_COM_CLOSE,
|
|
295
|
+
SMB_COM_CLOSE_PRINT_FILE,
|
|
296
|
+
SMB_COM_CREATE,
|
|
297
|
+
SMB_COM_CREATE_DIRECTORY,
|
|
298
|
+
SMB_COM_CREATE_NEW,
|
|
299
|
+
SMB_COM_CREATE_TEMPORARY,
|
|
300
|
+
SMB_COM_DELETE,
|
|
301
|
+
SMB_COM_DELETE_DIRECTORY,
|
|
302
|
+
SMB_COM_FLUSH,
|
|
303
|
+
SMB_COM_GET_PRINT_QUEUE,
|
|
304
|
+
SMB_COM_LOCK_BYTE_RANGE,
|
|
305
|
+
SMB_COM_NEGOTIATE,
|
|
306
|
+
SMB_COM_OPEN,
|
|
307
|
+
SMB_COM_OPEN_PRINT_FILE,
|
|
308
|
+
SMB_COM_PROCESS_EXIT,
|
|
309
|
+
SMB_COM_QUERY_INFORMATION,
|
|
310
|
+
SMB_COM_QUERY_INFORMATION_DISK,
|
|
311
|
+
SMB_COM_READ,
|
|
312
|
+
SMB_COM_RENAME,
|
|
313
|
+
SMB_COM_SEARCH,
|
|
314
|
+
SMB_COM_SEEK,
|
|
315
|
+
SMB_COM_SET_INFORMATION,
|
|
316
|
+
SMB_COM_TREE_CONNECT,
|
|
317
|
+
SMB_COM_TREE_DISCONNECT,
|
|
318
|
+
SMB_COM_UNLOCK_BYTE_RANGE,
|
|
319
|
+
SMB_COM_WRITE,
|
|
320
|
+
SMB_COM_WRITE_PRINT_FILE
|
|
304
321
|
]
|
|
305
322
|
|
|
306
323
|
DIALECT['LANMAN 1.0'] = DIALECT['PC NETWORK PROGRAM 1.0'] + [
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
324
|
+
SMB_COM_COPY,
|
|
325
|
+
SMB_COM_ECHO,
|
|
326
|
+
SMB_COM_FIND,
|
|
327
|
+
SMB_COM_FIND_CLOSE,
|
|
328
|
+
SMB_COM_FIND_UNIQUE,
|
|
329
|
+
SMB_COM_IOCTL,
|
|
330
|
+
SMB_COM_IOCTL_SECONDARY,
|
|
331
|
+
SMB_COM_LOCK_AND_READ,
|
|
332
|
+
SMB_COM_LOCKING_ANDX,
|
|
333
|
+
SMB_COM_MOVE,
|
|
334
|
+
SMB_COM_OPEN_ANDX,
|
|
335
|
+
SMB_COM_QUERY_INFORMATION2,
|
|
336
|
+
SMB_COM_READ_ANDX,
|
|
337
|
+
SMB_COM_READ_MPX,
|
|
338
|
+
SMB_COM_READ_RAW,
|
|
339
|
+
SMB_COM_SESSION_SETUP_ANDX,
|
|
340
|
+
SMB_COM_SET_INFORMATION2,
|
|
341
|
+
SMB_COM_TRANSACTION,
|
|
342
|
+
SMB_COM_TRANSACTION_SECONDARY,
|
|
343
|
+
SMB_COM_TREE_CONNECT_ANDX,
|
|
344
|
+
SMB_COM_WRITE_AND_CLOSE,
|
|
345
|
+
SMB_COM_WRITE_AND_UNLOCK,
|
|
346
|
+
SMB_COM_WRITE_ANDX,
|
|
347
|
+
SMB_COM_WRITE_COMPLETE,
|
|
348
|
+
SMB_COM_WRITE_MPX,
|
|
349
|
+
SMB_COM_WRITE_MPX_SECONDARY,
|
|
350
|
+
SMB_COM_WRITE_RAW
|
|
334
351
|
]
|
|
335
352
|
|
|
336
353
|
DIALECT['LM1.2X002'] = DIALECT['LANMAN 1.0'] + [
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
354
|
+
SMB_COM_FIND_CLOSE2,
|
|
355
|
+
SMB_COM_LOGOFF_ANDX,
|
|
356
|
+
SMB_COM_TRANSACTION2,
|
|
357
|
+
SMB_COM_TRANSACTION2_SECONDARY
|
|
341
358
|
]
|
|
342
359
|
|
|
343
360
|
DIALECT['NTLM 0.12'] = DIALECT['LM1.2X002'] + [
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
361
|
+
SMB_COM_NT_CANCEL,
|
|
362
|
+
SMB_COM_NT_CREATE_ANDX,
|
|
363
|
+
SMB_COM_NT_RENAME,
|
|
364
|
+
SMB_COM_NT_TRANSACT,
|
|
365
|
+
SMB_COM_NT_TRANSACT_SECONDARY
|
|
349
366
|
]
|
|
350
367
|
|
|
351
368
|
# Create a NetBIOS session packet template
|
|
352
369
|
def self.make_nbs (template)
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
370
|
+
Rex::Struct2::CStructTemplate.new(
|
|
371
|
+
[ 'uint8', 'Type', 0 ],
|
|
372
|
+
[ 'uint8', 'Flags', 0 ],
|
|
373
|
+
[ 'uint16n', 'PayloadLen', 0 ],
|
|
374
|
+
[ 'template', 'Payload', template ]
|
|
375
|
+
).create_restraints(
|
|
376
|
+
[ 'Payload', 'PayloadLen', nil, true ]
|
|
377
|
+
)
|
|
361
378
|
end
|
|
362
379
|
|
|
363
380
|
|
|
364
381
|
# A raw NetBIOS session template
|
|
365
382
|
NBRAW_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
366
|
-
|
|
383
|
+
[ 'string', 'Payload', nil, '']
|
|
367
384
|
)
|
|
368
385
|
NBRAW_PKT = self.make_nbs(NBRAW_HDR_PKT)
|
|
369
386
|
|
|
370
387
|
|
|
371
388
|
# The SMB header template
|
|
372
389
|
SMB_HDR = Rex::Struct2::CStructTemplate.new(
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
390
|
+
[ 'uint32n', 'Magic', 0xff534d42 ],
|
|
391
|
+
[ 'uint8', 'Command', 0 ],
|
|
392
|
+
[ 'uint32v', 'ErrorClass', 0 ],
|
|
393
|
+
[ 'uint8', 'Flags1', 0 ],
|
|
394
|
+
[ 'uint16v', 'Flags2', 0 ],
|
|
395
|
+
[ 'uint16v', 'ProcessIDHigh', 0 ],
|
|
396
|
+
[ 'uint32v', 'Signature1', 0 ],
|
|
397
|
+
[ 'uint32v', 'Signature2', 0 ],
|
|
398
|
+
[ 'uint16v', 'Reserved1', 0 ],
|
|
399
|
+
[ 'uint16v', 'TreeID', 0 ],
|
|
400
|
+
[ 'uint16v', 'ProcessID', 0 ],
|
|
401
|
+
[ 'uint16v', 'UserID', 0 ],
|
|
402
|
+
[ 'uint16v', 'MultiplexID', 0 ],
|
|
403
|
+
[ 'uint8', 'WordCount', 0 ]
|
|
387
404
|
)
|
|
388
405
|
|
|
389
406
|
|
|
390
407
|
# The SMB2 header template
|
|
391
408
|
SMB2_HDR = Rex::Struct2::CStructTemplate.new(
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
409
|
+
[ 'uint32n', 'Magic', 0xfe534d42 ],
|
|
410
|
+
[ 'uint16v', 'HeaderLen', 64 ],
|
|
411
|
+
[ 'uint16v', 'Reserved0', 0 ],
|
|
412
|
+
[ 'uint32v', 'NTStatus', 0 ],
|
|
396
413
|
|
|
397
|
-
|
|
398
|
-
|
|
414
|
+
[ 'uint16v', 'Opcode', 0 ],
|
|
415
|
+
[ 'uint16v', 'Reserved1', 0 ],
|
|
399
416
|
|
|
400
|
-
|
|
401
|
-
|
|
417
|
+
[ 'uint16v', 'Flags1', 0 ],
|
|
418
|
+
[ 'uint16v', 'Flags2', 0 ],
|
|
402
419
|
|
|
403
|
-
|
|
420
|
+
[ 'uint32v', 'ChainOffset', 0 ],
|
|
404
421
|
|
|
405
|
-
|
|
406
|
-
|
|
422
|
+
[ 'uint32v', 'SequenceHigh', 0 ],
|
|
423
|
+
[ 'uint32v', 'SequenceLow', 0 ],
|
|
407
424
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
425
|
+
[ 'uint32v', 'ProcessID', 0 ],
|
|
426
|
+
[ 'uint32v', 'TreeID', 0 ],
|
|
427
|
+
[ 'uint32v', 'UserIDHigh', 0 ],
|
|
428
|
+
[ 'uint32v', 'UserIDLow', 0 ],
|
|
412
429
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
430
|
+
[ 'uint32v', 'SignatureA', 0 ],
|
|
431
|
+
[ 'uint32v', 'SignatureB', 0 ],
|
|
432
|
+
[ 'uint32v', 'SignatureC', 0 ],
|
|
433
|
+
[ 'uint32v', 'SignatureD', 0 ],
|
|
434
|
+
[ 'string', 'Payload', nil, '']
|
|
418
435
|
)
|
|
419
436
|
|
|
420
437
|
# A basic SMB template to read all responses
|
|
421
438
|
SMB_BASE_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
439
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
440
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
441
|
+
[ 'string', 'Payload', nil, '' ]
|
|
425
442
|
).create_restraints(
|
|
426
|
-
|
|
443
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
427
444
|
)
|
|
428
445
|
SMB_BASE_PKT = self.make_nbs(SMB_BASE_HDR_PKT)
|
|
429
446
|
|
|
@@ -431,553 +448,553 @@ SMB_BASE_PKT = self.make_nbs(SMB_BASE_HDR_PKT)
|
|
|
431
448
|
# A SMB template for SMB Dialect negotiation
|
|
432
449
|
SMB_NEG_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
433
450
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
451
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
452
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
453
|
+
[ 'string', 'Payload', nil, '' ]
|
|
437
454
|
).create_restraints(
|
|
438
|
-
|
|
455
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
439
456
|
)
|
|
440
457
|
SMB_NEG_PKT = self.make_nbs(SMB_NEG_HDR_PKT)
|
|
441
458
|
|
|
442
459
|
|
|
443
460
|
# A SMB template for SMB Dialect negotiation responses (LANMAN)
|
|
444
461
|
SMB_NEG_RES_LM_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
462
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
463
|
+
[ 'uint16v', 'Dialect', 0 ],
|
|
464
|
+
[ 'uint16v', 'SecurityMode', 0 ],
|
|
465
|
+
[ 'uint16v', 'MaxBuff', 0 ],
|
|
466
|
+
[ 'uint16v', 'MaxMPX', 0 ],
|
|
467
|
+
[ 'uint16v', 'MaxVCS', 0 ],
|
|
468
|
+
[ 'uint16v', 'RawMode', 0 ],
|
|
469
|
+
[ 'uint32v', 'SessionKey', 0 ],
|
|
470
|
+
[ 'uint16v', 'DosTime', 0 ],
|
|
471
|
+
[ 'uint16v', 'DosDate', 0 ],
|
|
472
|
+
[ 'uint16v', 'Timezone', 0 ],
|
|
473
|
+
[ 'uint16v', 'KeyLength', 0 ],
|
|
474
|
+
[ 'uint16v', 'Reserved1', 0 ],
|
|
475
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
476
|
+
[ 'string', 'EncryptionKey', nil, '' ]
|
|
460
477
|
).create_restraints(
|
|
461
|
-
|
|
478
|
+
[ 'EncryptionKey', 'ByteCount', nil, true ]
|
|
462
479
|
)
|
|
463
480
|
SMB_NEG_RES_LM_PKT = self.make_nbs(SMB_NEG_RES_LM_HDR_PKT)
|
|
464
481
|
|
|
465
482
|
|
|
466
483
|
# A SMB template for SMB Dialect negotiation responses (NTLM)
|
|
467
484
|
SMB_NEG_RES_NT_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
485
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
486
|
+
[ 'uint16v', 'Dialect', 0 ],
|
|
487
|
+
[ 'uint8', 'SecurityMode', 0 ],
|
|
488
|
+
[ 'uint16v', 'MaxMPX', 0 ],
|
|
489
|
+
[ 'uint16v', 'MaxVCS', 0 ],
|
|
490
|
+
[ 'uint32v', 'MaxBuff', 0 ],
|
|
491
|
+
[ 'uint32v', 'MaxRaw', 0 ],
|
|
492
|
+
[ 'uint32v', 'SessionKey', 0 ],
|
|
493
|
+
[ 'uint32v', 'Capabilities', 0 ],
|
|
494
|
+
[ 'uint32v', 'SystemTimeLow', 0 ],
|
|
495
|
+
[ 'uint32v', 'SystemTimeHigh', 0 ],
|
|
496
|
+
[ 'uint16v', 'ServerTimeZone', 0 ],
|
|
497
|
+
[ 'uint8', 'KeyLength', 0 ],
|
|
498
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
499
|
+
[ 'string', 'Payload', nil, '' ]
|
|
483
500
|
).create_restraints(
|
|
484
|
-
|
|
501
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
485
502
|
)
|
|
486
503
|
SMB_NEG_RES_NT_PKT = self.make_nbs(SMB_NEG_RES_NT_HDR_PKT)
|
|
487
504
|
|
|
488
505
|
|
|
489
506
|
# A SMB template for SMB Dialect negotiation responses (ERROR)
|
|
490
507
|
SMB_NEG_RES_ERR_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
508
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
509
|
+
[ 'uint16v', 'Dialect', 0 ],
|
|
510
|
+
[ 'uint16v', 'ByteCount', 0 ]
|
|
494
511
|
)
|
|
495
512
|
SMB_NEG_RES_ERR_PKT = self.make_nbs(SMB_NEG_RES_ERR_HDR_PKT)
|
|
496
513
|
|
|
497
514
|
|
|
498
515
|
# A SMB template for SMB Session Setup responses (LANMAN/NTLMV1)
|
|
499
516
|
SMB_SETUP_RES_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
517
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
518
|
+
[ 'uint8', 'AndX', 0 ],
|
|
519
|
+
[ 'uint8', 'Reserved1', 0 ],
|
|
520
|
+
[ 'uint16v', 'AndXOffset', 0 ],
|
|
521
|
+
[ 'uint16v', 'Action', 0 ],
|
|
522
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
523
|
+
[ 'string', 'Payload', nil, '' ]
|
|
507
524
|
).create_restraints(
|
|
508
|
-
|
|
525
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
509
526
|
)
|
|
510
527
|
SMB_SETUP_RES_PKT = self.make_nbs(SMB_SETUP_RES_HDR_PKT)
|
|
511
528
|
|
|
512
529
|
|
|
513
530
|
# A SMB template for SMB Session Setup requests (LANMAN)
|
|
514
531
|
SMB_SETUP_LANMAN_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
532
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
533
|
+
[ 'uint8', 'AndX', 0 ],
|
|
534
|
+
[ 'uint8', 'Reserved1', 0 ],
|
|
535
|
+
[ 'uint16v', 'AndXOffset', 0 ],
|
|
536
|
+
[ 'uint16v', 'MaxBuff', 0 ],
|
|
537
|
+
[ 'uint16v', 'MaxMPX', 0 ],
|
|
538
|
+
[ 'uint16v', 'VCNum', 0 ],
|
|
539
|
+
[ 'uint32v', 'SessionKey', 0 ],
|
|
540
|
+
[ 'uint16v', 'PasswordLen', 0 ],
|
|
541
|
+
[ 'uint32v', 'Reserved2', 0 ],
|
|
542
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
543
|
+
[ 'string', 'Payload', nil, '' ]
|
|
527
544
|
).create_restraints(
|
|
528
|
-
|
|
545
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
529
546
|
)
|
|
530
547
|
SMB_SETUP_LANMAN_PKT = self.make_nbs(SMB_SETUP_LANMAN_HDR_PKT)
|
|
531
548
|
|
|
532
549
|
|
|
533
550
|
# A SMB template for SMB Session Setup requests (NTLMV1)
|
|
534
551
|
SMB_SETUP_NTLMV1_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
552
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
553
|
+
[ 'uint8', 'AndX', 0 ],
|
|
554
|
+
[ 'uint8', 'Reserved1', 0 ],
|
|
555
|
+
[ 'uint16v', 'AndXOffset', 0 ],
|
|
556
|
+
[ 'uint16v', 'MaxBuff', 0 ],
|
|
557
|
+
[ 'uint16v', 'MaxMPX', 0 ],
|
|
558
|
+
[ 'uint16v', 'VCNum', 0 ],
|
|
559
|
+
[ 'uint32v', 'SessionKey', 0 ],
|
|
560
|
+
[ 'uint16v', 'PasswordLenLM', 0 ],
|
|
561
|
+
[ 'uint16v', 'PasswordLenNT', 0 ],
|
|
562
|
+
[ 'uint32v', 'Reserved2', 0 ],
|
|
563
|
+
[ 'uint32v', 'Capabilities', 0 ],
|
|
564
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
565
|
+
[ 'string', 'Payload', nil, '' ]
|
|
549
566
|
).create_restraints(
|
|
550
|
-
|
|
567
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
551
568
|
)
|
|
552
569
|
SMB_SETUP_NTLMV1_PKT = self.make_nbs(SMB_SETUP_NTLMV1_HDR_PKT)
|
|
553
570
|
|
|
554
571
|
|
|
555
572
|
# A SMB template for SMB Session Setup requests (When extended security is being used)
|
|
556
573
|
SMB_SETUP_NTLMV2_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
574
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
575
|
+
[ 'uint8', 'AndX', 0 ],
|
|
576
|
+
[ 'uint8', 'Reserved1', 0 ],
|
|
577
|
+
[ 'uint16v', 'AndXOffset', 0 ],
|
|
578
|
+
[ 'uint16v', 'MaxBuff', 0 ],
|
|
579
|
+
[ 'uint16v', 'MaxMPX', 0 ],
|
|
580
|
+
[ 'uint16v', 'VCNum', 0 ],
|
|
581
|
+
[ 'uint32v', 'SessionKey', 0 ],
|
|
582
|
+
[ 'uint16v', 'SecurityBlobLen', 0 ],
|
|
583
|
+
[ 'uint32v', 'Reserved2', 0 ],
|
|
584
|
+
[ 'uint32v', 'Capabilities', 0 ],
|
|
585
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
586
|
+
[ 'string', 'Payload', nil, '' ]
|
|
570
587
|
).create_restraints(
|
|
571
|
-
|
|
588
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
572
589
|
)
|
|
573
590
|
SMB_SETUP_NTLMV2_PKT = self.make_nbs(SMB_SETUP_NTLMV2_HDR_PKT)
|
|
574
591
|
|
|
575
592
|
|
|
576
593
|
# A SMB template for SMB Session Setup responses (When extended security is being used)
|
|
577
594
|
SMB_SETUP_NTLMV2_RES_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
595
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
596
|
+
[ 'uint8', 'AndX', 0 ],
|
|
597
|
+
[ 'uint8', 'Reserved1', 0 ],
|
|
598
|
+
[ 'uint16v', 'AndXOffset', 0 ],
|
|
599
|
+
[ 'uint16v', 'Action', 0 ],
|
|
600
|
+
[ 'uint16v', 'SecurityBlobLen', 0 ],
|
|
601
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
602
|
+
[ 'string', 'Payload', nil, '' ]
|
|
586
603
|
).create_restraints(
|
|
587
|
-
|
|
604
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
588
605
|
)
|
|
589
606
|
SMB_SETUP_NTLMV2_RES_PKT = self.make_nbs(SMB_SETUP_NTLMV2_RES_HDR_PKT)
|
|
590
607
|
|
|
591
608
|
|
|
592
609
|
# A SMB template for SMB Tree Connect requests
|
|
593
610
|
SMB_TREE_CONN_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
611
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
612
|
+
[ 'uint8', 'AndX', 0 ],
|
|
613
|
+
[ 'uint8', 'Reserved1', 0 ],
|
|
614
|
+
[ 'uint16v', 'AndXOffset', 0 ],
|
|
615
|
+
[ 'uint16v', 'Flags', 0 ],
|
|
616
|
+
[ 'uint16v', 'PasswordLen', 0 ],
|
|
617
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
618
|
+
[ 'string', 'Payload', nil, '' ]
|
|
602
619
|
).create_restraints(
|
|
603
|
-
|
|
620
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
604
621
|
)
|
|
605
622
|
SMB_TREE_CONN_PKT = self.make_nbs(SMB_TREE_CONN_HDR_PKT)
|
|
606
623
|
|
|
607
624
|
|
|
608
625
|
# A SMB template for SMB Tree Connect requests
|
|
609
626
|
SMB_TREE_CONN_RES_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
627
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
628
|
+
[ 'uint8', 'AndX', 0 ],
|
|
629
|
+
[ 'uint8', 'Reserved1', 0 ],
|
|
630
|
+
[ 'uint16v', 'AndXOffset', 0 ],
|
|
631
|
+
[ 'uint16v', 'OptionalSupport', 0 ],
|
|
632
|
+
[ 'string', 'SupportWords', nil, '' ],
|
|
633
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
634
|
+
[ 'string', 'Payload', nil, '' ]
|
|
618
635
|
).create_restraints(
|
|
619
|
-
|
|
636
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
620
637
|
)
|
|
621
638
|
SMB_TREE_CONN_RES_PKT = self.make_nbs(SMB_TREE_CONN_RES_HDR_PKT)
|
|
622
639
|
|
|
623
640
|
|
|
624
641
|
# A SMB template for SMB Tree Disconnect requests
|
|
625
642
|
SMB_TREE_DISCONN_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
643
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
644
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
645
|
+
[ 'string', 'Payload', nil, '' ]
|
|
629
646
|
).create_restraints(
|
|
630
|
-
|
|
647
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
631
648
|
)
|
|
632
649
|
SMB_TREE_DISCONN_PKT = self.make_nbs(SMB_TREE_DISCONN_HDR_PKT)
|
|
633
650
|
|
|
634
651
|
|
|
635
652
|
# A SMB template for SMB Tree Disconnect requests
|
|
636
653
|
SMB_TREE_DISCONN_RES_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
654
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
655
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
656
|
+
[ 'string', 'Payload', nil, '' ]
|
|
640
657
|
).create_restraints(
|
|
641
|
-
|
|
658
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
642
659
|
)
|
|
643
660
|
SMB_TREE_DISCONN_RES_PKT = self.make_nbs(SMB_TREE_DISCONN_RES_HDR_PKT)
|
|
644
661
|
|
|
645
662
|
|
|
646
663
|
# A SMB template for SMB Transaction requests
|
|
647
664
|
SMB_TRANS_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
665
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
666
|
+
[ 'uint16v', 'ParamCountTotal', 0 ],
|
|
667
|
+
[ 'uint16v', 'DataCountTotal', 0 ],
|
|
668
|
+
[ 'uint16v', 'ParamCountMax', 0 ],
|
|
669
|
+
[ 'uint16v', 'DataCountMax', 0 ],
|
|
670
|
+
[ 'uint8', 'SetupCountMax', 0 ],
|
|
671
|
+
[ 'uint8', 'Reserved1', 0 ],
|
|
672
|
+
[ 'uint16v', 'Flags', 0 ],
|
|
673
|
+
[ 'uint32v', 'Timeout', 0 ],
|
|
674
|
+
[ 'uint16v', 'Reserved2', 0 ],
|
|
675
|
+
[ 'uint16v', 'ParamCount', 0 ],
|
|
676
|
+
[ 'uint16v', 'ParamOffset', 0 ],
|
|
677
|
+
[ 'uint16v', 'DataCount', 0 ],
|
|
678
|
+
[ 'uint16v', 'DataOffset', 0 ],
|
|
679
|
+
[ 'uint8', 'SetupCount', 0 ],
|
|
680
|
+
[ 'uint8', 'Reserved3', 0 ],
|
|
681
|
+
[ 'string', 'SetupData', nil, '' ],
|
|
682
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
683
|
+
[ 'string', 'Payload', nil, '' ]
|
|
667
684
|
).create_restraints(
|
|
668
|
-
|
|
685
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
669
686
|
)
|
|
670
687
|
SMB_TRANS_PKT = self.make_nbs(SMB_TRANS_HDR_PKT)
|
|
671
688
|
|
|
672
689
|
|
|
673
690
|
# A SMB template for SMB Transaction responses
|
|
674
691
|
SMB_TRANS_RES_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
692
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
693
|
+
[ 'uint16v', 'ParamCountTotal', 0 ],
|
|
694
|
+
[ 'uint16v', 'DataCountTotal', 0 ],
|
|
695
|
+
[ 'uint16v', 'Reserved1', 0 ],
|
|
696
|
+
[ 'uint16v', 'ParamCount', 0 ],
|
|
697
|
+
[ 'uint16v', 'ParamOffset', 0 ],
|
|
698
|
+
[ 'uint16v', 'ParamDisplace', 0 ],
|
|
699
|
+
[ 'uint16v', 'DataCount', 0 ],
|
|
700
|
+
[ 'uint16v', 'DataOffset', 0 ],
|
|
701
|
+
[ 'uint16v', 'DataDisplace', 0 ],
|
|
702
|
+
[ 'uint8', 'SetupCount', 0 ],
|
|
703
|
+
[ 'uint8', 'Reserved2', 0 ],
|
|
704
|
+
[ 'string', 'SetupData', nil, '' ],
|
|
705
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
706
|
+
[ 'string', 'Payload', nil, '' ]
|
|
690
707
|
).create_restraints(
|
|
691
|
-
|
|
708
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
692
709
|
)
|
|
693
710
|
SMB_TRANS_RES_PKT = self.make_nbs(SMB_TRANS_RES_HDR_PKT)
|
|
694
711
|
|
|
695
712
|
# A SMB template for SMB Transaction2 requests
|
|
696
713
|
SMB_TRANS2_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
714
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
715
|
+
[ 'uint16v', 'ParamCountTotal', 0 ],
|
|
716
|
+
[ 'uint16v', 'DataCountTotal', 0 ],
|
|
717
|
+
[ 'uint16v', 'ParamCountMax', 0 ],
|
|
718
|
+
[ 'uint16v', 'DataCountMax', 0 ],
|
|
719
|
+
[ 'uint8', 'SetupCountMax', 0 ],
|
|
720
|
+
[ 'uint8', 'Reserved1', 0 ],
|
|
721
|
+
[ 'uint16v', 'Flags', 0 ],
|
|
722
|
+
[ 'uint32v', 'Timeout', 0 ],
|
|
723
|
+
[ 'uint16v', 'Reserved2', 0 ],
|
|
724
|
+
[ 'uint16v', 'ParamCount', 0 ],
|
|
725
|
+
[ 'uint16v', 'ParamOffset', 0 ],
|
|
726
|
+
[ 'uint16v', 'DataCount', 0 ],
|
|
727
|
+
[ 'uint16v', 'DataOffset', 0 ],
|
|
728
|
+
[ 'uint8', 'SetupCount', 0 ],
|
|
729
|
+
[ 'uint8', 'Reserved3', 0 ],
|
|
730
|
+
[ 'string', 'SetupData', nil, '' ],
|
|
731
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
732
|
+
[ 'string', 'Payload', nil, '' ]
|
|
716
733
|
).create_restraints(
|
|
717
|
-
|
|
734
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
718
735
|
)
|
|
719
736
|
SMB_TRANS2_PKT = self.make_nbs(SMB_TRANS2_HDR_PKT)
|
|
720
737
|
|
|
721
738
|
|
|
722
739
|
# A SMB template for SMB NTTransaction requests
|
|
723
740
|
SMB_NTTRANS_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
741
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
742
|
+
[ 'uint8', 'SetupCountMax', 0 ],
|
|
743
|
+
[ 'uint16v', 'Reserved1', 0 ],
|
|
744
|
+
[ 'uint32v', 'ParamCountTotal', 0 ],
|
|
745
|
+
[ 'uint32v', 'DataCountTotal', 0 ],
|
|
746
|
+
[ 'uint32v', 'ParamCountMax', 0 ],
|
|
747
|
+
[ 'uint32v', 'DataCountMax', 0 ],
|
|
748
|
+
[ 'uint32v', 'ParamCount', 0 ],
|
|
749
|
+
[ 'uint32v', 'ParamOffset', 0 ],
|
|
750
|
+
[ 'uint32v', 'DataCount', 0 ],
|
|
751
|
+
[ 'uint32v', 'DataOffset', 0 ],
|
|
752
|
+
[ 'uint8', 'SetupCount', 0 ],
|
|
753
|
+
[ 'uint16v', 'Subcommand', 0 ],
|
|
754
|
+
[ 'string', 'SetupData', nil, '' ],
|
|
755
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
756
|
+
[ 'string', 'Payload', nil, '' ]
|
|
740
757
|
).create_restraints(
|
|
741
|
-
|
|
758
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
742
759
|
)
|
|
743
760
|
SMB_NTTRANS_PKT = self.make_nbs(SMB_NTTRANS_HDR_PKT)
|
|
744
761
|
|
|
745
762
|
|
|
746
763
|
# A SMB template for SMB NTTransaction responses
|
|
747
764
|
SMB_NTTRANS_RES_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
765
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
766
|
+
[ 'uint8', 'Reserved1', 0 ],
|
|
767
|
+
[ 'uint16v', 'Reserved2', 0 ],
|
|
768
|
+
[ 'uint32v', 'ParamCountTotal', 0 ],
|
|
769
|
+
[ 'uint32v', 'DataCountTotal', 0 ],
|
|
770
|
+
[ 'uint32v', 'ParamCount', 0 ],
|
|
771
|
+
[ 'uint32v', 'ParamOffset', 0 ],
|
|
772
|
+
[ 'uint32v', 'ParamDisplace', 0 ],
|
|
773
|
+
[ 'uint32v', 'DataCount', 0 ],
|
|
774
|
+
[ 'uint32v', 'DataOffset', 0 ],
|
|
775
|
+
[ 'uint32v', 'DataDisplace', 0 ],
|
|
776
|
+
[ 'uint8', 'Reserved3', 0 ],
|
|
777
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
778
|
+
[ 'string', 'Payload', nil, '' ]
|
|
762
779
|
).create_restraints(
|
|
763
|
-
|
|
780
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
764
781
|
)
|
|
765
782
|
SMB_NTTRANS_RES_PKT = self.make_nbs(SMB_NTTRANS_RES_HDR_PKT)
|
|
766
783
|
|
|
767
784
|
# A SMB template for SMB NTTransaction_Secondary requests
|
|
768
785
|
SMB_NTTRANS_SECONDARY_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
786
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
787
|
+
[ 'uint8', 'Reserved1', 0 ],
|
|
788
|
+
[ 'uint16v', 'Reserved2', 0 ],
|
|
789
|
+
[ 'uint32v', 'ParamCountTotal', 0 ],
|
|
790
|
+
[ 'uint32v', 'DataCountTotal', 0 ],
|
|
791
|
+
[ 'uint32v', 'ParamCount', 0 ],
|
|
792
|
+
[ 'uint32v', 'ParamOffset', 0 ],
|
|
793
|
+
[ 'uint32v', 'ParamDisplace', 0 ],
|
|
794
|
+
[ 'uint32v', 'DataCount', 0 ],
|
|
795
|
+
[ 'uint32v', 'DataOffset', 0 ],
|
|
796
|
+
[ 'uint32v', 'DataDisplace', 0 ],
|
|
797
|
+
[ 'uint8', 'SetupCount', 0 ],
|
|
798
|
+
[ 'string', 'SetupData', nil, '' ],
|
|
799
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
800
|
+
[ 'string', 'Payload', nil, '' ]
|
|
784
801
|
).create_restraints(
|
|
785
|
-
|
|
802
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
786
803
|
)
|
|
787
804
|
SMB_NTTRANS_SECONDARY_PKT = self.make_nbs(SMB_NTTRANS_SECONDARY_HDR_PKT)
|
|
788
805
|
|
|
789
806
|
# A SMB template for SMB Create requests
|
|
790
807
|
SMB_CREATE_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
808
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
809
|
+
[ 'uint8', 'AndX', 0 ],
|
|
810
|
+
[ 'uint8', 'Reserved1', 0 ],
|
|
811
|
+
[ 'uint16v', 'AndXOffset', 0 ],
|
|
812
|
+
[ 'uint8', 'Reserved2', 0 ],
|
|
813
|
+
[ 'uint16v', 'FileNameLen', 0 ],
|
|
814
|
+
[ 'uint32v', 'CreateFlags', 0 ],
|
|
815
|
+
[ 'uint32v', 'RootFileID', 0 ],
|
|
816
|
+
[ 'uint32v', 'AccessMask', 0 ],
|
|
817
|
+
[ 'uint32v', 'AllocLow', 0 ],
|
|
818
|
+
[ 'uint32v', 'AllocHigh', 0 ],
|
|
819
|
+
[ 'uint32v', 'Attributes', 0 ],
|
|
820
|
+
[ 'uint32v', 'ShareAccess', 0 ],
|
|
821
|
+
[ 'uint32v', 'Disposition', 0 ],
|
|
822
|
+
[ 'uint32v', 'CreateOptions', 0 ],
|
|
823
|
+
[ 'uint32v', 'Impersonation', 0 ],
|
|
824
|
+
[ 'uint8', 'SecurityFlags', 0 ],
|
|
825
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
826
|
+
[ 'string', 'Payload', nil, '' ]
|
|
810
827
|
).create_restraints(
|
|
811
|
-
|
|
828
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
812
829
|
)
|
|
813
830
|
SMB_CREATE_PKT = self.make_nbs(SMB_CREATE_HDR_PKT)
|
|
814
831
|
|
|
815
832
|
|
|
816
833
|
# A SMB template for SMB Create responses
|
|
817
834
|
SMB_CREATE_RES_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
835
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
836
|
+
[ 'uint8', 'AndX', 0 ],
|
|
837
|
+
[ 'uint8', 'Reserved1', 0 ],
|
|
838
|
+
[ 'uint16v', 'AndXOffset', 0 ],
|
|
839
|
+
[ 'uint8', 'OpLock', 0 ],
|
|
840
|
+
[ 'uint16v', 'FileID', 0 ],
|
|
841
|
+
[ 'uint32v', 'Action', 0 ],
|
|
842
|
+
[ 'uint32v', 'CreateTimeLow', 0 ],
|
|
843
|
+
[ 'uint32v', 'CreateTimeHigh', 0 ],
|
|
844
|
+
[ 'uint32v', 'AccessTimeLow', 0 ],
|
|
845
|
+
[ 'uint32v', 'AccessTimeHigh', 0 ],
|
|
846
|
+
[ 'uint32v', 'WriteTimeLow', 0 ],
|
|
847
|
+
[ 'uint32v', 'WriteTimeHigh', 0 ],
|
|
848
|
+
[ 'uint32v', 'ChangeTimeLow', 0 ],
|
|
849
|
+
[ 'uint32v', 'ChangeTimeHigh', 0 ],
|
|
850
|
+
[ 'uint32v', 'Attributes', 0 ],
|
|
851
|
+
[ 'uint32v', 'AllocLow', 0 ],
|
|
852
|
+
[ 'uint32v', 'AllocHigh', 0 ],
|
|
853
|
+
[ 'uint32v', 'EOFLow', 0 ],
|
|
854
|
+
[ 'uint32v', 'EOFHigh', 0 ],
|
|
855
|
+
[ 'uint16v', 'FileType', 0 ],
|
|
856
|
+
[ 'uint16v', 'IPCState', 0 ],
|
|
857
|
+
[ 'uint8', 'IsDirectory', 0 ],
|
|
858
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
859
|
+
[ 'string', 'Payload', nil, '' ]
|
|
843
860
|
).create_restraints(
|
|
844
|
-
|
|
861
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
845
862
|
)
|
|
846
863
|
SMB_CREATE_RES_PKT = self.make_nbs(SMB_CREATE_RES_HDR_PKT)
|
|
847
864
|
|
|
848
865
|
|
|
849
866
|
# A SMB template for SMB Write requests
|
|
850
867
|
SMB_WRITE_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
868
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
869
|
+
[ 'uint8', 'AndX', 0 ],
|
|
870
|
+
[ 'uint8', 'Reserved1', 0 ],
|
|
871
|
+
[ 'uint16v', 'AndXOffset', 0 ],
|
|
872
|
+
[ 'uint16v', 'FileID', 0 ],
|
|
873
|
+
[ 'uint32v', 'Offset', 0 ],
|
|
874
|
+
[ 'uint32v', 'Reserved2', 0 ],
|
|
875
|
+
[ 'uint16v', 'WriteMode', 0 ],
|
|
876
|
+
[ 'uint16v', 'Remaining', 0 ],
|
|
877
|
+
[ 'uint16v', 'DataLenHigh', 0 ],
|
|
878
|
+
[ 'uint16v', 'DataLenLow', 0 ],
|
|
879
|
+
[ 'uint16v', 'DataOffset', 0 ],
|
|
880
|
+
[ 'uint32v', 'DataOffsetHigh', 0 ],
|
|
881
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
882
|
+
[ 'string', 'Payload', nil, '' ]
|
|
866
883
|
).create_restraints(
|
|
867
|
-
|
|
884
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
868
885
|
)
|
|
869
886
|
SMB_WRITE_PKT = self.make_nbs(SMB_WRITE_HDR_PKT)
|
|
870
887
|
|
|
871
888
|
|
|
872
889
|
# A SMB template for SMB Write responses
|
|
873
890
|
SMB_WRITE_RES_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
891
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
892
|
+
[ 'uint8', 'AndX', 0 ],
|
|
893
|
+
[ 'uint8', 'Reserved1', 0 ],
|
|
894
|
+
[ 'uint16v', 'AndXOffset', 0 ],
|
|
895
|
+
[ 'uint16v', 'CountLow', 0 ],
|
|
896
|
+
[ 'uint16v', 'Remaining', 0 ],
|
|
897
|
+
[ 'uint16v', 'CountHigh', 0 ],
|
|
898
|
+
[ 'uint16v', 'Reserved2', 0 ],
|
|
899
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
900
|
+
[ 'string', 'Payload', nil, '' ]
|
|
884
901
|
).create_restraints(
|
|
885
|
-
|
|
902
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
886
903
|
)
|
|
887
904
|
SMB_WRITE_RES_PKT = self.make_nbs(SMB_WRITE_RES_HDR_PKT)
|
|
888
905
|
|
|
889
906
|
|
|
890
907
|
# A SMB template for SMB OPEN requests
|
|
891
908
|
SMB_OPEN_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
909
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
910
|
+
[ 'uint8', 'AndX', 0 ],
|
|
911
|
+
[ 'uint8', 'Reserved1', 0 ],
|
|
912
|
+
[ 'uint16v', 'AndXOffset', 0 ],
|
|
913
|
+
[ 'uint16v', 'Flags', 0 ],
|
|
914
|
+
[ 'uint16v', 'Access', 0 ],
|
|
915
|
+
[ 'uint16v', 'SearchAttributes', 0 ],
|
|
916
|
+
[ 'uint16v', 'FileAttributes', 0 ],
|
|
917
|
+
[ 'uint32v', 'CreateTime', 0 ],
|
|
918
|
+
[ 'uint16v', 'OpenFunction', 0 ],
|
|
919
|
+
[ 'uint32v', 'AllocSize', 0 ],
|
|
920
|
+
[ 'uint32v', 'Reserved2', 0 ],
|
|
921
|
+
[ 'uint32v', 'Reserved3', 0 ],
|
|
922
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
923
|
+
[ 'string', 'Payload', nil, '' ]
|
|
907
924
|
).create_restraints(
|
|
908
|
-
|
|
925
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
909
926
|
)
|
|
910
927
|
SMB_OPEN_PKT = self.make_nbs(SMB_OPEN_HDR_PKT)
|
|
911
928
|
|
|
912
929
|
|
|
913
930
|
# A SMB template for SMB OPEN responses
|
|
914
931
|
SMB_OPEN_RES_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
932
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
933
|
+
[ 'uint8', 'AndX', 0 ],
|
|
934
|
+
[ 'uint8', 'Reserved1', 0 ],
|
|
935
|
+
[ 'uint16v', 'AndXOffset', 0 ],
|
|
936
|
+
[ 'uint16v', 'FileID', 0 ],
|
|
937
|
+
[ 'uint16v', 'FileAttributes', 0 ],
|
|
938
|
+
[ 'uint32v', 'WriteTime', 0 ],
|
|
939
|
+
[ 'uint32v', 'FileSize', 0 ],
|
|
940
|
+
[ 'uint16v', 'FileAccess', 0 ],
|
|
941
|
+
[ 'uint16v', 'FileType', 0 ],
|
|
942
|
+
[ 'uint16v', 'IPCState', 0 ],
|
|
943
|
+
[ 'uint16v', 'Action', 0 ],
|
|
944
|
+
[ 'uint32v', 'ServerFileID', 0 ],
|
|
945
|
+
[ 'uint16v', 'Reserved2', 0 ],
|
|
946
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
947
|
+
[ 'string', 'Payload', nil, '' ]
|
|
931
948
|
).create_restraints(
|
|
932
|
-
|
|
949
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
933
950
|
)
|
|
934
951
|
SMB_OPEN_RES_PKT = self.make_nbs(SMB_OPEN_RES_HDR_PKT)
|
|
935
952
|
|
|
936
953
|
|
|
937
954
|
# A SMB template for SMB Close requests
|
|
938
955
|
SMB_CLOSE_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
956
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
957
|
+
[ 'uint16v', 'FileID', 0 ],
|
|
958
|
+
[ 'uint32v', 'LastWrite', 0 ],
|
|
959
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
960
|
+
[ 'string', 'Payload', nil, '' ]
|
|
944
961
|
).create_restraints(
|
|
945
|
-
|
|
962
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
946
963
|
)
|
|
947
964
|
SMB_CLOSE_PKT = self.make_nbs(SMB_CLOSE_HDR_PKT)
|
|
948
965
|
|
|
949
966
|
|
|
950
967
|
# A SMB template for SMB Close responses
|
|
951
968
|
SMB_CLOSE_RES_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
969
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
970
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
971
|
+
[ 'string', 'Payload', nil, '' ]
|
|
955
972
|
).create_restraints(
|
|
956
|
-
|
|
973
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
957
974
|
)
|
|
958
975
|
SMB_CLOSE_RES_PKT = self.make_nbs(SMB_CLOSE_RES_HDR_PKT)
|
|
959
976
|
|
|
960
977
|
|
|
961
978
|
# A SMB template for SMB Delete requests
|
|
962
979
|
SMB_DELETE_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
980
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
981
|
+
[ 'uint16v', 'SearchAttribute', 0 ],
|
|
982
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
983
|
+
[ 'uint8', 'BufferFormat', 0 ],
|
|
984
|
+
[ 'string', 'Payload', nil, '' ]
|
|
968
985
|
).create_restraints(
|
|
969
|
-
|
|
986
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
970
987
|
)
|
|
971
988
|
SMB_DELETE_PKT = self.make_nbs(SMB_DELETE_HDR_PKT)
|
|
972
989
|
|
|
973
990
|
|
|
974
991
|
# A SMB template for SMB Delete responses
|
|
975
992
|
SMB_DELETE_RES_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
993
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
994
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
995
|
+
[ 'string', 'Payload', nil, '' ]
|
|
979
996
|
).create_restraints(
|
|
980
|
-
|
|
997
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
981
998
|
)
|
|
982
999
|
SMB_DELETE_RES_PKT = self.make_nbs(SMB_DELETE_RES_HDR_PKT)
|
|
983
1000
|
|
|
@@ -985,43 +1002,43 @@ SMB_DELETE_RES_PKT = self.make_nbs(SMB_DELETE_RES_HDR_PKT)
|
|
|
985
1002
|
|
|
986
1003
|
# A SMB template for SMB Read requests
|
|
987
1004
|
SMB_READ_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1005
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
1006
|
+
[ 'uint8', 'AndX', 0 ],
|
|
1007
|
+
[ 'uint8', 'Reserved1', 0 ],
|
|
1008
|
+
[ 'uint16v', 'AndXOffset', 0 ],
|
|
1009
|
+
[ 'uint16v', 'FileID', 0 ],
|
|
1010
|
+
[ 'uint32v', 'Offset', 0 ],
|
|
1011
|
+
[ 'uint16v', 'MaxCountLow', 0 ],
|
|
1012
|
+
[ 'uint16v', 'MinCount', 0 ],
|
|
1013
|
+
[ 'uint32v', 'Reserved2', 0 ],
|
|
1014
|
+
[ 'uint16v', 'Remaining', 0 ],
|
|
1015
|
+
[ 'uint32v', 'MaxCountHigh', 0 ],
|
|
1016
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
1017
|
+
[ 'string', 'Payload', nil, '' ]
|
|
1001
1018
|
).create_restraints(
|
|
1002
|
-
|
|
1019
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
1003
1020
|
)
|
|
1004
1021
|
SMB_READ_PKT = self.make_nbs(SMB_READ_HDR_PKT)
|
|
1005
1022
|
|
|
1006
1023
|
|
|
1007
1024
|
# A SMB template for SMB Read responses
|
|
1008
1025
|
SMB_READ_RES_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1026
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
1027
|
+
[ 'uint8', 'AndX', 0 ],
|
|
1028
|
+
[ 'uint8', 'Reserved1', 0 ],
|
|
1029
|
+
[ 'uint16v', 'AndXOffset', 0 ],
|
|
1030
|
+
[ 'uint16v', 'Remaining', 0 ],
|
|
1031
|
+
[ 'uint16v', 'DataCompaction', 0 ],
|
|
1032
|
+
[ 'uint16v', 'Reserved2', 0 ],
|
|
1033
|
+
[ 'uint16v', 'DataLenLow', 0 ],
|
|
1034
|
+
[ 'uint16v', 'DataOffset', 0 ],
|
|
1035
|
+
[ 'uint32v', 'DataLenHigh', 0 ],
|
|
1036
|
+
[ 'uint32v', 'Reserved3', 0 ],
|
|
1037
|
+
[ 'uint16v', 'Reserved4', 0 ],
|
|
1038
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
1039
|
+
[ 'string', 'Payload', nil, '' ]
|
|
1023
1040
|
).create_restraints(
|
|
1024
|
-
|
|
1041
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
1025
1042
|
)
|
|
1026
1043
|
SMB_READ_RES_PKT = self.make_nbs(SMB_READ_RES_HDR_PKT)
|
|
1027
1044
|
|
|
@@ -1029,13 +1046,13 @@ SMB_READ_RES_PKT = self.make_nbs(SMB_READ_RES_HDR_PKT)
|
|
|
1029
1046
|
|
|
1030
1047
|
# A SMB template for SMB Search requests
|
|
1031
1048
|
SMB_SEARCH_HDR_PKT = Rex::Struct2::CStructTemplate.new(
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1049
|
+
[ 'template', 'SMB', SMB_HDR ],
|
|
1050
|
+
[ 'uint16v', 'MaxCount', 0 ],
|
|
1051
|
+
[ 'uint16v', 'Attributes', 0 ],
|
|
1052
|
+
[ 'uint16v', 'ByteCount', 0 ],
|
|
1053
|
+
[ 'string', 'Payload', nil, '' ]
|
|
1037
1054
|
).create_restraints(
|
|
1038
|
-
|
|
1055
|
+
[ 'Payload', 'ByteCount', nil, true ]
|
|
1039
1056
|
)
|
|
1040
1057
|
SMB_SEARCH_PKT = self.make_nbs(SMB_SEARCH_HDR_PKT)
|
|
1041
1058
|
|