librex 0.0.19 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (435) hide show
  1. data/Rakefile +0 -1
  2. metadata +1 -434
  3. data/lib/rex/LICENSE +0 -29
  4. data/lib/rex/arch.rb +0 -103
  5. data/lib/rex/arch/sparc.rb +0 -75
  6. data/lib/rex/arch/sparc.rb.ut.rb +0 -18
  7. data/lib/rex/arch/x86.rb +0 -513
  8. data/lib/rex/arch/x86.rb.ut.rb +0 -93
  9. data/lib/rex/assembly/nasm.rb +0 -104
  10. data/lib/rex/assembly/nasm.rb.ut.rb +0 -22
  11. data/lib/rex/codepage.map +0 -104
  12. data/lib/rex/compat.rb +0 -311
  13. data/lib/rex/constants.rb +0 -113
  14. data/lib/rex/elfparsey.rb +0 -11
  15. data/lib/rex/elfparsey/elf.rb +0 -123
  16. data/lib/rex/elfparsey/elfbase.rb +0 -258
  17. data/lib/rex/elfparsey/exceptions.rb +0 -27
  18. data/lib/rex/elfscan.rb +0 -12
  19. data/lib/rex/elfscan/scanner.rb +0 -207
  20. data/lib/rex/elfscan/search.rb +0 -46
  21. data/lib/rex/encoder/alpha2.rb +0 -31
  22. data/lib/rex/encoder/alpha2/alpha_mixed.rb +0 -68
  23. data/lib/rex/encoder/alpha2/alpha_upper.rb +0 -79
  24. data/lib/rex/encoder/alpha2/generic.rb +0 -114
  25. data/lib/rex/encoder/alpha2/unicode_mixed.rb +0 -117
  26. data/lib/rex/encoder/alpha2/unicode_upper.rb +0 -129
  27. data/lib/rex/encoder/ndr.rb +0 -89
  28. data/lib/rex/encoder/ndr.rb.ut.rb +0 -44
  29. data/lib/rex/encoder/nonalpha.rb +0 -61
  30. data/lib/rex/encoder/nonupper.rb +0 -64
  31. data/lib/rex/encoder/xdr.rb +0 -106
  32. data/lib/rex/encoder/xdr.rb.ut.rb +0 -29
  33. data/lib/rex/encoder/xor.rb +0 -69
  34. data/lib/rex/encoder/xor/dword.rb +0 -13
  35. data/lib/rex/encoder/xor/dword_additive.rb +0 -13
  36. data/lib/rex/encoders/xor_dword.rb +0 -35
  37. data/lib/rex/encoders/xor_dword_additive.rb +0 -53
  38. data/lib/rex/encoders/xor_dword_additive.rb.ut.rb +0 -12
  39. data/lib/rex/encoding/xor.rb +0 -20
  40. data/lib/rex/encoding/xor.rb.ts.rb +0 -14
  41. data/lib/rex/encoding/xor/byte.rb +0 -15
  42. data/lib/rex/encoding/xor/byte.rb.ut.rb +0 -21
  43. data/lib/rex/encoding/xor/dword.rb +0 -21
  44. data/lib/rex/encoding/xor/dword.rb.ut.rb +0 -15
  45. data/lib/rex/encoding/xor/dword_additive.rb +0 -92
  46. data/lib/rex/encoding/xor/dword_additive.rb.ut.rb +0 -15
  47. data/lib/rex/encoding/xor/exceptions.rb +0 -17
  48. data/lib/rex/encoding/xor/generic.rb +0 -146
  49. data/lib/rex/encoding/xor/generic.rb.ut.rb +0 -120
  50. data/lib/rex/encoding/xor/qword.rb +0 -15
  51. data/lib/rex/encoding/xor/word.rb +0 -21
  52. data/lib/rex/encoding/xor/word.rb.ut.rb +0 -13
  53. data/lib/rex/exceptions.rb +0 -275
  54. data/lib/rex/exceptions.rb.ut.rb +0 -44
  55. data/lib/rex/exploitation/cmdstager.rb +0 -9
  56. data/lib/rex/exploitation/cmdstager/base.rb +0 -175
  57. data/lib/rex/exploitation/cmdstager/debug_asm.rb +0 -142
  58. data/lib/rex/exploitation/cmdstager/debug_write.rb +0 -136
  59. data/lib/rex/exploitation/cmdstager/tftp.rb +0 -63
  60. data/lib/rex/exploitation/cmdstager/vbs.rb +0 -128
  61. data/lib/rex/exploitation/egghunter.rb +0 -277
  62. data/lib/rex/exploitation/egghunter.rb.ut.rb +0 -25
  63. data/lib/rex/exploitation/encryptjs.rb +0 -77
  64. data/lib/rex/exploitation/heaplib.js.b64 +0 -331
  65. data/lib/rex/exploitation/heaplib.rb +0 -94
  66. data/lib/rex/exploitation/javascriptosdetect.rb +0 -897
  67. data/lib/rex/exploitation/obfuscatejs.rb +0 -335
  68. data/lib/rex/exploitation/omelet.rb +0 -320
  69. data/lib/rex/exploitation/omelet.rb.ut.rb +0 -13
  70. data/lib/rex/exploitation/opcodedb.rb +0 -818
  71. data/lib/rex/exploitation/opcodedb.rb.ut.rb +0 -279
  72. data/lib/rex/exploitation/seh.rb +0 -92
  73. data/lib/rex/exploitation/seh.rb.ut.rb +0 -19
  74. data/lib/rex/file.rb +0 -112
  75. data/lib/rex/file.rb.ut.rb +0 -16
  76. data/lib/rex/image_source.rb +0 -12
  77. data/lib/rex/image_source/disk.rb +0 -60
  78. data/lib/rex/image_source/image_source.rb +0 -46
  79. data/lib/rex/image_source/memory.rb +0 -37
  80. data/lib/rex/io/bidirectional_pipe.rb +0 -157
  81. data/lib/rex/io/datagram_abstraction.rb +0 -35
  82. data/lib/rex/io/ring_buffer.rb +0 -364
  83. data/lib/rex/io/stream.rb +0 -319
  84. data/lib/rex/io/stream_abstraction.rb +0 -197
  85. data/lib/rex/io/stream_server.rb +0 -211
  86. data/lib/rex/job_container.rb +0 -187
  87. data/lib/rex/logging.rb +0 -4
  88. data/lib/rex/logging/log_dispatcher.rb +0 -179
  89. data/lib/rex/logging/log_sink.rb +0 -42
  90. data/lib/rex/logging/sinks/flatfile.rb +0 -55
  91. data/lib/rex/logging/sinks/stderr.rb +0 -43
  92. data/lib/rex/machparsey.rb +0 -9
  93. data/lib/rex/machparsey/exceptions.rb +0 -34
  94. data/lib/rex/machparsey/mach.rb +0 -209
  95. data/lib/rex/machparsey/machbase.rb +0 -408
  96. data/lib/rex/machscan.rb +0 -9
  97. data/lib/rex/machscan/scanner.rb +0 -217
  98. data/lib/rex/mime.rb +0 -9
  99. data/lib/rex/mime/header.rb +0 -77
  100. data/lib/rex/mime/message.rb +0 -144
  101. data/lib/rex/mime/part.rb +0 -20
  102. data/lib/rex/nop/opty2.rb +0 -108
  103. data/lib/rex/nop/opty2.rb.ut.rb +0 -23
  104. data/lib/rex/nop/opty2_tables.rb +0 -300
  105. data/lib/rex/ole.rb +0 -205
  106. data/lib/rex/ole/clsid.rb +0 -47
  107. data/lib/rex/ole/difat.rb +0 -141
  108. data/lib/rex/ole/directory.rb +0 -231
  109. data/lib/rex/ole/direntry.rb +0 -240
  110. data/lib/rex/ole/docs/dependencies.txt +0 -8
  111. data/lib/rex/ole/docs/references.txt +0 -1
  112. data/lib/rex/ole/fat.rb +0 -99
  113. data/lib/rex/ole/header.rb +0 -204
  114. data/lib/rex/ole/minifat.rb +0 -77
  115. data/lib/rex/ole/propset.rb +0 -144
  116. data/lib/rex/ole/samples/create_ole.rb +0 -27
  117. data/lib/rex/ole/samples/dir.rb +0 -35
  118. data/lib/rex/ole/samples/dump_stream.rb +0 -34
  119. data/lib/rex/ole/samples/ole_info.rb +0 -23
  120. data/lib/rex/ole/storage.rb +0 -395
  121. data/lib/rex/ole/stream.rb +0 -53
  122. data/lib/rex/ole/substorage.rb +0 -49
  123. data/lib/rex/ole/util.rb +0 -157
  124. data/lib/rex/parser/arguments.rb +0 -97
  125. data/lib/rex/parser/arguments.rb.ut.rb +0 -67
  126. data/lib/rex/parser/ini.rb +0 -185
  127. data/lib/rex/parser/ini.rb.ut.rb +0 -29
  128. data/lib/rex/parser/ip360_aspl_xml.rb +0 -102
  129. data/lib/rex/parser/ip360_xml.rb +0 -97
  130. data/lib/rex/parser/nessus_xml.rb +0 -118
  131. data/lib/rex/parser/netsparker_xml.rb +0 -94
  132. data/lib/rex/parser/nexpose_xml.rb +0 -136
  133. data/lib/rex/parser/nmap_xml.rb +0 -137
  134. data/lib/rex/parser/retina_xml.rb +0 -109
  135. data/lib/rex/payloads.rb +0 -1
  136. data/lib/rex/payloads/win32.rb +0 -2
  137. data/lib/rex/payloads/win32/common.rb +0 -26
  138. data/lib/rex/payloads/win32/kernel.rb +0 -53
  139. data/lib/rex/payloads/win32/kernel/common.rb +0 -54
  140. data/lib/rex/payloads/win32/kernel/migration.rb +0 -12
  141. data/lib/rex/payloads/win32/kernel/recovery.rb +0 -50
  142. data/lib/rex/payloads/win32/kernel/stager.rb +0 -194
  143. data/lib/rex/peparsey.rb +0 -12
  144. data/lib/rex/peparsey/exceptions.rb +0 -32
  145. data/lib/rex/peparsey/pe.rb +0 -212
  146. data/lib/rex/peparsey/pe_memdump.rb +0 -63
  147. data/lib/rex/peparsey/pebase.rb +0 -1680
  148. data/lib/rex/peparsey/section.rb +0 -136
  149. data/lib/rex/pescan.rb +0 -13
  150. data/lib/rex/pescan/analyze.rb +0 -309
  151. data/lib/rex/pescan/scanner.rb +0 -206
  152. data/lib/rex/pescan/search.rb +0 -56
  153. data/lib/rex/platforms.rb +0 -1
  154. data/lib/rex/platforms/windows.rb +0 -51
  155. data/lib/rex/poly.rb +0 -132
  156. data/lib/rex/poly/block.rb +0 -477
  157. data/lib/rex/poly/register.rb +0 -100
  158. data/lib/rex/poly/register/x86.rb +0 -40
  159. data/lib/rex/post.rb +0 -8
  160. data/lib/rex/post/dir.rb +0 -51
  161. data/lib/rex/post/file.rb +0 -172
  162. data/lib/rex/post/file_stat.rb +0 -220
  163. data/lib/rex/post/gen.pl +0 -13
  164. data/lib/rex/post/io.rb +0 -182
  165. data/lib/rex/post/meterpreter.rb +0 -4
  166. data/lib/rex/post/meterpreter/channel.rb +0 -445
  167. data/lib/rex/post/meterpreter/channel_container.rb +0 -54
  168. data/lib/rex/post/meterpreter/channels/pool.rb +0 -160
  169. data/lib/rex/post/meterpreter/channels/pools/file.rb +0 -62
  170. data/lib/rex/post/meterpreter/channels/pools/stream_pool.rb +0 -103
  171. data/lib/rex/post/meterpreter/channels/stream.rb +0 -87
  172. data/lib/rex/post/meterpreter/client.rb +0 -364
  173. data/lib/rex/post/meterpreter/client_core.rb +0 -274
  174. data/lib/rex/post/meterpreter/dependencies.rb +0 -3
  175. data/lib/rex/post/meterpreter/extension.rb +0 -32
  176. data/lib/rex/post/meterpreter/extensions/espia/espia.rb +0 -58
  177. data/lib/rex/post/meterpreter/extensions/espia/tlv.rb +0 -16
  178. data/lib/rex/post/meterpreter/extensions/incognito/incognito.rb +0 -94
  179. data/lib/rex/post/meterpreter/extensions/incognito/tlv.rb +0 -21
  180. data/lib/rex/post/meterpreter/extensions/networkpug/networkpug.rb +0 -57
  181. data/lib/rex/post/meterpreter/extensions/networkpug/tlv.rb +0 -15
  182. data/lib/rex/post/meterpreter/extensions/priv/fs.rb +0 -118
  183. data/lib/rex/post/meterpreter/extensions/priv/passwd.rb +0 -61
  184. data/lib/rex/post/meterpreter/extensions/priv/priv.rb +0 -111
  185. data/lib/rex/post/meterpreter/extensions/priv/tlv.rb +0 -28
  186. data/lib/rex/post/meterpreter/extensions/sniffer/sniffer.rb +0 -101
  187. data/lib/rex/post/meterpreter/extensions/sniffer/tlv.rb +0 -26
  188. data/lib/rex/post/meterpreter/extensions/stdapi/constants.rb +0 -333
  189. data/lib/rex/post/meterpreter/extensions/stdapi/fs/dir.rb +0 -282
  190. data/lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb +0 -266
  191. data/lib/rex/post/meterpreter/extensions/stdapi/fs/file_stat.rb +0 -103
  192. data/lib/rex/post/meterpreter/extensions/stdapi/fs/io.rb +0 -48
  193. data/lib/rex/post/meterpreter/extensions/stdapi/net/config.rb +0 -144
  194. data/lib/rex/post/meterpreter/extensions/stdapi/net/interface.rb +0 -73
  195. data/lib/rex/post/meterpreter/extensions/stdapi/net/route.rb +0 -56
  196. data/lib/rex/post/meterpreter/extensions/stdapi/net/socket.rb +0 -137
  197. data/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_client_channel.rb +0 -180
  198. data/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_server_channel.rb +0 -167
  199. data/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/udp_channel.rb +0 -208
  200. data/lib/rex/post/meterpreter/extensions/stdapi/railgun.rb.ts.rb +0 -6
  201. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/api_constants.rb +0 -38106
  202. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/api_constants.rb.ut.rb +0 -31
  203. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/buffer_item.rb +0 -47
  204. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/buffer_item.rb.ut.rb +0 -36
  205. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_advapi32.rb +0 -1818
  206. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_iphlpapi.rb +0 -96
  207. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_kernel32.rb +0 -3848
  208. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_netapi32.rb +0 -26
  209. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_ntdll.rb +0 -153
  210. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_shell32.rb +0 -21
  211. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_user32.rb +0 -3169
  212. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_ws2_32.rb +0 -599
  213. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll.rb +0 -318
  214. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_function.rb +0 -100
  215. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_function.rb.ut.rb +0 -42
  216. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_helper.rb +0 -148
  217. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_helper.rb.ut.rb +0 -127
  218. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/multicall.rb +0 -309
  219. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/railgun.rb +0 -204
  220. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/tlv.rb +0 -51
  221. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/util.rb +0 -630
  222. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/win_const_manager.rb +0 -75
  223. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/win_const_manager.rb.ut.rb +0 -103
  224. data/lib/rex/post/meterpreter/extensions/stdapi/stdapi.rb +0 -149
  225. data/lib/rex/post/meterpreter/extensions/stdapi/sys/config.rb +0 -97
  226. data/lib/rex/post/meterpreter/extensions/stdapi/sys/event_log.rb +0 -192
  227. data/lib/rex/post/meterpreter/extensions/stdapi/sys/event_log_subsystem/event_record.rb +0 -41
  228. data/lib/rex/post/meterpreter/extensions/stdapi/sys/power.rb +0 -61
  229. data/lib/rex/post/meterpreter/extensions/stdapi/sys/process.rb +0 -370
  230. data/lib/rex/post/meterpreter/extensions/stdapi/sys/process_subsystem/image.rb +0 -129
  231. data/lib/rex/post/meterpreter/extensions/stdapi/sys/process_subsystem/io.rb +0 -55
  232. data/lib/rex/post/meterpreter/extensions/stdapi/sys/process_subsystem/memory.rb +0 -336
  233. data/lib/rex/post/meterpreter/extensions/stdapi/sys/process_subsystem/thread.rb +0 -141
  234. data/lib/rex/post/meterpreter/extensions/stdapi/sys/registry.rb +0 -279
  235. data/lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_key.rb +0 -193
  236. data/lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_value.rb +0 -102
  237. data/lib/rex/post/meterpreter/extensions/stdapi/sys/thread.rb +0 -180
  238. data/lib/rex/post/meterpreter/extensions/stdapi/tlv.rb +0 -211
  239. data/lib/rex/post/meterpreter/extensions/stdapi/ui.rb +0 -227
  240. data/lib/rex/post/meterpreter/extensions/stdapi/webcam/webcam.rb +0 -63
  241. data/lib/rex/post/meterpreter/inbound_packet_handler.rb +0 -30
  242. data/lib/rex/post/meterpreter/object_aliases.rb +0 -83
  243. data/lib/rex/post/meterpreter/packet.rb +0 -688
  244. data/lib/rex/post/meterpreter/packet_dispatcher.rb +0 -431
  245. data/lib/rex/post/meterpreter/packet_parser.rb +0 -94
  246. data/lib/rex/post/meterpreter/packet_response_waiter.rb +0 -83
  247. data/lib/rex/post/meterpreter/ui/console.rb +0 -137
  248. data/lib/rex/post/meterpreter/ui/console/command_dispatcher.rb +0 -62
  249. data/lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb +0 -730
  250. data/lib/rex/post/meterpreter/ui/console/command_dispatcher/espia.rb +0 -108
  251. data/lib/rex/post/meterpreter/ui/console/command_dispatcher/incognito.rb +0 -241
  252. data/lib/rex/post/meterpreter/ui/console/command_dispatcher/networkpug.rb +0 -231
  253. data/lib/rex/post/meterpreter/ui/console/command_dispatcher/priv.rb +0 -61
  254. data/lib/rex/post/meterpreter/ui/console/command_dispatcher/priv/elevate.rb +0 -98
  255. data/lib/rex/post/meterpreter/ui/console/command_dispatcher/priv/passwd.rb +0 -51
  256. data/lib/rex/post/meterpreter/ui/console/command_dispatcher/priv/timestomp.rb +0 -132
  257. data/lib/rex/post/meterpreter/ui/console/command_dispatcher/sniffer.rb +0 -187
  258. data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi.rb +0 -65
  259. data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/fs.rb +0 -442
  260. data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb +0 -298
  261. data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/sys.rb +0 -486
  262. data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/ui.rb +0 -315
  263. data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/webcam.rb +0 -157
  264. data/lib/rex/post/meterpreter/ui/console/interactive_channel.rb +0 -95
  265. data/lib/rex/post/permission.rb +0 -26
  266. data/lib/rex/post/process.rb +0 -57
  267. data/lib/rex/post/thread.rb +0 -57
  268. data/lib/rex/post/ui.rb +0 -52
  269. data/lib/rex/proto.rb +0 -13
  270. data/lib/rex/proto.rb.ts.rb +0 -8
  271. data/lib/rex/proto/dcerpc.rb +0 -6
  272. data/lib/rex/proto/dcerpc.rb.ts.rb +0 -9
  273. data/lib/rex/proto/dcerpc/client.rb +0 -361
  274. data/lib/rex/proto/dcerpc/client.rb.ut.rb +0 -491
  275. data/lib/rex/proto/dcerpc/exceptions.rb +0 -150
  276. data/lib/rex/proto/dcerpc/handle.rb +0 -47
  277. data/lib/rex/proto/dcerpc/handle.rb.ut.rb +0 -85
  278. data/lib/rex/proto/dcerpc/ndr.rb +0 -72
  279. data/lib/rex/proto/dcerpc/ndr.rb.ut.rb +0 -41
  280. data/lib/rex/proto/dcerpc/packet.rb +0 -253
  281. data/lib/rex/proto/dcerpc/packet.rb.ut.rb +0 -56
  282. data/lib/rex/proto/dcerpc/response.rb +0 -187
  283. data/lib/rex/proto/dcerpc/response.rb.ut.rb +0 -15
  284. data/lib/rex/proto/dcerpc/uuid.rb +0 -84
  285. data/lib/rex/proto/dcerpc/uuid.rb.ut.rb +0 -46
  286. data/lib/rex/proto/dhcp.rb +0 -7
  287. data/lib/rex/proto/dhcp/constants.rb +0 -33
  288. data/lib/rex/proto/dhcp/server.rb +0 -292
  289. data/lib/rex/proto/drda.rb +0 -5
  290. data/lib/rex/proto/drda.rb.ts.rb +0 -17
  291. data/lib/rex/proto/drda/constants.rb +0 -49
  292. data/lib/rex/proto/drda/constants.rb.ut.rb +0 -23
  293. data/lib/rex/proto/drda/packet.rb +0 -252
  294. data/lib/rex/proto/drda/packet.rb.ut.rb +0 -109
  295. data/lib/rex/proto/drda/utils.rb +0 -123
  296. data/lib/rex/proto/drda/utils.rb.ut.rb +0 -84
  297. data/lib/rex/proto/http.rb +0 -5
  298. data/lib/rex/proto/http.rb.ts.rb +0 -12
  299. data/lib/rex/proto/http/client.rb +0 -821
  300. data/lib/rex/proto/http/client.rb.ut.rb +0 -95
  301. data/lib/rex/proto/http/handler.rb +0 -46
  302. data/lib/rex/proto/http/handler/erb.rb +0 -128
  303. data/lib/rex/proto/http/handler/erb.rb.ut.rb +0 -21
  304. data/lib/rex/proto/http/handler/erb.rb.ut.rb.rhtml +0 -1
  305. data/lib/rex/proto/http/handler/proc.rb +0 -60
  306. data/lib/rex/proto/http/handler/proc.rb.ut.rb +0 -24
  307. data/lib/rex/proto/http/header.rb +0 -161
  308. data/lib/rex/proto/http/header.rb.ut.rb +0 -46
  309. data/lib/rex/proto/http/packet.rb +0 -407
  310. data/lib/rex/proto/http/packet.rb.ut.rb +0 -165
  311. data/lib/rex/proto/http/request.rb +0 -356
  312. data/lib/rex/proto/http/request.rb.ut.rb +0 -214
  313. data/lib/rex/proto/http/response.rb +0 -90
  314. data/lib/rex/proto/http/response.rb.ut.rb +0 -149
  315. data/lib/rex/proto/http/server.rb +0 -369
  316. data/lib/rex/proto/http/server.rb.ut.rb +0 -79
  317. data/lib/rex/proto/ntlm.rb +0 -7
  318. data/lib/rex/proto/ntlm.rb.ut.rb +0 -177
  319. data/lib/rex/proto/ntlm/base.rb +0 -326
  320. data/lib/rex/proto/ntlm/constants.rb +0 -74
  321. data/lib/rex/proto/ntlm/crypt.rb +0 -415
  322. data/lib/rex/proto/ntlm/exceptions.rb +0 -16
  323. data/lib/rex/proto/ntlm/message.rb +0 -536
  324. data/lib/rex/proto/ntlm/utils.rb +0 -764
  325. data/lib/rex/proto/proxy/socks4a.rb +0 -440
  326. data/lib/rex/proto/rfb.rb +0 -19
  327. data/lib/rex/proto/rfb.rb.ut.rb +0 -37
  328. data/lib/rex/proto/rfb/cipher.rb +0 -84
  329. data/lib/rex/proto/rfb/client.rb +0 -207
  330. data/lib/rex/proto/rfb/constants.rb +0 -52
  331. data/lib/rex/proto/smb.rb +0 -7
  332. data/lib/rex/proto/smb.rb.ts.rb +0 -8
  333. data/lib/rex/proto/smb/client.rb +0 -1952
  334. data/lib/rex/proto/smb/client.rb.ut.rb +0 -223
  335. data/lib/rex/proto/smb/constants.rb +0 -1047
  336. data/lib/rex/proto/smb/constants.rb.ut.rb +0 -18
  337. data/lib/rex/proto/smb/crypt.rb +0 -36
  338. data/lib/rex/proto/smb/evasions.rb +0 -66
  339. data/lib/rex/proto/smb/exceptions.rb +0 -858
  340. data/lib/rex/proto/smb/simpleclient.rb +0 -306
  341. data/lib/rex/proto/smb/simpleclient.rb.ut.rb +0 -128
  342. data/lib/rex/proto/smb/utils.rb +0 -103
  343. data/lib/rex/proto/smb/utils.rb.ut.rb +0 -20
  344. data/lib/rex/proto/sunrpc.rb +0 -1
  345. data/lib/rex/proto/sunrpc/client.rb +0 -195
  346. data/lib/rex/proto/tftp.rb +0 -12
  347. data/lib/rex/proto/tftp/constants.rb +0 -39
  348. data/lib/rex/proto/tftp/server.rb +0 -497
  349. data/lib/rex/proto/tftp/server.rb.ut.rb +0 -28
  350. data/lib/rex/script.rb +0 -42
  351. data/lib/rex/script/base.rb +0 -59
  352. data/lib/rex/script/meterpreter.rb +0 -15
  353. data/lib/rex/script/shell.rb +0 -9
  354. data/lib/rex/service.rb +0 -48
  355. data/lib/rex/service_manager.rb +0 -141
  356. data/lib/rex/service_manager.rb.ut.rb +0 -32
  357. data/lib/rex/services/local_relay.rb +0 -423
  358. data/lib/rex/socket.rb +0 -684
  359. data/lib/rex/socket.rb.ut.rb +0 -107
  360. data/lib/rex/socket/comm.rb +0 -119
  361. data/lib/rex/socket/comm/local.rb +0 -412
  362. data/lib/rex/socket/comm/local.rb.ut.rb +0 -75
  363. data/lib/rex/socket/ip.rb +0 -130
  364. data/lib/rex/socket/parameters.rb +0 -345
  365. data/lib/rex/socket/parameters.rb.ut.rb +0 -51
  366. data/lib/rex/socket/range_walker.rb +0 -346
  367. data/lib/rex/socket/range_walker.rb.ut.rb +0 -55
  368. data/lib/rex/socket/ssl_tcp.rb +0 -184
  369. data/lib/rex/socket/ssl_tcp.rb.ut.rb +0 -39
  370. data/lib/rex/socket/ssl_tcp_server.rb +0 -122
  371. data/lib/rex/socket/ssl_tcp_server.rb.ut.rb +0 -61
  372. data/lib/rex/socket/subnet_walker.rb +0 -75
  373. data/lib/rex/socket/subnet_walker.rb.ut.rb +0 -28
  374. data/lib/rex/socket/switch_board.rb +0 -278
  375. data/lib/rex/socket/switch_board.rb.ut.rb +0 -52
  376. data/lib/rex/socket/tcp.rb +0 -76
  377. data/lib/rex/socket/tcp.rb.ut.rb +0 -64
  378. data/lib/rex/socket/tcp_server.rb +0 -66
  379. data/lib/rex/socket/tcp_server.rb.ut.rb +0 -44
  380. data/lib/rex/socket/udp.rb +0 -164
  381. data/lib/rex/socket/udp.rb.ut.rb +0 -44
  382. data/lib/rex/struct2.rb +0 -5
  383. data/lib/rex/struct2/c_struct.rb +0 -181
  384. data/lib/rex/struct2/c_struct_template.rb +0 -39
  385. data/lib/rex/struct2/constant.rb +0 -26
  386. data/lib/rex/struct2/element.rb +0 -44
  387. data/lib/rex/struct2/generic.rb +0 -73
  388. data/lib/rex/struct2/restraint.rb +0 -54
  389. data/lib/rex/struct2/s_string.rb +0 -72
  390. data/lib/rex/struct2/s_struct.rb +0 -111
  391. data/lib/rex/sync.rb +0 -6
  392. data/lib/rex/sync/event.rb +0 -94
  393. data/lib/rex/sync/read_write_lock.rb +0 -176
  394. data/lib/rex/sync/ref.rb +0 -57
  395. data/lib/rex/sync/thread_safe.rb +0 -82
  396. data/lib/rex/test.rb +0 -35
  397. data/lib/rex/text.rb +0 -1163
  398. data/lib/rex/text.rb.ut.rb +0 -190
  399. data/lib/rex/thread_factory.rb +0 -42
  400. data/lib/rex/time.rb +0 -65
  401. data/lib/rex/transformer.rb +0 -115
  402. data/lib/rex/transformer.rb.ut.rb +0 -38
  403. data/lib/rex/ui.rb +0 -21
  404. data/lib/rex/ui/interactive.rb +0 -298
  405. data/lib/rex/ui/output.rb +0 -78
  406. data/lib/rex/ui/output/none.rb +0 -18
  407. data/lib/rex/ui/progress_tracker.rb +0 -96
  408. data/lib/rex/ui/subscriber.rb +0 -149
  409. data/lib/rex/ui/text/color.rb +0 -97
  410. data/lib/rex/ui/text/color.rb.ut.rb +0 -18
  411. data/lib/rex/ui/text/dispatcher_shell.rb +0 -467
  412. data/lib/rex/ui/text/input.rb +0 -117
  413. data/lib/rex/ui/text/input/buffer.rb +0 -75
  414. data/lib/rex/ui/text/input/readline.rb +0 -129
  415. data/lib/rex/ui/text/input/socket.rb +0 -95
  416. data/lib/rex/ui/text/input/stdio.rb +0 -45
  417. data/lib/rex/ui/text/irb_shell.rb +0 -57
  418. data/lib/rex/ui/text/output.rb +0 -80
  419. data/lib/rex/ui/text/output/buffer.rb +0 -61
  420. data/lib/rex/ui/text/output/file.rb +0 -43
  421. data/lib/rex/ui/text/output/socket.rb +0 -43
  422. data/lib/rex/ui/text/output/stdio.rb +0 -40
  423. data/lib/rex/ui/text/progress_tracker.rb +0 -56
  424. data/lib/rex/ui/text/progress_tracker.rb.ut.rb +0 -34
  425. data/lib/rex/ui/text/shell.rb +0 -328
  426. data/lib/rex/ui/text/table.rb +0 -279
  427. data/lib/rex/ui/text/table.rb.ut.rb +0 -55
  428. data/lib/rex/zip.rb +0 -93
  429. data/lib/rex/zip/archive.rb +0 -184
  430. data/lib/rex/zip/blocks.rb +0 -182
  431. data/lib/rex/zip/entry.rb +0 -104
  432. data/lib/rex/zip/samples/comment.rb +0 -32
  433. data/lib/rex/zip/samples/mkwar.rb +0 -138
  434. data/lib/rex/zip/samples/mkzip.rb +0 -19
  435. data/lib/rex/zip/samples/recursive.rb +0 -58
