librex 0.0.1

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