@@ -1,223 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- $:.unshift(File.join(File.dirname(__FILE__), '..', '..', '..'))
4
-
5
- require 'rex/test'
6
- require 'rex/proto/smb/constants'
7
- require 'rex/proto/smb/exceptions'
8
- require 'rex/proto/smb/utils'
9
- require 'rex/proto/smb/client'
10
- require 'rex/proto/dcerpc'
11
- require 'rex/socket'
12
-
13
- class Rex::Proto::SMB::Client::UnitTest < Test::Unit::TestCase
14
-
15
- Klass = Rex::Proto::SMB::Client
16
-
17
- # Alias over the Rex DCERPC protocol modules
18
- DCERPCPacket = Rex::Proto::DCERPC::Packet
19
- DCERPCClient = Rex::Proto::DCERPC::Client
20
- DCERPCResponse = Rex::Proto::DCERPC::Response
21
- DCERPCUUID = Rex::Proto::DCERPC::UUID
22
-
23
- def test_smb_open_share
24
-
25
- share = 'C$'
26
-
27
- write_data = ('A' * 256)
28
- filename = 'smb_test.txt'
29
-
30
- begin
31
- Timeout.timeout($_REX_TEST_TIMEOUT) {
32
- s = Rex::Socket.create_tcp(
33
- 'PeerHost' => $_REX_TEST_SMB_HOST,
34
- 'PeerPort' => 139
35
- )
36
-
37
- c = Klass.new(s)
38
-
39
- # Request a SMB session over NetBIOS
40
- # puts "[*] Requesting a SMB session over NetBIOS..."
41
- ok = c.session_request()
42
- assert_kind_of(Rex::Struct2::CStruct, ok)
43
-
44
- # Check for a positive session response
45
- # A negative response is 0x83
46
- assert_equal(ok.v['Type'], 0x82)
47
-
48
- # puts "[*] Negotiating SMB dialects..."
49
- ok = c.negotiate()
50
- assert_kind_of(Rex::Struct2::CStruct, ok)
51
-
52
- # puts "[*] Authenticating with NTLMv2..."
53
- ok = c.session_setup_with_ntlmssp($_REX_TEXT_SMB_USER, $_REX_TEXT_SMB_PASS)
54
- assert_kind_of(Rex::Struct2::CStruct, ok)
55
- assert_not_equal(c.auth_user_id, 0)
56
-
57
- # puts "[*] Connecting to the share..."
58
- ok = c.tree_connect(share)
59
- assert_kind_of(Rex::Struct2::CStruct, ok)
60
- assert_not_equal(c.last_tree_id, 0)
61
-
62
- # puts "[*] Opening a file for write..."
63
- ok = c.open(filename)
64
- assert_kind_of(Rex::Struct2::CStruct, ok)
65
- assert_not_equal(c.last_file_id, 0)
66
-
67
- # puts "[*] Writing data to the test file..."
68
- ok = c.write(c.last_file_id, 0, write_data)
69
- assert_kind_of(Rex::Struct2::CStruct, ok)
70
- assert_equal(ok['Payload'].v['CountLow'], write_data.length)
71
-
72
- # puts "[*] Closing the test file..."
73
- ok = c.close(c.last_file_id)
74
- assert_kind_of(Rex::Struct2::CStruct, ok)
75
-
76
- # puts "[*] Opening a file for read..."
77
- ok = c.open(filename, 1)
78
- assert_kind_of(Rex::Struct2::CStruct, ok)
79
- assert_not_equal(c.last_file_id, 0)
80
-
81
- # puts "[*] Reading data from the test file..."
82
- ok = c.read(c.last_file_id, 0, write_data.length)
83
- assert_kind_of(Rex::Struct2::CStruct, ok)
84
- assert_equal(ok['Payload'].v['DataLenLow'], write_data.length)
85
-
86
- read_data = ok.to_s.slice(
87
- ok['Payload'].v['DataOffset'] + 4,
88
- ok['Payload'].v['DataLenLow']
89
- )
90
- assert_equal(read_data, write_data)
91
-
92
- # puts "[*] Closing the test file..."
93
- ok = c.close(c.last_file_id)
94
- assert_kind_of(Rex::Struct2::CStruct, ok)
95
-
96
- # puts "[*] Disconnecting from the tree..."
97
- ok = c.tree_disconnect
98
- assert_kind_of(Rex::Struct2::CStruct, ok)
99
-
100
- s.close
101
-
102
-
103
- # Reconnect and delete the file
104
- s = Rex::Socket.create_tcp(
105
- 'PeerHost' => $_REX_TEST_SMB_HOST,
106
- 'PeerPort' => 139
107
- )
108
-
109
- c = Klass.new(s)
110
-
111
- # Request a SMB session over NetBIOS
112
- # puts "[*] Requesting a SMB session over NetBIOS..."
113
- ok = c.session_request()
114
- assert_kind_of(Rex::Struct2::CStruct, ok)
115
-
116
- # Check for a positive session response
117
- # A negative response is 0x83
118
- assert_equal(ok.v['Type'], 0x82)
119
-
120
- # puts "[*] Negotiating SMB dialects..."
121
- ok = c.negotiate()
122
- assert_kind_of(Rex::Struct2::CStruct, ok)
123
-
124
- # puts "[*] Authenticating with NTLMv2..."
125
- ok = c.session_setup_with_ntlmssp($_REX_TEXT_SMB_USER, $_REX_TEXT_SMB_PASS)
126
- assert_kind_of(Rex::Struct2::CStruct, ok)
127
- assert_not_equal(c.auth_user_id, 0)
128
-
129
- # puts "[*] Connecting to the share..."
130
- ok = c.tree_connect(share)
131
- assert_kind_of(Rex::Struct2::CStruct, ok)
132
- assert_not_equal(c.last_tree_id, 0)
133
-
134
- # puts "[*] Deleting the test file..."
135
- ok = c.delete(filename)
136
- assert_kind_of(Rex::Struct2::CStruct, ok)
137
-
138
- # puts "[*] Diconnecting from the tree..."
139
- ok = c.tree_disconnect
140
- assert_kind_of(Rex::Struct2::CStruct, ok)
141
-
142
- s.close
143
- }
144
- rescue Timeout::Error
145
- flunk('timeout')
146
- end
147
-
148
- end
149
-
150
- def test_smb_session_request
151
- begin
152
- Timeout.timeout($_REX_TEST_TIMEOUT) {
153
- s = Rex::Socket.create_tcp(
154
- 'PeerHost' => $_REX_TEST_SMB_HOST,
155
- 'PeerPort' => 139
156
- )
157
-
158
- c = Klass.new(s)
159
-
160
- # Request a SMB session over NetBIOS
161
- # puts "[*] Requesting a SMB session over NetBIOS..."
162
- ok = c.session_request()
163
- assert_kind_of(Rex::Struct2::CStruct, ok)
164
-
165
- # Check for a positive session response
166
- # A negative response is 0x83
167
- assert_equal(ok.v['Type'], 0x82)
168
-
169
- # puts "[*] Negotiating SMB dialects..."
170
- ok = c.negotiate()
171
- assert_kind_of(Rex::Struct2::CStruct, ok)
172
-
173
- # puts "[*] Authenticating with NTLMv2..."
174
- ok = c.session_setup_with_ntlmssp
175
- assert_kind_of(Rex::Struct2::CStruct, ok)
176
-
177
- # puts "[*] Authenticating with NTLMv1..."
178
- ok = c.session_setup_no_ntlmssp
179
- assert_kind_of(Rex::Struct2::CStruct, ok)
180
-
181
- # puts "[*] Authenticating with clear text passwords..."
182
- begin
183
- ok = c.session_setup_clear
184
- assert_kind_of(Rex::Struct2::CStruct, ok)
185
- rescue Rex::Proto::SMB::Exceptions::ErrorCode
186
- if ($!.error_code != 0x00010002)
187
- raise $!
188
- end
189
- end
190
-
191
- # puts "[*] Connecting to IPC$..."
192
- ok = c.tree_connect
193
- assert_kind_of(Rex::Struct2::CStruct, ok)
194
-
195
- # puts "[*] Opening the \BROWSER pipe..."
196
- ok = c.create_pipe('\BROWSER')
197
- assert_kind_of(Rex::Struct2::CStruct, ok)
198
-
199
- vers = DCERPCUUID.vers_by_name('SRVSVC')
200
- uuid = DCERPCUUID.uuid_by_name('SRVSVC')
201
- bind, ctx = DCERPCPacket.make_bind_fake_multi(uuid, vers)
202
-
203
- # puts "[*] Binding to the Server Service..."
204
- ok = c.trans_named_pipe(c.last_file_id, bind)
205
- assert_kind_of(Rex::Struct2::CStruct, ok)
206
-
207
- data = ok.to_s.slice(
208
- ok['Payload'].v['DataOffset'] + 4,
209
- ok['Payload'].v['DataCount']
210
- )
211
- assert_not_equal(data, nil)
212
-
213
- resp = DCERPCResponse.new(data)
214
- assert_equal(resp.type, 12)
215
- }
216
- rescue Timeout::Error
217
- flunk('timeout')
218
- end
219
- end
220
-
221
-
222
- end
223
-
@@ -1,1047 +0,0 @@
1
- module Rex
2
- module Proto
3
- module SMB
4
- class Constants
5
-
6
- require 'rex/text'
7
- require 'rex/struct2'
8
-
9
- # SMB Commands
10
- SMB_COM_CREATE_DIRECTORY = 0x00
11
- SMB_COM_DELETE_DIRECTORY = 0x01
12
- SMB_COM_OPEN = 0x02
13
- SMB_COM_CREATE = 0x03
14
- SMB_COM_CLOSE = 0x04
15
- SMB_COM_FLUSH = 0x05
16
- SMB_COM_DELETE = 0x06
17
- SMB_COM_RENAME = 0x07
18
- SMB_COM_QUERY_INFORMATION = 0x08
19
- SMB_COM_SET_INFORMATION = 0x09
20
- SMB_COM_READ = 0x0a
21
- SMB_COM_WRITE = 0x0b
22
- SMB_COM_LOCK_BYTE_RANGE = 0x0c
23
- SMB_COM_UNLOCK_BYTE_RANGE = 0x0d
24
- SMB_COM_CREATE_TEMPORARY = 0x0e
25
- SMB_COM_CREATE_NEW = 0x0f
26
- SMB_COM_CHECK_DIRECTORY = 0x10
27
- SMB_COM_PROCESS_EXIT = 0x11
28
- SMB_COM_SEEK = 0x12
29
- SMB_COM_LOCK_AND_READ = 0x13
30
- SMB_COM_WRITE_AND_UNLOCK = 0x14
31
- SMB_COM_READ_RAW = 0x1a
32
- SMB_COM_READ_MPX = 0x1b
33
- SMB_COM_READ_MPX_SECONDARY = 0x1c
34
- SMB_COM_WRITE_RAW = 0x1d
35
- SMB_COM_WRITE_MPX = 0x1e
36
- SMB_COM_WRITE_MPX_SECONDARY = 0x1f
37
- SMB_COM_WRITE_COMPLETE = 0x20
38
- SMB_COM_QUERY_SERVER = 0x21
39
- SMB_COM_SET_INFORMATION2 = 0x22
40
- SMB_COM_QUERY_INFORMATION2 = 0x23
41
- SMB_COM_LOCKING_ANDX = 0x24
42
- SMB_COM_TRANSACTION = 0x25
43
- SMB_COM_TRANSACTION_SECONDARY = 0x26
44
- SMB_COM_IOCTL = 0x27
45
- SMB_COM_IOCTL_SECONDARY = 0x28
46
- SMB_COM_COPY = 0x29
47
- SMB_COM_MOVE = 0x2a
48
- SMB_COM_ECHO = 0x2b
49
- SMB_COM_WRITE_AND_CLOSE = 0x2c
50
- SMB_COM_OPEN_ANDX = 0x2d
51
- SMB_COM_READ_ANDX = 0x2e
52
- SMB_COM_WRITE_ANDX = 0x2f
53
- SMB_COM_NEW_FILE_SIZE = 0x30
54
- SMB_COM_CLOSE_AND_TREE_DISC = 0x31
55
- SMB_COM_TRANSACTION2 = 0x32
56
- SMB_COM_TRANSACTION2_SECONDARY = 0x33
57
- SMB_COM_FIND_CLOSE2 = 0x34
58
- SMB_COM_FIND_NOTIFY_CLOSE = 0x35
59
- SMB_COM_TREE_CONNECT = 0x70
60
- SMB_COM_TREE_DISCONNECT = 0x71
61
- SMB_COM_NEGOTIATE = 0x72
62
- SMB_COM_SESSION_SETUP_ANDX = 0x73
63
- SMB_COM_LOGOFF_ANDX = 0x74
64
- SMB_COM_TREE_CONNECT_ANDX = 0x75
65
- SMB_COM_QUERY_INFORMATION_DISK = 0x80
66
- SMB_COM_SEARCH = 0x81
67
- SMB_COM_FIND = 0x82
68
- SMB_COM_FIND_UNIQUE = 0x83
69
- SMB_COM_FIND_CLOSE = 0x84
70
- SMB_COM_NT_TRANSACT = 0xa0
71
- SMB_COM_NT_TRANSACT_SECONDARY = 0xa1
72
- SMB_COM_NT_CREATE_ANDX = 0xa2
73
- SMB_COM_NT_CANCEL = 0xa4
74
- SMB_COM_NT_RENAME = 0xa5
75
- SMB_COM_OPEN_PRINT_FILE = 0xc0
76
- SMB_COM_WRITE_PRINT_FILE = 0xc1
77
- SMB_COM_CLOSE_PRINT_FILE = 0xc2
78
- SMB_COM_GET_PRINT_QUEUE = 0xc3
79
- SMB_COM_READ_BULK = 0xd8
80
- SMB_COM_WRITE_BULK = 0xd9
81
- SMB_COM_NO_ANDX_COMMAND = 0xff
82
-
83
-
84
- # SMB Version 2 Commands
85
- SMB2_OP_NEGPROT = 0x00
86
- SMB2_OP_SESSSETUP = 0x01
87
- SMB2_OP_LOGOFF = 0x02
88
- SMB2_OP_TCON = 0x03
89
- SMB2_OP_TDIS = 0x04
90
- SMB2_OP_CREATE = 0x05
91
- SMB2_OP_CLOSE = 0x06
92
- SMB2_OP_FLUSH = 0x07
93
- SMB2_OP_READ = 0x08
94
- SMB2_OP_WRITE = 0x09
95
- SMB2_OP_LOCK = 0x0a
96
- SMB2_OP_IOCTL = 0x0b
97
- SMB2_OP_CANCEL = 0x0c
98
- SMB2_OP_KEEPALIVE = 0x0d
99
- SMB2_OP_FIND = 0x0e
100
- SMB2_OP_NOTIFY = 0x0f
101
- SMB2_OP_GETINFO = 0x10
102
- SMB2_OP_SETINFO = 0x11
103
- SMB2_OP_BREAK = 0x12
104
-
105
-
106
- # SMB_COM_NT_TRANSACT Subcommands
107
- NT_TRANSACT_CREATE = 1 # File open/create
108
- NT_TRANSACT_IOCTL = 2 # Device IOCTL
109
- NT_TRANSACT_SET_SECURITY_DESC = 3 # Set security descriptor
110
- NT_TRANSACT_NOTIFY_CHANGE = 4 # Start directory watch
111
- NT_TRANSACT_RENAME = 5 # Reserved (Handle-based)
112
- NT_TRANSACT_QUERY_SECURITY_DESC = 6 # Retrieve security
113
- NT_TRANSACT_GET_USER_QUOTA = 7 # Get quota
114
- NT_TRANSACT_SET_USER_QUOTA = 8 # Set quota
115
-
116
- # Open Modes
117
- OPEN_MODE_CREAT = 0x10 # Create the file if file does not exists. Otherwise, operation fails.
118
- OPEN_MODE_EXCL = 0x00 # When used with SMB_O_CREAT, operation fails if file exists. Cannot be used with SMB_O_OPEN.
119
- OPEN_MODE_OPEN = 0x01 # Open the file if the file exists
120
- OPEN_MODE_TRUNC = 0x02 # Truncate the file if the file exists
121
-
122
- # Shared Access
123
- OPEN_SHARE_COMPAT = 0x00
124
- OPEN_SHARE_DENY_EXCL = 0x10
125
- OPEN_SHARE_DENY_WRITE = 0x20
126
- OPEN_SHARE_DENY_READEXEC = 0x30
127
- OPEN_SHARE_DENY_NONE = 0x40
128
-
129
-
130
- # File Access
131
- OPEN_ACCESS_READ = 0x00
132
- OPEN_ACCESS_WRITE = 0x01
133
- OPEN_ACCESS_READWRITE = 0x02
134
- OPEN_ACCESS_EXEC = 0x03
135
-
136
- # Create Disposition
137
- CREATE_ACCESS_SUPERSEDE = 0x00 # Replace any previously existing file
138
- CREATE_ACCESS_EXIST = 0x01 # Open existing file and fail if it does not exist
139
- CREATE_ACCESS_CREATE = 0x02 # Create the file, fail if it already exists
140
- CREATE_ACCESS_OPENCREATE = 0x03 # Open existing file or create it if it does not exist
141
- CREATE_ACCESS_OVEREXIST = 0x04 # Overwrite existing file and fail if it does not exist
142
- CREATE_ACCESS_OVERCREATE = 0x05 # Overwrite existing file or create it if it does not exist
143
-
144
-
145
- # Wildcard NetBIOS name
146
- NETBIOS_REDIR = 'CACACACACACACACACACACACACACACAAA'
147
-
148
-
149
-
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
-
166
-
167
- # SMB_COM_TRANSACTION2 Commands
168
- TRANS2_OPEN2 = 0
169
- TRANS2_FIND_FIRST2 = 1
170
- TRANS2_FIND_NEXT2 = 2
171
- TRANS2_QUERY_FS_INFO = 3
172
- TRANS2_SET_PATH_INFO = 6
173
-
174
- TRANS2_CREATE_DIRECTORY = 13
175
-
176
- # SMB_COM_TRANSACTION2 QUERY_FS_INFO information levels
177
- SMB_INFO_ALLOCATION = 1
178
- SMB_INFO_VOLUME = 2
179
- SMB_QUERY_FS_VOLUME_INFO = 0x102
180
- SMB_QUERY_FS_SIZE_INFO = 0x103
181
- SMB_QUERY_FS_DEVICE_INFO = 0x104
182
- SMB_QUERY_FS_ATTRIBUTE_INFO = 0x105
183
-
184
- # SMB_COM_TRANSACTION2 QUERY_PATH_INFO information levels
185
- SMB_INFO_STANDARD = 1
186
- SMB_INFO_QUERY_EA_SIZE = 2
187
- SMB_INFO_QUERY_EAS_FROM_LIST = 3
188
- SMB_INFO_QUERY_ALL_EAS = 4
189
- SMB_INFO_IS_NAME_VALID = 6
190
- SMB_QUERY_FILE_BASIC_INFO = 0x101
191
- SMB_QUERY_FILE_STANDARD_INFO = 0x102
192
- SMB_QUERY_FILE_EA_INFO = 0x103
193
- SMB_QUERY_FILE_NAME_INFO = 0x104
194
- SMB_QUERY_FILE_ALL_INFO = 0x107
195
- SMB_QUERY_FILE_ALT_NAME_INFO = 0x108
196
- SMB_QUERY_FILE_STREAM_INFO = 0x109
197
- SMB_QUERY_FILE_COMPRESSION_INFO = 0x10B
198
- SMB_QUERY_FILE_UNIX_BASIC = 0x200
199
- SMB_QUERY_FILE_UNIX_LINK = 0x201
200
- SMB_INFO_PASSTHROUGH = 0x1000
201
-
202
-
203
- # Device Types
204
- FILE_DEVICE_BEEP = 0x00000001
205
- FILE_DEVICE_CD_ROM = 0x00000002
206
- FILE_DEVICE_CD_ROM_FILE_SYSTEM = 0x00000003
207
- FILE_DEVICE_CONTROLLER = 0x00000004
208
- FILE_DEVICE_DATALINK = 0x00000005
209
- FILE_DEVICE_DFS = 0x00000006
210
- FILE_DEVICE_DISK = 0x00000007
211
- FILE_DEVICE_DISK_FILE_SYSTEM = 0x00000008
212
- FILE_DEVICE_FILE_SYSTEM = 0x00000009
213
- FILE_DEVICE_INPORT_PORT = 0x0000000A
214
- FILE_DEVICE_KEYBOARD = 0x0000000B
215
- FILE_DEVICE_MAILSLOT = 0x0000000C
216
- FILE_DEVICE_MIDI_IN = 0x0000000D
217
- FILE_DEVICE_MIDI_OUT = 0x0000000E
218
- FILE_DEVICE_MOUSE = 0x0000000F
219
- FILE_DEVICE_MULTI_UNC_PROVIDER = 0x00000010
220
- FILE_DEVICE_NAMED_PIPE = 0x00000011
221
- FILE_DEVICE_NETWORK = 0x00000012
222
- FILE_DEVICE_NETWORK_BROWSER = 0x00000013
223
- FILE_DEVICE_NETWORK_FILE_SYSTEM = 0x00000014
224
- FILE_DEVICE_NULL = 0x00000015
225
- FILE_DEVICE_PARALLEL_PORT = 0x00000016
226
- FILE_DEVICE_PHYSICAL_NETCARD = 0x00000017
227
- FILE_DEVICE_PRINTER = 0x00000018
228
- FILE_DEVICE_SCANNER = 0x00000019
229
- FILE_DEVICE_SERIAL_MOUSE_PORT = 0x0000001A
230
- FILE_DEVICE_SERIAL_PORT = 0x0000001B
231
- FILE_DEVICE_SCREEN = 0x0000001C
232
- FILE_DEVICE_SOUND = 0x0000001D
233
- FILE_DEVICE_STREAMS = 0x0000001E
234
- FILE_DEVICE_TAPE = 0x0000001F
235
- FILE_DEVICE_TAPE_FILE_SYSTEM = 0x00000020
236
- FILE_DEVICE_TRANSPORT = 0x00000021
237
- FILE_DEVICE_UNKNOWN = 0x00000022
238
- FILE_DEVICE_VIDEO = 0x00000023
239
- FILE_DEVICE_VIRTUAL_DISK = 0x00000024
240
- FILE_DEVICE_WAVE_IN = 0x00000025
241
- FILE_DEVICE_WAVE_OUT = 0x00000026
242
- FILE_DEVICE_8042_PORT = 0x00000027
243
- FILE_DEVICE_NETWORK_REDIRECTOR = 0x00000028
244
- FILE_DEVICE_BATTERY = 0x00000029
245
- FILE_DEVICE_BUS_EXTENDER = 0x0000002A
246
- FILE_DEVICE_MODEM = 0x0000002B
247
- FILE_DEVICE_VDM = 0x0000002C
248
-
249
- # File and Device Attributes
250
- FILE_REMOVABLE_MEDIA = 0x00000001
251
- FILE_READ_ONLY_DEVICE = 0x00000002
252
- FILE_FLOPPY_DISKETTE = 0x00000004
253
- FILE_WRITE_ONE_MEDIA = 0x00000008
254
- FILE_REMOTE_DEVICE = 0x00000010
255
- FILE_DEVICE_IS_MOUNTED = 0x00000020
256
- FILE_VIRTUAL_VOLUME = 0x00000040
257
- FILE_CASE_SENSITIVE_SEARCH = 0x00000001
258
- FILE_CASE_PRESERVED_NAMES = 0x00000002
259
- FILE_PERSISTENT_ACLS = 0x00000004
260
- FILE_FILE_COMPRESSION = 0x00000008
261
- FILE_VOLUME_QUOTAS = 0x00000010
262
- FILE_VOLUME_IS_COMPRESSED = 0x00008000
263
-
264
-
265
- # SMB Error Codes
266
- SMB_STATUS_SUCCESS = 0x00000000
267
- SMB_ERROR_BUFFER_OVERFLOW = 0x80000005
268
- SMB_STATUS_MORE_PROCESSING_REQUIRED = 0xC0000016
269
- SMB_STATUS_ACCESS_DENIED = 0xC0000022
270
- SMB_STATUS_LOGON_FAILURE = 0xC000006D
271
-
272
- # SMB Dialect Compatibility
273
- DIALECT = {}
274
-
275
- DIALECT['PC NETWORK PROGRAM 1.0'] = [
276
- SMB_COM_CHECK_DIRECTORY,
277
- SMB_COM_CLOSE,
278
- SMB_COM_CLOSE_PRINT_FILE,
279
- SMB_COM_CREATE,
280
- SMB_COM_CREATE_DIRECTORY,
281
- SMB_COM_CREATE_NEW,
282
- SMB_COM_CREATE_TEMPORARY,
283
- SMB_COM_DELETE,
284
- SMB_COM_DELETE_DIRECTORY,
285
- SMB_COM_FLUSH,
286
- SMB_COM_GET_PRINT_QUEUE,
287
- SMB_COM_LOCK_BYTE_RANGE,
288
- SMB_COM_NEGOTIATE,
289
- SMB_COM_OPEN,
290
- SMB_COM_OPEN_PRINT_FILE,
291
- SMB_COM_PROCESS_EXIT,
292
- SMB_COM_QUERY_INFORMATION,
293
- SMB_COM_QUERY_INFORMATION_DISK,
294
- SMB_COM_READ,
295
- SMB_COM_RENAME,
296
- SMB_COM_SEARCH,
297
- SMB_COM_SEEK,
298
- SMB_COM_SET_INFORMATION,
299
- SMB_COM_TREE_CONNECT,
300
- SMB_COM_TREE_DISCONNECT,
301
- SMB_COM_UNLOCK_BYTE_RANGE,
302
- SMB_COM_WRITE,
303
- SMB_COM_WRITE_PRINT_FILE
304
- ]
305
-
306
- DIALECT['LANMAN 1.0'] = DIALECT['PC NETWORK PROGRAM 1.0'] + [
307
- SMB_COM_COPY,
308
- SMB_COM_ECHO,
309
- SMB_COM_FIND,
310
- SMB_COM_FIND_CLOSE,
311
- SMB_COM_FIND_UNIQUE,
312
- SMB_COM_IOCTL,
313
- SMB_COM_IOCTL_SECONDARY,
314
- SMB_COM_LOCK_AND_READ,
315
- SMB_COM_LOCKING_ANDX,
316
- SMB_COM_MOVE,
317
- SMB_COM_OPEN_ANDX,
318
- SMB_COM_QUERY_INFORMATION2,
319
- SMB_COM_READ_ANDX,
320
- SMB_COM_READ_MPX,
321
- SMB_COM_READ_RAW,
322
- SMB_COM_SESSION_SETUP_ANDX,
323
- SMB_COM_SET_INFORMATION2,
324
- SMB_COM_TRANSACTION,
325
- SMB_COM_TRANSACTION_SECONDARY,
326
- SMB_COM_TREE_CONNECT_ANDX,
327
- SMB_COM_WRITE_AND_CLOSE,
328
- SMB_COM_WRITE_AND_UNLOCK,
329
- SMB_COM_WRITE_ANDX,
330
- SMB_COM_WRITE_COMPLETE,
331
- SMB_COM_WRITE_MPX,
332
- SMB_COM_WRITE_MPX_SECONDARY,
333
- SMB_COM_WRITE_RAW
334
- ]
335
-
336
- DIALECT['LM1.2X002'] = DIALECT['LANMAN 1.0'] + [
337
- SMB_COM_FIND_CLOSE2,
338
- SMB_COM_LOGOFF_ANDX,
339
- SMB_COM_TRANSACTION2,
340
- SMB_COM_TRANSACTION2_SECONDARY
341
- ]
342
-
343
- DIALECT['NTLM 0.12'] = DIALECT['LM1.2X002'] + [
344
- SMB_COM_NT_CANCEL,
345
- SMB_COM_NT_CREATE_ANDX,
346
- SMB_COM_NT_RENAME,
347
- SMB_COM_NT_TRANSACT,
348
- SMB_COM_NT_TRANSACT_SECONDARY
349
- ]
350
-
351
- # Create a NetBIOS session packet template
352
- def self.make_nbs (template)
353
- Rex::Struct2::CStructTemplate.new(
354
- [ 'uint8', 'Type', 0 ],
355
- [ 'uint8', 'Flags', 0 ],
356
- [ 'uint16n', 'PayloadLen', 0 ],
357
- [ 'template', 'Payload', template ]
358
- ).create_restraints(
359
- [ 'Payload', 'PayloadLen', nil, true ]
360
- )
361
- end
362
-
363
-
364
- # A raw NetBIOS session template
365
- NBRAW_HDR_PKT = Rex::Struct2::CStructTemplate.new(
366
- [ 'string', 'Payload', nil, '']
367
- )
368
- NBRAW_PKT = self.make_nbs(NBRAW_HDR_PKT)
369
-
370
-
371
- # The SMB header template
372
- SMB_HDR = Rex::Struct2::CStructTemplate.new(
373
- [ 'uint32n', 'Magic', 0xff534d42 ],
374
- [ 'uint8', 'Command', 0 ],
375
- [ 'uint32v', 'ErrorClass', 0 ],
376
- [ 'uint8', 'Flags1', 0 ],
377
- [ 'uint16v', 'Flags2', 0 ],
378
- [ 'uint16v', 'ProcessIDHigh', 0 ],
379
- [ 'uint32v', 'Signature1', 0 ],
380
- [ 'uint32v', 'Signature2', 0 ],
381
- [ 'uint16v', 'Reserved1', 0 ],
382
- [ 'uint16v', 'TreeID', 0 ],
383
- [ 'uint16v', 'ProcessID', 0 ],
384
- [ 'uint16v', 'UserID', 0 ],
385
- [ 'uint16v', 'MultiplexID', 0 ],
386
- [ 'uint8', 'WordCount', 0 ]
387
- )
388
-
389
-
390
- # The SMB2 header template
391
- SMB2_HDR = Rex::Struct2::CStructTemplate.new(
392
- [ 'uint32n', 'Magic', 0xfe534d42 ],
393
- [ 'uint16v', 'HeaderLen', 64 ],
394
- [ 'uint16v', 'Reserved0', 0 ],
395
- [ 'uint32v', 'NTStatus', 0 ],
396
-
397
- [ 'uint16v', 'Opcode', 0 ],
398
- [ 'uint16v', 'Reserved1', 0 ],
399
-
400
- [ 'uint16v', 'Flags1', 0 ],
401
- [ 'uint16v', 'Flags2', 0 ],
402
-
403
- [ 'uint32v', 'ChainOffset', 0 ],
404
-
405
- [ 'uint32v', 'SequenceHigh', 0 ],
406
- [ 'uint32v', 'SequenceLow', 0 ],
407
-
408
- [ 'uint32v', 'ProcessID', 0 ],
409
- [ 'uint32v', 'TreeID', 0 ],
410
- [ 'uint32v', 'UserIDHigh', 0 ],
411
- [ 'uint32v', 'UserIDLow', 0 ],
412
-
413
- [ 'uint32v', 'SignatureA', 0 ],
414
- [ 'uint32v', 'SignatureB', 0 ],
415
- [ 'uint32v', 'SignatureC', 0 ],
416
- [ 'uint32v', 'SignatureD', 0 ],
417
- [ 'string', 'Payload', nil, '']
418
- )
419
-
420
- # A basic SMB template to read all responses
421
- SMB_BASE_HDR_PKT = Rex::Struct2::CStructTemplate.new(
422
- [ 'template', 'SMB', SMB_HDR ],
423
- [ 'uint16v', 'ByteCount', 0 ],
424
- [ 'string', 'Payload', nil, '' ]
425
- ).create_restraints(
426
- [ 'Payload', 'ByteCount', nil, true ]
427
- )
428
- SMB_BASE_PKT = self.make_nbs(SMB_BASE_HDR_PKT)
429
-
430
-
431
- # A SMB template for SMB Dialect negotiation
432
- SMB_NEG_HDR_PKT = Rex::Struct2::CStructTemplate.new(
433
-
434
- [ 'template', 'SMB', SMB_HDR ],
435
- [ 'uint16v', 'ByteCount', 0 ],
436
- [ 'string', 'Payload', nil, '' ]
437
- ).create_restraints(
438
- [ 'Payload', 'ByteCount', nil, true ]
439
- )
440
- SMB_NEG_PKT = self.make_nbs(SMB_NEG_HDR_PKT)
441
-
442
-
443
- # A SMB template for SMB Dialect negotiation responses (LANMAN)
444
- SMB_NEG_RES_LM_HDR_PKT = Rex::Struct2::CStructTemplate.new(
445
- [ 'template', 'SMB', SMB_HDR ],
446
- [ 'uint16v', 'Dialect', 0 ],
447
- [ 'uint16v', 'SecurityMode', 0 ],
448
- [ 'uint16v', 'MaxBuff', 0 ],
449
- [ 'uint16v', 'MaxMPX', 0 ],
450
- [ 'uint16v', 'MaxVCS', 0 ],
451
- [ 'uint16v', 'RawMode', 0 ],
452
- [ 'uint32v', 'SessionKey', 0 ],
453
- [ 'uint16v', 'DosTime', 0 ],
454
- [ 'uint16v', 'DosDate', 0 ],
455
- [ 'uint16v', 'Timezone', 0 ],
456
- [ 'uint16v', 'KeyLength', 0 ],
457
- [ 'uint16v', 'Reserved1', 0 ],
458
- [ 'uint16v', 'ByteCount', 0 ],
459
- [ 'string', 'EncryptionKey', nil, '' ]
460
- ).create_restraints(
461
- [ 'EncryptionKey', 'ByteCount', nil, true ]
462
- )
463
- SMB_NEG_RES_LM_PKT = self.make_nbs(SMB_NEG_RES_LM_HDR_PKT)
464
-
465
-
466
- # A SMB template for SMB Dialect negotiation responses (NTLM)
467
- SMB_NEG_RES_NT_HDR_PKT = Rex::Struct2::CStructTemplate.new(
468
- [ 'template', 'SMB', SMB_HDR ],
469
- [ 'uint16v', 'Dialect', 0 ],
470
- [ 'uint8', 'SecurityMode', 0 ],
471
- [ 'uint16v', 'MaxMPX', 0 ],
472
- [ 'uint16v', 'MaxVCS', 0 ],
473
- [ 'uint32v', 'MaxBuff', 0 ],
474
- [ 'uint32v', 'MaxRaw', 0 ],
475
- [ 'uint32v', 'SessionKey', 0 ],
476
- [ 'uint32v', 'Capabilities', 0 ],
477
- [ 'uint32v', 'SystemTimeLow', 0 ],
478
- [ 'uint32v', 'SystemTimeHigh', 0 ],
479
- [ 'uint16v', 'ServerTimeZone', 0 ],
480
- [ 'uint8', 'KeyLength', 0 ],
481
- [ 'uint16v', 'ByteCount', 0 ],
482
- [ 'string', 'Payload', nil, '' ]
483
- ).create_restraints(
484
- [ 'Payload', 'ByteCount', nil, true ]
485
- )
486
- SMB_NEG_RES_NT_PKT = self.make_nbs(SMB_NEG_RES_NT_HDR_PKT)
487
-
488
-
489
- # A SMB template for SMB Dialect negotiation responses (ERROR)
490
- SMB_NEG_RES_ERR_HDR_PKT = Rex::Struct2::CStructTemplate.new(
491
- [ 'template', 'SMB', SMB_HDR ],
492
- [ 'uint16v', 'Dialect', 0 ],
493
- [ 'uint16v', 'ByteCount', 0 ]
494
- )
495
- SMB_NEG_RES_ERR_PKT = self.make_nbs(SMB_NEG_RES_ERR_HDR_PKT)
496
-
497
-
498
- # A SMB template for SMB Session Setup responses (LANMAN/NTLMV1)
499
- SMB_SETUP_RES_HDR_PKT = Rex::Struct2::CStructTemplate.new(
500
- [ 'template', 'SMB', SMB_HDR ],
501
- [ 'uint8', 'AndX', 0 ],
502
- [ 'uint8', 'Reserved1', 0 ],
503
- [ 'uint16v', 'AndXOffset', 0 ],
504
- [ 'uint16v', 'Action', 0 ],
505
- [ 'uint16v', 'ByteCount', 0 ],
506
- [ 'string', 'Payload', nil, '' ]
507
- ).create_restraints(
508
- [ 'Payload', 'ByteCount', nil, true ]
509
- )
510
- SMB_SETUP_RES_PKT = self.make_nbs(SMB_SETUP_RES_HDR_PKT)
511
-
512
-
513
- # A SMB template for SMB Session Setup requests (LANMAN)
514
- SMB_SETUP_LANMAN_HDR_PKT = Rex::Struct2::CStructTemplate.new(
515
- [ 'template', 'SMB', SMB_HDR ],
516
- [ 'uint8', 'AndX', 0 ],
517
- [ 'uint8', 'Reserved1', 0 ],
518
- [ 'uint16v', 'AndXOffset', 0 ],
519
- [ 'uint16v', 'MaxBuff', 0 ],
520
- [ 'uint16v', 'MaxMPX', 0 ],
521
- [ 'uint16v', 'VCNum', 0 ],
522
- [ 'uint32v', 'SessionKey', 0 ],
523
- [ 'uint16v', 'PasswordLen', 0 ],
524
- [ 'uint32v', 'Reserved2', 0 ],
525
- [ 'uint16v', 'ByteCount', 0 ],
526
- [ 'string', 'Payload', nil, '' ]
527
- ).create_restraints(
528
- [ 'Payload', 'ByteCount', nil, true ]
529
- )
530
- SMB_SETUP_LANMAN_PKT = self.make_nbs(SMB_SETUP_LANMAN_HDR_PKT)
531
-
532
-
533
- # A SMB template for SMB Session Setup requests (NTLMV1)
534
- SMB_SETUP_NTLMV1_HDR_PKT = Rex::Struct2::CStructTemplate.new(
535
- [ 'template', 'SMB', SMB_HDR ],
536
- [ 'uint8', 'AndX', 0 ],
537
- [ 'uint8', 'Reserved1', 0 ],
538
- [ 'uint16v', 'AndXOffset', 0 ],
539
- [ 'uint16v', 'MaxBuff', 0 ],
540
- [ 'uint16v', 'MaxMPX', 0 ],
541
- [ 'uint16v', 'VCNum', 0 ],
542
- [ 'uint32v', 'SessionKey', 0 ],
543
- [ 'uint16v', 'PasswordLenLM', 0 ],
544
- [ 'uint16v', 'PasswordLenNT', 0 ],
545
- [ 'uint32v', 'Reserved2', 0 ],
546
- [ 'uint32v', 'Capabilities', 0 ],
547
- [ 'uint16v', 'ByteCount', 0 ],
548
- [ 'string', 'Payload', nil, '' ]
549
- ).create_restraints(
550
- [ 'Payload', 'ByteCount', nil, true ]
551
- )
552
- SMB_SETUP_NTLMV1_PKT = self.make_nbs(SMB_SETUP_NTLMV1_HDR_PKT)
553
-
554
-
555
- # A SMB template for SMB Session Setup requests (When extended security is being used)
556
- SMB_SETUP_NTLMV2_HDR_PKT = Rex::Struct2::CStructTemplate.new(
557
- [ 'template', 'SMB', SMB_HDR ],
558
- [ 'uint8', 'AndX', 0 ],
559
- [ 'uint8', 'Reserved1', 0 ],
560
- [ 'uint16v', 'AndXOffset', 0 ],
561
- [ 'uint16v', 'MaxBuff', 0 ],
562
- [ 'uint16v', 'MaxMPX', 0 ],
563
- [ 'uint16v', 'VCNum', 0 ],
564
- [ 'uint32v', 'SessionKey', 0 ],
565
- [ 'uint16v', 'SecurityBlobLen', 0 ],
566
- [ 'uint32v', 'Reserved2', 0 ],
567
- [ 'uint32v', 'Capabilities', 0 ],
568
- [ 'uint16v', 'ByteCount', 0 ],
569
- [ 'string', 'Payload', nil, '' ]
570
- ).create_restraints(
571
- [ 'Payload', 'ByteCount', nil, true ]
572
- )
573
- SMB_SETUP_NTLMV2_PKT = self.make_nbs(SMB_SETUP_NTLMV2_HDR_PKT)
574
-
575
-
576
- # A SMB template for SMB Session Setup responses (When extended security is being used)
577
- SMB_SETUP_NTLMV2_RES_HDR_PKT = Rex::Struct2::CStructTemplate.new(
578
- [ 'template', 'SMB', SMB_HDR ],
579
- [ 'uint8', 'AndX', 0 ],
580
- [ 'uint8', 'Reserved1', 0 ],
581
- [ 'uint16v', 'AndXOffset', 0 ],
582
- [ 'uint16v', 'Action', 0 ],
583
- [ 'uint16v', 'SecurityBlobLen', 0 ],
584
- [ 'uint16v', 'ByteCount', 0 ],
585
- [ 'string', 'Payload', nil, '' ]
586
- ).create_restraints(
587
- [ 'Payload', 'ByteCount', nil, true ]
588
- )
589
- SMB_SETUP_NTLMV2_RES_PKT = self.make_nbs(SMB_SETUP_NTLMV2_RES_HDR_PKT)
590
-
591
-
592
- # A SMB template for SMB Tree Connect requests
593
- SMB_TREE_CONN_HDR_PKT = Rex::Struct2::CStructTemplate.new(
594
- [ 'template', 'SMB', SMB_HDR ],
595
- [ 'uint8', 'AndX', 0 ],
596
- [ 'uint8', 'Reserved1', 0 ],
597
- [ 'uint16v', 'AndXOffset', 0 ],
598
- [ 'uint16v', 'Flags', 0 ],
599
- [ 'uint16v', 'PasswordLen', 0 ],
600
- [ 'uint16v', 'ByteCount', 0 ],
601
- [ 'string', 'Payload', nil, '' ]
602
- ).create_restraints(
603
- [ 'Payload', 'ByteCount', nil, true ]
604
- )
605
- SMB_TREE_CONN_PKT = self.make_nbs(SMB_TREE_CONN_HDR_PKT)
606
-
607
-
608
- # A SMB template for SMB Tree Connect requests
609
- SMB_TREE_CONN_RES_HDR_PKT = Rex::Struct2::CStructTemplate.new(
610
- [ 'template', 'SMB', SMB_HDR ],
611
- [ 'uint8', 'AndX', 0 ],
612
- [ 'uint8', 'Reserved1', 0 ],
613
- [ 'uint16v', 'AndXOffset', 0 ],
614
- [ 'uint16v', 'OptionalSupport', 0 ],
615
- [ 'string', 'SupportWords', nil, '' ],
616
- [ 'uint16v', 'ByteCount', 0 ],
617
- [ 'string', 'Payload', nil, '' ]
618
- ).create_restraints(
619
- [ 'Payload', 'ByteCount', nil, true ]
620
- )
621
- SMB_TREE_CONN_RES_PKT = self.make_nbs(SMB_TREE_CONN_RES_HDR_PKT)
622
-
623
-
624
- # A SMB template for SMB Tree Disconnect requests
625
- SMB_TREE_DISCONN_HDR_PKT = Rex::Struct2::CStructTemplate.new(
626
- [ 'template', 'SMB', SMB_HDR ],
627
- [ 'uint16v', 'ByteCount', 0 ],
628
- [ 'string', 'Payload', nil, '' ]
629
- ).create_restraints(
630
- [ 'Payload', 'ByteCount', nil, true ]
631
- )
632
- SMB_TREE_DISCONN_PKT = self.make_nbs(SMB_TREE_DISCONN_HDR_PKT)
633
-
634
-
635
- # A SMB template for SMB Tree Disconnect requests
636
- SMB_TREE_DISCONN_RES_HDR_PKT = Rex::Struct2::CStructTemplate.new(
637
- [ 'template', 'SMB', SMB_HDR ],
638
- [ 'uint16v', 'ByteCount', 0 ],
639
- [ 'string', 'Payload', nil, '' ]
640
- ).create_restraints(
641
- [ 'Payload', 'ByteCount', nil, true ]
642
- )
643
- SMB_TREE_DISCONN_RES_PKT = self.make_nbs(SMB_TREE_DISCONN_RES_HDR_PKT)
644
-
645
-
646
- # A SMB template for SMB Transaction requests
647
- SMB_TRANS_HDR_PKT = Rex::Struct2::CStructTemplate.new(
648
- [ 'template', 'SMB', SMB_HDR ],
649
- [ 'uint16v', 'ParamCountTotal', 0 ],
650
- [ 'uint16v', 'DataCountTotal', 0 ],
651
- [ 'uint16v', 'ParamCountMax', 0 ],
652
- [ 'uint16v', 'DataCountMax', 0 ],
653
- [ 'uint8', 'SetupCountMax', 0 ],
654
- [ 'uint8', 'Reserved1', 0 ],
655
- [ 'uint16v', 'Flags', 0 ],
656
- [ 'uint32v', 'Timeout', 0 ],
657
- [ 'uint16v', 'Reserved2', 0 ],
658
- [ 'uint16v', 'ParamCount', 0 ],
659
- [ 'uint16v', 'ParamOffset', 0 ],
660
- [ 'uint16v', 'DataCount', 0 ],
661
- [ 'uint16v', 'DataOffset', 0 ],
662
- [ 'uint8', 'SetupCount', 0 ],
663
- [ 'uint8', 'Reserved3', 0 ],
664
- [ 'string', 'SetupData', nil, '' ],
665
- [ 'uint16v', 'ByteCount', 0 ],
666
- [ 'string', 'Payload', nil, '' ]
667
- ).create_restraints(
668
- [ 'Payload', 'ByteCount', nil, true ]
669
- )
670
- SMB_TRANS_PKT = self.make_nbs(SMB_TRANS_HDR_PKT)
671
-
672
-
673
- # A SMB template for SMB Transaction responses
674
- SMB_TRANS_RES_HDR_PKT = Rex::Struct2::CStructTemplate.new(
675
- [ 'template', 'SMB', SMB_HDR ],
676
- [ 'uint16v', 'ParamCountTotal', 0 ],
677
- [ 'uint16v', 'DataCountTotal', 0 ],
678
- [ 'uint16v', 'Reserved1', 0 ],
679
- [ 'uint16v', 'ParamCount', 0 ],
680
- [ 'uint16v', 'ParamOffset', 0 ],
681
- [ 'uint16v', 'ParamDisplace', 0 ],
682
- [ 'uint16v', 'DataCount', 0 ],
683
- [ 'uint16v', 'DataOffset', 0 ],
684
- [ 'uint16v', 'DataDisplace', 0 ],
685
- [ 'uint8', 'SetupCount', 0 ],
686
- [ 'uint8', 'Reserved2', 0 ],
687
- [ 'string', 'SetupData', nil, '' ],
688
- [ 'uint16v', 'ByteCount', 0 ],
689
- [ 'string', 'Payload', nil, '' ]
690
- ).create_restraints(
691
- [ 'Payload', 'ByteCount', nil, true ]
692
- )
693
- SMB_TRANS_RES_PKT = self.make_nbs(SMB_TRANS_RES_HDR_PKT)
694
-
695
- # A SMB template for SMB Transaction2 requests
696
- SMB_TRANS2_HDR_PKT = Rex::Struct2::CStructTemplate.new(
697
- [ 'template', 'SMB', SMB_HDR ],
698
- [ 'uint16v', 'ParamCountTotal', 0 ],
699
- [ 'uint16v', 'DataCountTotal', 0 ],
700
- [ 'uint16v', 'ParamCountMax', 0 ],
701
- [ 'uint16v', 'DataCountMax', 0 ],
702
- [ 'uint8', 'SetupCountMax', 0 ],
703
- [ 'uint8', 'Reserved1', 0 ],
704
- [ 'uint16v', 'Flags', 0 ],
705
- [ 'uint32v', 'Timeout', 0 ],
706
- [ 'uint16v', 'Reserved2', 0 ],
707
- [ 'uint16v', 'ParamCount', 0 ],
708
- [ 'uint16v', 'ParamOffset', 0 ],
709
- [ 'uint16v', 'DataCount', 0 ],
710
- [ 'uint16v', 'DataOffset', 0 ],
711
- [ 'uint8', 'SetupCount', 0 ],
712
- [ 'uint8', 'Reserved3', 0 ],
713
- [ 'string', 'SetupData', nil, '' ],
714
- [ 'uint16v', 'ByteCount', 0 ],
715
- [ 'string', 'Payload', nil, '' ]
716
- ).create_restraints(
717
- [ 'Payload', 'ByteCount', nil, true ]
718
- )
719
- SMB_TRANS2_PKT = self.make_nbs(SMB_TRANS2_HDR_PKT)
720
-
721
-
722
- # A SMB template for SMB NTTransaction requests
723
- SMB_NTTRANS_HDR_PKT = Rex::Struct2::CStructTemplate.new(
724
- [ 'template', 'SMB', SMB_HDR ],
725
- [ 'uint8', 'SetupCountMax', 0 ],
726
- [ 'uint16v', 'Reserved1', 0 ],
727
- [ 'uint32v', 'ParamCountTotal', 0 ],
728
- [ 'uint32v', 'DataCountTotal', 0 ],
729
- [ 'uint32v', 'ParamCountMax', 0 ],
730
- [ 'uint32v', 'DataCountMax', 0 ],
731
- [ 'uint32v', 'ParamCount', 0 ],
732
- [ 'uint32v', 'ParamOffset', 0 ],
733
- [ 'uint32v', 'DataCount', 0 ],
734
- [ 'uint32v', 'DataOffset', 0 ],
735
- [ 'uint8', 'SetupCount', 0 ],
736
- [ 'string', 'SetupData', nil, '' ],
737
- [ 'uint16v', 'Subcommand', 0 ],
738
- [ 'uint16v', 'ByteCount', 0 ],
739
- [ 'string', 'Payload', nil, '' ]
740
- ).create_restraints(
741
- [ 'Payload', 'ByteCount', nil, true ]
742
- )
743
- SMB_NTTRANS_PKT = self.make_nbs(SMB_NTTRANS_HDR_PKT)
744
-
745
-
746
- # A SMB template for SMB NTTransaction responses
747
- SMB_NTTRANS_RES_HDR_PKT = Rex::Struct2::CStructTemplate.new(
748
- [ 'template', 'SMB', SMB_HDR ],
749
- [ 'uint8', 'Reserved1', 0 ],
750
- [ 'uint16v', 'Reserved2', 0 ],
751
- [ 'uint32v', 'ParamCountTotal', 0 ],
752
- [ 'uint32v', 'DataCountTotal', 0 ],
753
- [ 'uint32v', 'ParamCount', 0 ],
754
- [ 'uint32v', 'ParamOffset', 0 ],
755
- [ 'uint32v', 'ParamDisplace', 0 ],
756
- [ 'uint32v', 'DataCount', 0 ],
757
- [ 'uint32v', 'DataOffset', 0 ],
758
- [ 'uint32v', 'DataDisplace', 0 ],
759
- [ 'uint8', 'Reserved3', 0 ],
760
- [ 'uint16v', 'ByteCount', 0 ],
761
- [ 'string', 'Payload', nil, '' ]
762
- ).create_restraints(
763
- [ 'Payload', 'ByteCount', nil, true ]
764
- )
765
- SMB_NTTRANS_RES_PKT = self.make_nbs(SMB_NTTRANS_RES_HDR_PKT)
766
-
767
- # A SMB template for SMB NTTransaction_Secondary requests
768
- SMB_NTTRANS_SECONDARY_HDR_PKT = Rex::Struct2::CStructTemplate.new(
769
- [ 'template', 'SMB', SMB_HDR ],
770
- [ 'uint8', 'Reserved1', 0 ],
771
- [ 'uint16v', 'Reserved2', 0 ],
772
- [ 'uint32v', 'ParamCountTotal', 0 ],
773
- [ 'uint32v', 'DataCountTotal', 0 ],
774
- [ 'uint32v', 'ParamCount', 0 ],
775
- [ 'uint32v', 'ParamOffset', 0 ],
776
- [ 'uint32v', 'ParamDisplace', 0 ],
777
- [ 'uint32v', 'DataCount', 0 ],
778
- [ 'uint32v', 'DataOffset', 0 ],
779
- [ 'uint32v', 'DataDisplace', 0 ],
780
- [ 'uint8', 'SetupCount', 0 ],
781
- [ 'string', 'SetupData', nil, '' ],
782
- [ 'uint16v', 'ByteCount', 0 ],
783
- [ 'string', 'Payload', nil, '' ]
784
- ).create_restraints(
785
- [ 'Payload', 'ByteCount', nil, true ]
786
- )
787
- SMB_NTTRANS_SECONDARY_PKT = self.make_nbs(SMB_NTTRANS_SECONDARY_HDR_PKT)
788
-
789
- # A SMB template for SMB Create requests
790
- SMB_CREATE_HDR_PKT = Rex::Struct2::CStructTemplate.new(
791
- [ 'template', 'SMB', SMB_HDR ],
792
- [ 'uint8', 'AndX', 0 ],
793
- [ 'uint8', 'Reserved1', 0 ],
794
- [ 'uint16v', 'AndXOffset', 0 ],
795
- [ 'uint8', 'Reserved2', 0 ],
796
- [ 'uint16v', 'FileNameLen', 0 ],
797
- [ 'uint32v', 'CreateFlags', 0 ],
798
- [ 'uint32v', 'RootFileID', 0 ],
799
- [ 'uint32v', 'AccessMask', 0 ],
800
- [ 'uint32v', 'AllocLow', 0 ],
801
- [ 'uint32v', 'AllocHigh', 0 ],
802
- [ 'uint32v', 'Attributes', 0 ],
803
- [ 'uint32v', 'ShareAccess', 0 ],
804
- [ 'uint32v', 'Disposition', 0 ],
805
- [ 'uint32v', 'CreateOptions', 0 ],
806
- [ 'uint32v', 'Impersonation', 0 ],
807
- [ 'uint8', 'SecurityFlags', 0 ],
808
- [ 'uint16v', 'ByteCount', 0 ],
809
- [ 'string', 'Payload', nil, '' ]
810
- ).create_restraints(
811
- [ 'Payload', 'ByteCount', nil, true ]
812
- )
813
- SMB_CREATE_PKT = self.make_nbs(SMB_CREATE_HDR_PKT)
814
-
815
-
816
- # A SMB template for SMB Create responses
817
- SMB_CREATE_RES_HDR_PKT = Rex::Struct2::CStructTemplate.new(
818
- [ 'template', 'SMB', SMB_HDR ],
819
- [ 'uint8', 'AndX', 0 ],
820
- [ 'uint8', 'Reserved1', 0 ],
821
- [ 'uint16v', 'AndXOffset', 0 ],
822
- [ 'uint8', 'OpLock', 0 ],
823
- [ 'uint16v', 'FileID', 0 ],
824
- [ 'uint32v', 'Action', 0 ],
825
- [ 'uint32v', 'CreateTimeLow', 0 ],
826
- [ 'uint32v', 'CreateTimeHigh', 0 ],
827
- [ 'uint32v', 'AccessTimeLow', 0 ],
828
- [ 'uint32v', 'AccessTimeHigh', 0 ],
829
- [ 'uint32v', 'WriteTimeLow', 0 ],
830
- [ 'uint32v', 'WriteTimeHigh', 0 ],
831
- [ 'uint32v', 'ChangeTimeLow', 0 ],
832
- [ 'uint32v', 'ChangeTimeHigh', 0 ],
833
- [ 'uint32v', 'Attributes', 0 ],
834
- [ 'uint32v', 'AllocLow', 0 ],
835
- [ 'uint32v', 'AllocHigh', 0 ],
836
- [ 'uint32v', 'EOFLow', 0 ],
837
- [ 'uint32v', 'EOFHigh', 0 ],
838
- [ 'uint16v', 'FileType', 0 ],
839
- [ 'uint16v', 'IPCState', 0 ],
840
- [ 'uint8', 'IsDirectory', 0 ],
841
- [ 'uint16v', 'ByteCount', 0 ],
842
- [ 'string', 'Payload', nil, '' ]
843
- ).create_restraints(
844
- [ 'Payload', 'ByteCount', nil, true ]
845
- )
846
- SMB_CREATE_RES_PKT = self.make_nbs(SMB_CREATE_RES_HDR_PKT)
847
-
848
-
849
- # A SMB template for SMB Write requests
850
- SMB_WRITE_HDR_PKT = Rex::Struct2::CStructTemplate.new(
851
- [ 'template', 'SMB', SMB_HDR ],
852
- [ 'uint8', 'AndX', 0 ],
853
- [ 'uint8', 'Reserved1', 0 ],
854
- [ 'uint16v', 'AndXOffset', 0 ],
855
- [ 'uint16v', 'FileID', 0 ],
856
- [ 'uint32v', 'Offset', 0 ],
857
- [ 'uint32v', 'Reserved2', 0 ],
858
- [ 'uint16v', 'WriteMode', 0 ],
859
- [ 'uint16v', 'Remaining', 0 ],
860
- [ 'uint16v', 'DataLenHigh', 0 ],
861
- [ 'uint16v', 'DataLenLow', 0 ],
862
- [ 'uint16v', 'DataOffset', 0 ],
863
- [ 'uint32v', 'DataOffsetHigh', 0 ],
864
- [ 'uint16v', 'ByteCount', 0 ],
865
- [ 'string', 'Payload', nil, '' ]
866
- ).create_restraints(
867
- [ 'Payload', 'ByteCount', nil, true ]
868
- )
869
- SMB_WRITE_PKT = self.make_nbs(SMB_WRITE_HDR_PKT)
870
-
871
-
872
- # A SMB template for SMB Write responses
873
- SMB_WRITE_RES_HDR_PKT = Rex::Struct2::CStructTemplate.new(
874
- [ 'template', 'SMB', SMB_HDR ],
875
- [ 'uint8', 'AndX', 0 ],
876
- [ 'uint8', 'Reserved1', 0 ],
877
- [ 'uint16v', 'AndXOffset', 0 ],
878
- [ 'uint16v', 'CountLow', 0 ],
879
- [ 'uint16v', 'Remaining', 0 ],
880
- [ 'uint16v', 'CountHigh', 0 ],
881
- [ 'uint16v', 'Reserved2', 0 ],
882
- [ 'uint16v', 'ByteCount', 0 ],
883
- [ 'string', 'Payload', nil, '' ]
884
- ).create_restraints(
885
- [ 'Payload', 'ByteCount', nil, true ]
886
- )
887
- SMB_WRITE_RES_PKT = self.make_nbs(SMB_WRITE_RES_HDR_PKT)
888
-
889
-
890
- # A SMB template for SMB OPEN requests
891
- SMB_OPEN_HDR_PKT = Rex::Struct2::CStructTemplate.new(
892
- [ 'template', 'SMB', SMB_HDR ],
893
- [ 'uint8', 'AndX', 0 ],
894
- [ 'uint8', 'Reserved1', 0 ],
895
- [ 'uint16v', 'AndXOffset', 0 ],
896
- [ 'uint16v', 'Flags', 0 ],
897
- [ 'uint16v', 'Access', 0 ],
898
- [ 'uint16v', 'SearchAttributes', 0 ],
899
- [ 'uint16v', 'FileAttributes', 0 ],
900
- [ 'uint32v', 'CreateTime', 0 ],
901
- [ 'uint16v', 'OpenFunction', 0 ],
902
- [ 'uint32v', 'AllocSize', 0 ],
903
- [ 'uint32v', 'Reserved2', 0 ],
904
- [ 'uint32v', 'Reserved3', 0 ],
905
- [ 'uint16v', 'ByteCount', 0 ],
906
- [ 'string', 'Payload', nil, '' ]
907
- ).create_restraints(
908
- [ 'Payload', 'ByteCount', nil, true ]
909
- )
910
- SMB_OPEN_PKT = self.make_nbs(SMB_OPEN_HDR_PKT)
911
-
912
-
913
- # A SMB template for SMB OPEN responses
914
- SMB_OPEN_RES_HDR_PKT = Rex::Struct2::CStructTemplate.new(
915
- [ 'template', 'SMB', SMB_HDR ],
916
- [ 'uint8', 'AndX', 0 ],
917
- [ 'uint8', 'Reserved1', 0 ],
918
- [ 'uint16v', 'AndXOffset', 0 ],
919
- [ 'uint16v', 'FileID', 0 ],
920
- [ 'uint16v', 'FileAttributes', 0 ],
921
- [ 'uint32v', 'WriteTime', 0 ],
922
- [ 'uint32v', 'FileSize', 0 ],
923
- [ 'uint16v', 'FileAccess', 0 ],
924
- [ 'uint16v', 'FileType', 0 ],
925
- [ 'uint16v', 'IPCState', 0 ],
926
- [ 'uint16v', 'Action', 0 ],
927
- [ 'uint32v', 'ServerFileID', 0 ],
928
- [ 'uint16v', 'Reserved2', 0 ],
929
- [ 'uint16v', 'ByteCount', 0 ],
930
- [ 'string', 'Payload', nil, '' ]
931
- ).create_restraints(
932
- [ 'Payload', 'ByteCount', nil, true ]
933
- )
934
- SMB_OPEN_RES_PKT = self.make_nbs(SMB_OPEN_RES_HDR_PKT)
935
-
936
-
937
- # A SMB template for SMB Close requests
938
- SMB_CLOSE_HDR_PKT = Rex::Struct2::CStructTemplate.new(
939
- [ 'template', 'SMB', SMB_HDR ],
940
- [ 'uint16v', 'FileID', 0 ],
941
- [ 'uint32v', 'LastWrite', 0 ],
942
- [ 'uint16v', 'ByteCount', 0 ],
943
- [ 'string', 'Payload', nil, '' ]
944
- ).create_restraints(
945
- [ 'Payload', 'ByteCount', nil, true ]
946
- )
947
- SMB_CLOSE_PKT = self.make_nbs(SMB_CLOSE_HDR_PKT)
948
-
949
-
950
- # A SMB template for SMB Close responses
951
- SMB_CLOSE_RES_HDR_PKT = Rex::Struct2::CStructTemplate.new(
952
- [ 'template', 'SMB', SMB_HDR ],
953
- [ 'uint16v', 'ByteCount', 0 ],
954
- [ 'string', 'Payload', nil, '' ]
955
- ).create_restraints(
956
- [ 'Payload', 'ByteCount', nil, true ]
957
- )
958
- SMB_CLOSE_RES_PKT = self.make_nbs(SMB_CLOSE_RES_HDR_PKT)
959
-
960
-
961
- # A SMB template for SMB Delete requests
962
- SMB_DELETE_HDR_PKT = Rex::Struct2::CStructTemplate.new(
963
- [ 'template', 'SMB', SMB_HDR ],
964
- [ 'uint16v', 'SearchAttribute', 0 ],
965
- [ 'uint16v', 'ByteCount', 0 ],
966
- [ 'uint8', 'BufferFormat', 0 ],
967
- [ 'string', 'Payload', nil, '' ]
968
- ).create_restraints(
969
- [ 'Payload', 'ByteCount', nil, true ]
970
- )
971
- SMB_DELETE_PKT = self.make_nbs(SMB_DELETE_HDR_PKT)
972
-
973
-
974
- # A SMB template for SMB Delete responses
975
- SMB_DELETE_RES_HDR_PKT = Rex::Struct2::CStructTemplate.new(
976
- [ 'template', 'SMB', SMB_HDR ],
977
- [ 'uint16v', 'ByteCount', 0 ],
978
- [ 'string', 'Payload', nil, '' ]
979
- ).create_restraints(
980
- [ 'Payload', 'ByteCount', nil, true ]
981
- )
982
- SMB_DELETE_RES_PKT = self.make_nbs(SMB_DELETE_RES_HDR_PKT)
983
-
984
-
985
-
986
- # A SMB template for SMB Read requests
987
- SMB_READ_HDR_PKT = Rex::Struct2::CStructTemplate.new(
988
- [ 'template', 'SMB', SMB_HDR ],
989
- [ 'uint8', 'AndX', 0 ],
990
- [ 'uint8', 'Reserved1', 0 ],
991
- [ 'uint16v', 'AndXOffset', 0 ],
992
- [ 'uint16v', 'FileID', 0 ],
993
- [ 'uint32v', 'Offset', 0 ],
994
- [ 'uint16v', 'MaxCountLow', 0 ],
995
- [ 'uint16v', 'MinCount', 0 ],
996
- [ 'uint32v', 'Reserved2', 0 ],
997
- [ 'uint16v', 'Remaining', 0 ],
998
- [ 'uint32v', 'MaxCountHigh', 0 ],
999
- [ 'uint16v', 'ByteCount', 0 ],
1000
- [ 'string', 'Payload', nil, '' ]
1001
- ).create_restraints(
1002
- [ 'Payload', 'ByteCount', nil, true ]
1003
- )
1004
- SMB_READ_PKT = self.make_nbs(SMB_READ_HDR_PKT)
1005
-
1006
-
1007
- # A SMB template for SMB Read responses
1008
- SMB_READ_RES_HDR_PKT = Rex::Struct2::CStructTemplate.new(
1009
- [ 'template', 'SMB', SMB_HDR ],
1010
- [ 'uint8', 'AndX', 0 ],
1011
- [ 'uint8', 'Reserved1', 0 ],
1012
- [ 'uint16v', 'AndXOffset', 0 ],
1013
- [ 'uint16v', 'Remaining', 0 ],
1014
- [ 'uint16v', 'DataCompaction', 0 ],
1015
- [ 'uint16v', 'Reserved2', 0 ],
1016
- [ 'uint16v', 'DataLenLow', 0 ],
1017
- [ 'uint16v', 'DataOffset', 0 ],
1018
- [ 'uint32v', 'DataLenHigh', 0 ],
1019
- [ 'uint32v', 'Reserved3', 0 ],
1020
- [ 'uint16v', 'Reserved4', 0 ],
1021
- [ 'uint16v', 'ByteCount', 0 ],
1022
- [ 'string', 'Payload', nil, '' ]
1023
- ).create_restraints(
1024
- [ 'Payload', 'ByteCount', nil, true ]
1025
- )
1026
- SMB_READ_RES_PKT = self.make_nbs(SMB_READ_RES_HDR_PKT)
1027
-
1028
-
1029
-
1030
- # A SMB template for SMB Search requests
1031
- SMB_SEARCH_HDR_PKT = Rex::Struct2::CStructTemplate.new(
1032
- [ 'template', 'SMB', SMB_HDR ],
1033
- [ 'uint16v', 'MaxCount', 0 ],
1034
- [ 'uint16v', 'Attributes', 0 ],
1035
- [ 'uint16v', 'ByteCount', 0 ],
1036
- [ 'string', 'Payload', nil, '' ]
1037
- ).create_restraints(
1038
- [ 'Payload', 'ByteCount', nil, true ]
1039
- )
1040
- SMB_SEARCH_PKT = self.make_nbs(SMB_SEARCH_HDR_PKT)
1041
-
1042
-
1043
- end
1044
- end
1045
- end
1046
- end
1047
-