librex 0.0.65 → 0.0.66
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.
- data/README.markdown +1 -1
- data/lib/rex/arch.rb +1 -0
- data/lib/rex/arch/sparc.rb +16 -15
- data/lib/rex/arch/sparc.rb.ut.rb +2 -1
- data/lib/rex/arch/x86.rb +1 -0
- data/lib/rex/arch/x86.rb.ut.rb +2 -1
- data/lib/rex/assembly/nasm.rb +1 -0
- data/lib/rex/assembly/nasm.rb.ut.rb +2 -1
- data/lib/rex/compat.rb +13 -0
- data/lib/rex/constants.rb +5 -4
- data/lib/rex/elfparsey.rb +3 -2
- data/lib/rex/elfparsey/elf.rb +2 -1
- data/lib/rex/elfparsey/elfbase.rb +8 -7
- data/lib/rex/elfparsey/exceptions.rb +3 -2
- data/lib/rex/elfscan.rb +3 -2
- data/lib/rex/elfscan/scanner.rb +2 -1
- data/lib/rex/elfscan/search.rb +2 -1
- data/lib/rex/encoder/alpha2.rb +2 -1
- data/lib/rex/encoder/alpha2/alpha_mixed.rb +3 -2
- data/lib/rex/encoder/alpha2/alpha_upper.rb +5 -4
- data/lib/rex/encoder/alpha2/generic.rb +37 -60
- data/lib/rex/encoder/alpha2/unicode_mixed.rb +4 -9
- data/lib/rex/encoder/alpha2/unicode_upper.rb +4 -9
- data/lib/rex/encoder/ndr.rb +1 -0
- data/lib/rex/encoder/ndr.rb.ut.rb +2 -1
- data/lib/rex/encoder/nonalpha.rb +1 -0
- data/lib/rex/encoder/nonupper.rb +1 -0
- data/lib/rex/encoder/xdr.rb +9 -8
- data/lib/rex/encoder/xdr.rb.ut.rb +2 -1
- data/lib/rex/encoder/xor.rb +1 -0
- data/lib/rex/encoder/xor/dword.rb +2 -1
- data/lib/rex/encoder/xor/dword_additive.rb +2 -1
- data/lib/rex/encoders/xor_dword.rb +1 -0
- data/lib/rex/encoders/xor_dword_additive.rb +2 -1
- data/lib/rex/encoders/xor_dword_additive.rb.ut.rb +2 -1
- data/lib/rex/encoding/xor.rb +2 -1
- data/lib/rex/encoding/xor.rb.ts.rb +2 -1
- data/lib/rex/encoding/xor/byte.rb +2 -1
- data/lib/rex/encoding/xor/byte.rb.ut.rb +2 -1
- data/lib/rex/encoding/xor/dword.rb +2 -1
- data/lib/rex/encoding/xor/dword.rb.ut.rb +2 -1
- data/lib/rex/encoding/xor/dword_additive.rb +1 -0
- data/lib/rex/encoding/xor/dword_additive.rb.ut.rb +2 -1
- data/lib/rex/encoding/xor/exceptions.rb +1 -0
- data/lib/rex/encoding/xor/generic.rb +1 -0
- data/lib/rex/encoding/xor/generic.rb.ut.rb +2 -1
- data/lib/rex/encoding/xor/qword.rb +2 -1
- data/lib/rex/encoding/xor/word.rb +2 -1
- data/lib/rex/encoding/xor/word.rb.ut.rb +2 -1
- data/lib/rex/exceptions.rb +1 -0
- data/lib/rex/exceptions.rb.ut.rb +2 -1
- data/lib/rex/exploitation/cmdstager.rb +2 -1
- data/lib/rex/exploitation/cmdstager/base.rb +1 -0
- data/lib/rex/exploitation/cmdstager/debug_asm.rb +2 -1
- data/lib/rex/exploitation/cmdstager/debug_write.rb +2 -1
- data/lib/rex/exploitation/cmdstager/tftp.rb +2 -1
- data/lib/rex/exploitation/cmdstager/vbs.rb +2 -1
- data/lib/rex/exploitation/egghunter.rb +12 -11
- data/lib/rex/exploitation/egghunter.rb.ut.rb +2 -1
- data/lib/rex/exploitation/encryptjs.rb +1 -0
- data/lib/rex/exploitation/heaplib.rb +1 -0
- data/lib/rex/exploitation/javascriptosdetect.js +1014 -0
- data/lib/rex/exploitation/javascriptosdetect.rb +4 -857
- data/lib/rex/exploitation/jsobfu.rb +2 -1
- data/lib/rex/exploitation/obfuscatejs.rb +1 -0
- data/lib/rex/exploitation/omelet.rb +1 -0
- data/lib/rex/exploitation/omelet.rb.ut.rb +1 -0
- data/lib/rex/exploitation/opcodedb.rb +12 -11
- data/lib/rex/exploitation/opcodedb.rb.ut.rb +2 -1
- data/lib/rex/exploitation/seh.rb +3 -2
- data/lib/rex/exploitation/seh.rb.ut.rb +2 -1
- data/lib/rex/file.rb +4 -3
- data/lib/rex/file.rb.ut.rb +2 -1
- data/lib/rex/image_source.rb +3 -2
- data/lib/rex/image_source/disk.rb +3 -2
- data/lib/rex/image_source/image_source.rb +3 -2
- data/lib/rex/image_source/memory.rb +3 -2
- data/lib/rex/io/bidirectional_pipe.rb +1 -0
- data/lib/rex/io/datagram_abstraction.rb +2 -1
- data/lib/rex/io/ring_buffer.rb +49 -44
- data/lib/rex/io/ring_buffer.rb.ut.rb +4 -3
- data/lib/rex/io/stream.rb +1 -0
- data/lib/rex/io/stream_abstraction.rb +1 -0
- data/lib/rex/io/stream_server.rb +1 -0
- data/lib/rex/job_container.rb +1 -0
- data/lib/rex/logging.rb +2 -1
- data/lib/rex/logging/log_dispatcher.rb +5 -4
- data/lib/rex/logging/log_sink.rb +2 -1
- data/lib/rex/logging/sinks/flatfile.rb +4 -3
- data/lib/rex/logging/sinks/stderr.rb +2 -1
- data/lib/rex/machparsey.rb +2 -1
- data/lib/rex/machparsey/exceptions.rb +2 -1
- data/lib/rex/machparsey/mach.rb +20 -19
- data/lib/rex/machparsey/machbase.rb +27 -26
- data/lib/rex/machscan.rb +2 -1
- data/lib/rex/machscan/scanner.rb +1 -0
- data/lib/rex/mime.rb +2 -1
- data/lib/rex/mime/header.rb +1 -0
- data/lib/rex/mime/message.rb +4 -1
- data/lib/rex/mime/part.rb +2 -1
- data/lib/rex/nop/opty2.rb +2 -1
- data/lib/rex/nop/opty2.rb.ut.rb +2 -1
- data/lib/rex/nop/opty2_tables.rb +1 -0
- data/lib/rex/ole.rb +3 -2
- data/lib/rex/ole/clsid.rb +3 -2
- data/lib/rex/ole/difat.rb +3 -2
- data/lib/rex/ole/directory.rb +3 -2
- data/lib/rex/ole/direntry.rb +3 -2
- data/lib/rex/ole/fat.rb +3 -2
- data/lib/rex/ole/header.rb +3 -2
- data/lib/rex/ole/minifat.rb +3 -2
- data/lib/rex/ole/propset.rb +4 -3
- data/lib/rex/ole/samples/create_ole.rb +1 -0
- data/lib/rex/ole/samples/dir.rb +1 -0
- data/lib/rex/ole/samples/dump_stream.rb +1 -0
- data/lib/rex/ole/samples/ole_info.rb +1 -0
- data/lib/rex/ole/storage.rb +3 -2
- data/lib/rex/ole/stream.rb +3 -2
- data/lib/rex/ole/substorage.rb +3 -2
- data/lib/rex/ole/util.rb +3 -2
- data/lib/rex/parser/acunetix_nokogiri.rb +13 -12
- data/lib/rex/parser/apple_backup_manifestdb.rb +20 -19
- data/lib/rex/parser/appscan_nokogiri.rb +17 -16
- data/lib/rex/parser/arguments.rb +2 -1
- data/lib/rex/parser/arguments.rb.ut.rb +2 -1
- data/lib/rex/parser/burp_session_nokogiri.rb +8 -7
- data/lib/rex/parser/ci_nokogiri.rb +4 -3
- data/lib/rex/parser/foundstone_nokogiri.rb +18 -17
- data/lib/rex/parser/fusionvm_nokogiri.rb +109 -0
- data/lib/rex/parser/ini.rb +1 -0
- data/lib/rex/parser/ini.rb.ut.rb +2 -1
- data/lib/rex/parser/ip360_aspl_xml.rb +1 -0
- data/lib/rex/parser/ip360_xml.rb +4 -3
- data/lib/rex/parser/mbsa_nokogiri.rb +8 -7
- data/lib/rex/parser/nessus_xml.rb +3 -2
- data/lib/rex/parser/netsparker_xml.rb +10 -9
- data/lib/rex/parser/nexpose_raw_nokogiri.rb +372 -52
- data/lib/rex/parser/nexpose_simple_nokogiri.rb +8 -7
- data/lib/rex/parser/nexpose_xml.rb +1 -0
- data/lib/rex/parser/nmap_nokogiri.rb +63 -33
- data/lib/rex/parser/nmap_xml.rb +1 -0
- data/lib/rex/parser/nokogiri_doc_mixin.rb +35 -15
- data/lib/rex/parser/openvas_nokogiri.rb +172 -0
- data/lib/rex/parser/retina_xml.rb +1 -0
- data/lib/rex/parser/wapiti_nokogiri.rb +105 -0
- data/lib/rex/payloads.rb +2 -1
- data/lib/rex/payloads/win32.rb +2 -1
- data/lib/rex/payloads/win32/common.rb +2 -1
- data/lib/rex/payloads/win32/kernel.rb +2 -1
- data/lib/rex/payloads/win32/kernel/common.rb +4 -3
- data/lib/rex/payloads/win32/kernel/migration.rb +2 -1
- data/lib/rex/payloads/win32/kernel/recovery.rb +2 -1
- data/lib/rex/payloads/win32/kernel/stager.rb +21 -20
- data/lib/rex/peparsey.rb +3 -2
- data/lib/rex/peparsey/exceptions.rb +2 -1
- data/lib/rex/peparsey/pe.rb +3 -2
- data/lib/rex/peparsey/pe_memdump.rb +2 -1
- data/lib/rex/peparsey/pebase.rb +2 -1
- data/lib/rex/peparsey/section.rb +2 -1
- data/lib/rex/pescan.rb +3 -2
- data/lib/rex/pescan/analyze.rb +1 -0
- data/lib/rex/pescan/scanner.rb +1 -0
- data/lib/rex/pescan/search.rb +1 -0
- data/lib/rex/platforms.rb +2 -1
- data/lib/rex/platforms/windows.rb +2 -1
- data/lib/rex/poly.rb +2 -1
- data/lib/rex/poly/block.rb +16 -15
- data/lib/rex/poly/register.rb +2 -1
- data/lib/rex/poly/register/x86.rb +2 -1
- data/lib/rex/post.rb +2 -2
- data/lib/rex/post/dir.rb +2 -1
- data/lib/rex/post/file.rb +1 -0
- data/lib/rex/post/file_stat.rb +1 -0
- data/lib/rex/post/io.rb +2 -1
- data/lib/rex/post/meterpreter.rb +2 -1
- data/lib/rex/post/meterpreter/channel.rb +1 -0
- data/lib/rex/post/meterpreter/channel_container.rb +2 -1
- data/lib/rex/post/meterpreter/channels/pool.rb +1 -0
- data/lib/rex/post/meterpreter/channels/pools/file.rb +1 -0
- data/lib/rex/post/meterpreter/channels/pools/stream_pool.rb +3 -2
- data/lib/rex/post/meterpreter/channels/stream.rb +1 -0
- data/lib/rex/post/meterpreter/client.rb +23 -1
- data/lib/rex/post/meterpreter/client_core.rb +10 -5
- data/lib/rex/post/meterpreter/dependencies.rb +2 -1
- data/lib/rex/post/meterpreter/extension.rb +2 -1
- data/lib/rex/post/meterpreter/extensions/espia/espia.rb +7 -6
- data/lib/rex/post/meterpreter/extensions/espia/tlv.rb +2 -1
- data/lib/rex/post/meterpreter/extensions/incognito/incognito.rb +5 -4
- data/lib/rex/post/meterpreter/extensions/incognito/tlv.rb +2 -1
- data/lib/rex/post/meterpreter/extensions/lanattacks/lanattacks.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/lanattacks/tlv.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/networkpug/networkpug.rb +7 -6
- data/lib/rex/post/meterpreter/extensions/networkpug/tlv.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/priv/fs.rb +2 -1
- data/lib/rex/post/meterpreter/extensions/priv/passwd.rb +2 -1
- data/lib/rex/post/meterpreter/extensions/priv/priv.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/priv/tlv.rb +2 -1
- data/lib/rex/post/meterpreter/extensions/sniffer/sniffer.rb +28 -11
- data/lib/rex/post/meterpreter/extensions/sniffer/tlv.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/constants.rb +6 -5
- data/lib/rex/post/meterpreter/extensions/stdapi/fs/dir.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb +3 -2
- data/lib/rex/post/meterpreter/extensions/stdapi/fs/file_stat.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/fs/io.rb +2 -1
- data/lib/rex/post/meterpreter/extensions/stdapi/net/config.rb +39 -5
- data/lib/rex/post/meterpreter/extensions/stdapi/net/interface.rb +75 -18
- data/lib/rex/post/meterpreter/extensions/stdapi/net/route.rb +18 -6
- data/lib/rex/post/meterpreter/extensions/stdapi/net/socket.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_client_channel.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_server_channel.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/udp_channel.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun.rb.ts.rb +4 -1
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/api_constants.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/api_constants.rb.ut.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/buffer_item.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/buffer_item.rb.ut.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_advapi32.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_crypt32.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_iphlpapi.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_kernel32.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_netapi32.rb +12 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_ntdll.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_shell32.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_user32.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_wlanapi.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_ws2_32.rb +7 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll.rb.ut.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_function.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_function.rb.ut.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_helper.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_helper.rb.ut.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_wrapper.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_wrapper.rb.ut.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/mock_magic.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/multicall.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/platform_util.rb +23 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/platform_util.rb.ut.rb +29 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/railgun.rb +10 -5
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/railgun.rb.ut.rb +9 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/tlv.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/type/pointer_util.rb +106 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/type/pointer_util.rb.ut.rb +128 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/util.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/win_const_manager.rb +27 -6
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/win_const_manager.rb.ut.rb +21 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/stdapi.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/config.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/event_log.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/event_log_subsystem/event_record.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/power.rb +2 -1
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/process.rb +43 -4
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/process_subsystem/image.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/process_subsystem/io.rb +2 -1
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/process_subsystem/memory.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/process_subsystem/thread.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/registry.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_key.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_value.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/remote_registry_key.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/thread.rb +1 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/tlv.rb +7 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/ui.rb +14 -13
- data/lib/rex/post/meterpreter/extensions/stdapi/webcam/webcam.rb +1 -0
- data/lib/rex/post/meterpreter/inbound_packet_handler.rb +2 -1
- data/lib/rex/post/meterpreter/object_aliases.rb +6 -5
- data/lib/rex/post/meterpreter/packet.rb +26 -6
- data/lib/rex/post/meterpreter/packet_dispatcher.rb +1 -0
- data/lib/rex/post/meterpreter/packet_parser.rb +1 -0
- data/lib/rex/post/meterpreter/packet_response_waiter.rb +1 -0
- data/lib/rex/post/meterpreter/ui/console.rb +1 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher.rb +1 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb +103 -28
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/espia.rb +1 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/incognito.rb +1 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/networkpug.rb +1 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/priv.rb +3 -2
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/priv/elevate.rb +12 -11
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/priv/passwd.rb +2 -1
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/priv/timestomp.rb +2 -1
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/sniffer.rb +53 -36
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi.rb +3 -2
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/fs.rb +87 -44
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb +80 -18
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/sys.rb +77 -48
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/ui.rb +72 -41
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/webcam.rb +24 -5
- data/lib/rex/post/meterpreter/ui/console/interactive_channel.rb +2 -1
- data/lib/rex/post/permission.rb +2 -1
- data/lib/rex/post/process.rb +2 -1
- data/lib/rex/post/thread.rb +2 -1
- data/lib/rex/post/ui.rb +2 -1
- data/lib/rex/proto.rb +1 -0
- data/lib/rex/proto.rb.ts.rb +2 -1
- data/lib/rex/proto/dcerpc.rb +2 -1
- data/lib/rex/proto/dcerpc.rb.ts.rb +2 -1
- data/lib/rex/proto/dcerpc/client.rb +1 -0
- data/lib/rex/proto/dcerpc/client.rb.ut.rb +1 -0
- data/lib/rex/proto/dcerpc/exceptions.rb +2 -1
- data/lib/rex/proto/dcerpc/handle.rb +1 -0
- data/lib/rex/proto/dcerpc/handle.rb.ut.rb +2 -1
- data/lib/rex/proto/dcerpc/ndr.rb +2 -1
- data/lib/rex/proto/dcerpc/ndr.rb.ut.rb +2 -1
- data/lib/rex/proto/dcerpc/packet.rb +52 -45
- data/lib/rex/proto/dcerpc/packet.rb.ut.rb +12 -11
- data/lib/rex/proto/dcerpc/response.rb +1 -0
- data/lib/rex/proto/dcerpc/response.rb.ut.rb +2 -1
- data/lib/rex/proto/dcerpc/uuid.rb +13 -12
- data/lib/rex/proto/dcerpc/uuid.rb.ut.rb +2 -1
- data/lib/rex/proto/dhcp.rb +2 -1
- data/lib/rex/proto/dhcp/constants.rb +2 -1
- data/lib/rex/proto/dhcp/server.rb +4 -3
- data/lib/rex/proto/drda.rb +1 -0
- data/lib/rex/proto/drda.rb.ts.rb +1 -0
- data/lib/rex/proto/drda/constants.rb +1 -0
- data/lib/rex/proto/drda/constants.rb.ut.rb +1 -0
- data/lib/rex/proto/drda/packet.rb +11 -10
- data/lib/rex/proto/drda/packet.rb.ut.rb +5 -4
- data/lib/rex/proto/drda/utils.rb +4 -3
- data/lib/rex/proto/drda/utils.rb.ut.rb +3 -2
- data/lib/rex/proto/http.rb +2 -1
- data/lib/rex/proto/http.rb.ts.rb +2 -1
- data/lib/rex/proto/http/client.rb +29 -5
- data/lib/rex/proto/http/client.rb.ut.rb +1 -0
- data/lib/rex/proto/http/handler.rb +2 -1
- data/lib/rex/proto/http/handler/erb.rb +5 -4
- data/lib/rex/proto/http/handler/erb.rb.ut.rb +2 -1
- data/lib/rex/proto/http/handler/proc.rb +1 -0
- data/lib/rex/proto/http/handler/proc.rb.ut.rb +2 -1
- data/lib/rex/proto/http/header.rb +3 -3
- data/lib/rex/proto/http/header.rb.ut.rb +2 -1
- data/lib/rex/proto/http/packet.rb +1 -0
- data/lib/rex/proto/http/packet.rb.ut.rb +15 -14
- data/lib/rex/proto/http/request.rb +23 -22
- data/lib/rex/proto/http/request.rb.ut.rb +2 -1
- data/lib/rex/proto/http/response.rb +6 -5
- data/lib/rex/proto/http/response.rb.ut.rb +7 -6
- data/lib/rex/proto/http/server.rb +1 -0
- data/lib/rex/proto/http/server.rb.ut.rb +6 -5
- data/lib/rex/proto/iax2.rb +1 -0
- data/lib/rex/proto/iax2/call.rb +48 -47
- data/lib/rex/proto/iax2/client.rb +23 -22
- data/lib/rex/proto/iax2/codecs.rb +1 -0
- data/lib/rex/proto/iax2/codecs/alaw.rb +1 -0
- data/lib/rex/proto/iax2/codecs/g711.rb +4 -3
- data/lib/rex/proto/iax2/codecs/mulaw.rb +1 -0
- data/lib/rex/proto/iax2/constants.rb +1 -0
- data/lib/rex/proto/natpmp.rb +11 -0
- data/lib/rex/proto/natpmp/constants.rb +19 -0
- data/lib/rex/proto/natpmp/packet.rb +45 -0
- data/lib/rex/proto/ntlm.rb +1 -0
- data/lib/rex/proto/ntlm.rb.ut.rb +1 -0
- data/lib/rex/proto/ntlm/base.rb +38 -37
- data/lib/rex/proto/ntlm/constants.rb +1 -0
- data/lib/rex/proto/ntlm/crypt.rb +45 -44
- data/lib/rex/proto/ntlm/exceptions.rb +1 -0
- data/lib/rex/proto/ntlm/message.rb +30 -29
- data/lib/rex/proto/ntlm/utils.rb +116 -115
- data/lib/rex/proto/proxy/socks4a.rb +1 -0
- data/lib/rex/proto/rfb.rb +1 -0
- data/lib/rex/proto/rfb.rb.ut.rb +1 -0
- data/lib/rex/proto/rfb/cipher.rb +1 -0
- data/lib/rex/proto/rfb/client.rb +1 -0
- data/lib/rex/proto/rfb/constants.rb +1 -0
- data/lib/rex/proto/smb.rb +2 -1
- data/lib/rex/proto/smb.rb.ts.rb +2 -1
- data/lib/rex/proto/smb/client.rb +23 -22
- data/lib/rex/proto/smb/client.rb.ut.rb +1 -0
- data/lib/rex/proto/smb/constants.rb +1 -0
- data/lib/rex/proto/smb/constants.rb.ut.rb +2 -1
- data/lib/rex/proto/smb/crypt.rb +3 -2
- data/lib/rex/proto/smb/evasions.rb +1 -0
- data/lib/rex/proto/smb/exceptions.rb +6 -5
- data/lib/rex/proto/smb/simpleclient.rb +1 -0
- data/lib/rex/proto/smb/simpleclient.rb.ut.rb +1 -0
- data/lib/rex/proto/smb/utils.rb +1 -0
- data/lib/rex/proto/smb/utils.rb.ut.rb +2 -1
- data/lib/rex/proto/sunrpc.rb +1 -0
- data/lib/rex/proto/sunrpc/client.rb +1 -0
- data/lib/rex/proto/tftp.rb +3 -1
- data/lib/rex/proto/tftp/client.rb +344 -0
- data/lib/rex/proto/tftp/constants.rb +2 -1
- data/lib/rex/proto/tftp/server.rb +2 -1
- data/lib/rex/proto/tftp/server.rb.ut.rb +3 -2
- data/lib/rex/registry.rb +14 -0
- data/lib/rex/registry/hive.rb +132 -0
- data/lib/rex/registry/lfkey.rb +51 -0
- data/lib/rex/registry/nodekey.rb +54 -0
- data/lib/rex/registry/regf.rb +25 -0
- data/lib/rex/registry/valuekey.rb +67 -0
- data/lib/rex/registry/valuelist.rb +29 -0
- data/lib/rex/ropbuilder.rb +2 -1
- data/lib/rex/ropbuilder/rop.rb +3 -2
- data/lib/rex/script.rb +1 -0
- data/lib/rex/script/base.rb +1 -0
- data/lib/rex/script/meterpreter.rb +1 -0
- data/lib/rex/script/shell.rb +1 -0
- data/lib/rex/service.rb +2 -1
- data/lib/rex/service_manager.rb +6 -5
- data/lib/rex/service_manager.rb.ut.rb +2 -1
- data/lib/rex/services/local_relay.rb +1 -0
- data/lib/rex/socket.rb +72 -36
- data/lib/rex/socket.rb.ut.rb +1 -0
- data/lib/rex/socket/comm.rb +1 -0
- data/lib/rex/socket/comm/local.rb +60 -13
- data/lib/rex/socket/comm/local.rb.ut.rb +2 -1
- data/lib/rex/socket/ip.rb +1 -0
- data/lib/rex/socket/parameters.rb +15 -14
- data/lib/rex/socket/parameters.rb.ut.rb +2 -1
- data/lib/rex/socket/range_walker.rb +71 -26
- data/lib/rex/socket/range_walker.rb.ut.rb +2 -1
- data/lib/rex/socket/ssl_tcp.rb +1 -0
- data/lib/rex/socket/ssl_tcp.rb.ut.rb +2 -1
- data/lib/rex/socket/ssl_tcp_server.rb +1 -0
- data/lib/rex/socket/ssl_tcp_server.rb.ut.rb +1 -0
- data/lib/rex/socket/subnet_walker.rb +1 -0
- data/lib/rex/socket/subnet_walker.rb.ut.rb +2 -1
- data/lib/rex/socket/switch_board.rb +1 -0
- data/lib/rex/socket/switch_board.rb.ut.rb +2 -1
- data/lib/rex/socket/tcp.rb +4 -3
- data/lib/rex/socket/tcp.rb.ut.rb +2 -1
- data/lib/rex/socket/tcp_server.rb +1 -0
- data/lib/rex/socket/tcp_server.rb.ut.rb +2 -1
- data/lib/rex/socket/udp.rb +2 -1
- data/lib/rex/socket/udp.rb.ut.rb +2 -1
- data/lib/rex/struct2.rb +2 -1
- data/lib/rex/struct2/c_struct.rb +2 -1
- data/lib/rex/struct2/c_struct_template.rb +2 -1
- data/lib/rex/struct2/constant.rb +2 -1
- data/lib/rex/struct2/element.rb +2 -1
- data/lib/rex/struct2/generic.rb +1 -0
- data/lib/rex/struct2/restraint.rb +2 -1
- data/lib/rex/struct2/s_string.rb +1 -0
- data/lib/rex/struct2/s_struct.rb +1 -0
- data/lib/rex/sync.rb +2 -1
- data/lib/rex/sync/event.rb +1 -0
- data/lib/rex/sync/read_write_lock.rb +1 -0
- data/lib/rex/sync/ref.rb +2 -1
- data/lib/rex/sync/thread_safe.rb +2 -1
- data/lib/rex/test.rb +2 -1
- data/lib/rex/text.rb +136 -19
- data/lib/rex/text.rb.ut.rb +1 -0
- data/lib/rex/thread_factory.rb +5 -4
- data/lib/rex/time.rb +2 -1
- data/lib/rex/transformer.rb +1 -0
- data/lib/rex/transformer.rb.ut.rb +2 -1
- data/lib/rex/ui.rb +2 -1
- data/lib/rex/ui/interactive.rb +10 -9
- data/lib/rex/ui/output.rb +1 -0
- data/lib/rex/ui/output/none.rb +2 -1
- data/lib/rex/ui/progress_tracker.rb +2 -1
- data/lib/rex/ui/subscriber.rb +9 -8
- data/lib/rex/ui/text/color.rb +1 -0
- data/lib/rex/ui/text/color.rb.ut.rb +1 -0
- data/lib/rex/ui/text/dispatcher_shell.rb +63 -23
- data/lib/rex/ui/text/input.rb +1 -0
- data/lib/rex/ui/text/input/buffer.rb +7 -6
- data/lib/rex/ui/text/input/readline.rb +14 -13
- data/lib/rex/ui/text/input/socket.rb +1 -0
- data/lib/rex/ui/text/input/stdio.rb +2 -1
- data/lib/rex/ui/text/irb_shell.rb +1 -0
- data/lib/rex/ui/text/output.rb +1 -0
- data/lib/rex/ui/text/output/buffer.rb +1 -0
- data/lib/rex/ui/text/output/file.rb +1 -0
- data/lib/rex/ui/text/output/socket.rb +1 -0
- data/lib/rex/ui/text/output/stdio.rb +1 -0
- data/lib/rex/ui/text/output/tee.rb +1 -0
- data/lib/rex/ui/text/progress_tracker.rb +2 -1
- data/lib/rex/ui/text/progress_tracker.rb.ut.rb +2 -1
- data/lib/rex/ui/text/shell.rb +1 -0
- data/lib/rex/ui/text/table.rb +20 -14
- data/lib/rex/ui/text/table.rb.ut.rb +3 -2
- data/lib/rex/zip.rb +1 -0
- data/lib/rex/zip/archive.rb +2 -1
- data/lib/rex/zip/blocks.rb +3 -2
- data/lib/rex/zip/entry.rb +6 -7
- data/lib/rex/zip/jar.rb +4 -3
- data/lib/rex/zip/samples/comment.rb +1 -0
- data/lib/rex/zip/samples/mkwar.rb +1 -0
- data/lib/rex/zip/samples/mkzip.rb +1 -0
- data/lib/rex/zip/samples/recursive.rb +1 -0
- metadata +433 -435
data/lib/rex/time.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# -*- coding: binary -*-
|
|
1
2
|
module Rex
|
|
2
3
|
|
|
3
4
|
###
|
|
@@ -13,7 +14,7 @@ module ExtTime
|
|
|
13
14
|
#
|
|
14
15
|
def self.sec_to_s(seconds)
|
|
15
16
|
parts = [ 31536000, 86400, 3600, 60, 1 ].map { |d|
|
|
16
|
-
if ((c = seconds / d) > 0)
|
|
17
|
+
if ((c = seconds / d) > 0)
|
|
17
18
|
seconds -= c.truncate * d
|
|
18
19
|
c.truncate
|
|
19
20
|
else
|
data/lib/rex/transformer.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
+
# -*- coding: binary -*-
|
|
2
3
|
|
|
3
4
|
$:.unshift(File.join(File.dirname(__FILE__), '..'))
|
|
4
5
|
|
|
@@ -35,4 +36,4 @@ class Rex::Transformer::UnitTest < Test::Unit::TestCase
|
|
|
35
36
|
|
|
36
37
|
assert_equal('onetwo', a[0], "invalid from_a conversion")
|
|
37
38
|
end
|
|
38
|
-
end
|
|
39
|
+
end
|
data/lib/rex/ui.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# -*- coding: binary -*-
|
|
1
2
|
#
|
|
2
3
|
# This file includes everything needed to interact with the user interface
|
|
3
4
|
# wrappers of the rex library.
|
|
@@ -18,4 +19,4 @@ require 'rex/ui/text/table'
|
|
|
18
19
|
|
|
19
20
|
# Ui subscriber
|
|
20
21
|
require 'rex/ui/subscriber'
|
|
21
|
-
require 'rex/ui/interactive'
|
|
22
|
+
require 'rex/ui/interactive'
|
data/lib/rex/ui/interactive.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# -*- coding: binary -*-
|
|
1
2
|
module Rex
|
|
2
3
|
module Ui
|
|
3
4
|
|
|
@@ -209,25 +210,25 @@ protected
|
|
|
209
210
|
# Interacts between a local stream and a remote ring buffer. This has to use
|
|
210
211
|
# a secondary thread to prevent the select on the local stream from blocking
|
|
211
212
|
#
|
|
212
|
-
def interact_ring(ring)
|
|
213
|
+
def interact_ring(ring)
|
|
213
214
|
begin
|
|
214
|
-
|
|
215
|
+
|
|
215
216
|
rdr = Rex::ThreadFactory.spawn("RingMonitor", false) do
|
|
216
217
|
seq = nil
|
|
217
218
|
while self.interacting
|
|
218
219
|
|
|
219
220
|
# Look for any pending data from the remote ring
|
|
220
221
|
nseq,data = ring.read_data(seq)
|
|
221
|
-
|
|
222
|
+
|
|
222
223
|
# Update the sequence number if necessary
|
|
223
224
|
seq = nseq || seq
|
|
224
|
-
|
|
225
|
+
|
|
225
226
|
# Write output to the local stream if successful
|
|
226
227
|
user_output.print(data) if data
|
|
227
|
-
|
|
228
|
+
|
|
228
229
|
# Wait for new data to arrive on this session
|
|
229
230
|
ring.wait(seq)
|
|
230
|
-
end
|
|
231
|
+
end
|
|
231
232
|
end
|
|
232
233
|
|
|
233
234
|
while self.interacting
|
|
@@ -235,18 +236,18 @@ protected
|
|
|
235
236
|
# Look for any pending input from the local stream
|
|
236
237
|
sd = Rex::ThreadSafe.select([ _local_fd ], nil, [_local_fd], 5.0)
|
|
237
238
|
|
|
238
|
-
# Write input to the ring's input mechanism
|
|
239
|
+
# Write input to the ring's input mechanism
|
|
239
240
|
if sd
|
|
240
241
|
data = user_input.gets
|
|
241
242
|
ring.put(data)
|
|
242
243
|
end
|
|
243
244
|
end
|
|
244
|
-
|
|
245
|
+
|
|
245
246
|
ensure
|
|
246
247
|
rdr.kill
|
|
247
248
|
end
|
|
248
249
|
end
|
|
249
|
-
|
|
250
|
+
|
|
250
251
|
|
|
251
252
|
#
|
|
252
253
|
# Installs a signal handler to monitor suspend signal notifications.
|
data/lib/rex/ui/output.rb
CHANGED
data/lib/rex/ui/output/none.rb
CHANGED
data/lib/rex/ui/subscriber.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# -*- coding: binary -*-
|
|
1
2
|
module Rex
|
|
2
3
|
module Ui
|
|
3
4
|
|
|
@@ -21,7 +22,7 @@ module Subscriber
|
|
|
21
22
|
def print_line(msg='')
|
|
22
23
|
if (user_output)
|
|
23
24
|
print_blank_line if user_output.prompting?
|
|
24
|
-
user_output.print_line(msg)
|
|
25
|
+
user_output.print_line(msg)
|
|
25
26
|
end
|
|
26
27
|
end
|
|
27
28
|
|
|
@@ -31,7 +32,7 @@ module Subscriber
|
|
|
31
32
|
def print_status(msg='')
|
|
32
33
|
if (user_output)
|
|
33
34
|
print_blank_line if user_output.prompting?
|
|
34
|
-
user_output.print_status(msg)
|
|
35
|
+
user_output.print_status(msg)
|
|
35
36
|
end
|
|
36
37
|
end
|
|
37
38
|
|
|
@@ -41,17 +42,17 @@ module Subscriber
|
|
|
41
42
|
def print_error(msg='')
|
|
42
43
|
if (user_output)
|
|
43
44
|
print_blank_line if user_output.prompting?
|
|
44
|
-
user_output.print_error(msg)
|
|
45
|
+
user_output.print_error(msg)
|
|
45
46
|
end
|
|
46
47
|
end
|
|
47
|
-
|
|
48
|
+
|
|
48
49
|
#
|
|
49
50
|
# Wraps user_output.print_good
|
|
50
51
|
#
|
|
51
52
|
def print_good(msg='')
|
|
52
53
|
if (user_output)
|
|
53
54
|
print_blank_line if user_output.prompting?
|
|
54
|
-
user_output.print_good(msg)
|
|
55
|
+
user_output.print_good(msg)
|
|
55
56
|
end
|
|
56
57
|
end
|
|
57
58
|
|
|
@@ -83,10 +84,10 @@ module Subscriber
|
|
|
83
84
|
# The user output handle.
|
|
84
85
|
#
|
|
85
86
|
attr_accessor :user_output
|
|
86
|
-
|
|
87
|
+
|
|
87
88
|
protected
|
|
88
89
|
|
|
89
|
-
#
|
|
90
|
+
#
|
|
90
91
|
# Prints a blank line. Used when the input is prompting.
|
|
91
92
|
#
|
|
92
93
|
def print_blank_line
|
|
@@ -109,7 +110,7 @@ module Subscriber
|
|
|
109
110
|
def gets
|
|
110
111
|
user_input.gets if (user_input)
|
|
111
112
|
end
|
|
112
|
-
|
|
113
|
+
|
|
113
114
|
#
|
|
114
115
|
# The user intput handle.
|
|
115
116
|
#
|
data/lib/rex/ui/text/color.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# -*- coding: binary -*-
|
|
1
2
|
require 'rex/ui'
|
|
2
3
|
require 'pp'
|
|
3
4
|
|
|
@@ -35,11 +36,23 @@ module DispatcherShell
|
|
|
35
36
|
#
|
|
36
37
|
# Returns nil for an empty set of commands.
|
|
37
38
|
#
|
|
38
|
-
# This method should be overridden
|
|
39
|
+
# This method should be overridden to return a Hash with command
|
|
40
|
+
# names for keys and brief help text for values.
|
|
39
41
|
#
|
|
40
42
|
def commands
|
|
41
43
|
end
|
|
42
|
-
|
|
44
|
+
|
|
45
|
+
#
|
|
46
|
+
# Returns an empty set of commands.
|
|
47
|
+
#
|
|
48
|
+
# This method should be overridden if the dispatcher has commands that
|
|
49
|
+
# should be treated as deprecated. Deprecated commands will not show up in
|
|
50
|
+
# help and will not tab-complete, but will still be callable.
|
|
51
|
+
#
|
|
52
|
+
def deprecated_commands
|
|
53
|
+
[]
|
|
54
|
+
end
|
|
55
|
+
|
|
43
56
|
#
|
|
44
57
|
# Wraps shell.print_error
|
|
45
58
|
#
|
|
@@ -75,6 +88,33 @@ module DispatcherShell
|
|
|
75
88
|
shell.print(msg)
|
|
76
89
|
end
|
|
77
90
|
|
|
91
|
+
#
|
|
92
|
+
# Print a warning that the called command is deprecated and optionally
|
|
93
|
+
# forward to the replacement +method+ (useful for when commands are
|
|
94
|
+
# renamed).
|
|
95
|
+
#
|
|
96
|
+
def deprecated_cmd(method=nil, *args)
|
|
97
|
+
cmd = caller[0].match(/`cmd_(.*)'/)[1]
|
|
98
|
+
print_error "The #{cmd} command is DEPRECATED"
|
|
99
|
+
if cmd == "db_autopwn"
|
|
100
|
+
print_error "See http://r-7.co/xY65Zr instead"
|
|
101
|
+
elsif method and self.respond_to?("cmd_#{method}")
|
|
102
|
+
print_error "Use #{method} instead"
|
|
103
|
+
self.send("cmd_#{method}", *args)
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def deprecated_help(method=nil)
|
|
108
|
+
cmd = caller[0].match(/`cmd_(.*)_help'/)[1]
|
|
109
|
+
print_error "The #{cmd} command is DEPRECATED"
|
|
110
|
+
if cmd == "db_autopwn"
|
|
111
|
+
print_error "See http://r-7.co/xY65Zr instead"
|
|
112
|
+
elsif method and self.respond_to?("cmd_#{method}_help")
|
|
113
|
+
print_error "Use 'help #{method}' instead"
|
|
114
|
+
self.send("cmd_#{method}_help")
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
78
118
|
#
|
|
79
119
|
# Wraps shell.update_prompt
|
|
80
120
|
#
|
|
@@ -157,7 +197,7 @@ module DispatcherShell
|
|
|
157
197
|
tbl = Table.new(
|
|
158
198
|
'Header' => "#{self.name} Commands",
|
|
159
199
|
'Indent' => opts['Indent'] || 4,
|
|
160
|
-
'Columns' =>
|
|
200
|
+
'Columns' =>
|
|
161
201
|
[
|
|
162
202
|
'Command',
|
|
163
203
|
'Description'
|
|
@@ -193,7 +233,7 @@ module DispatcherShell
|
|
|
193
233
|
if matches and matches.length == 1 and File.directory?(matches[0])
|
|
194
234
|
dir = matches[0]
|
|
195
235
|
dir += File::SEPARATOR if dir[-1,1] != File::SEPARATOR
|
|
196
|
-
matches = ::Readline::FILENAME_COMPLETION_PROC.call(dir)
|
|
236
|
+
matches = ::Readline::FILENAME_COMPLETION_PROC.call(dir)
|
|
197
237
|
end
|
|
198
238
|
matches
|
|
199
239
|
end
|
|
@@ -213,9 +253,9 @@ module DispatcherShell
|
|
|
213
253
|
|
|
214
254
|
# Initialze the dispatcher array
|
|
215
255
|
self.dispatcher_stack = []
|
|
216
|
-
|
|
256
|
+
|
|
217
257
|
# Initialize the tab completion array
|
|
218
|
-
self.tab_words = []
|
|
258
|
+
self.tab_words = []
|
|
219
259
|
self.on_command_proc = nil
|
|
220
260
|
end
|
|
221
261
|
|
|
@@ -230,34 +270,34 @@ module DispatcherShell
|
|
|
230
270
|
# Check trailing whitespace so we can tell 'x' from 'x '
|
|
231
271
|
str_match = str.match(/\s+$/)
|
|
232
272
|
str_trail = (str_match.nil?) ? '' : str_match[0]
|
|
233
|
-
|
|
273
|
+
|
|
234
274
|
# Split the line up by whitespace into words
|
|
235
275
|
str_words = str.split(/[\s\t\n]+/)
|
|
236
|
-
|
|
276
|
+
|
|
237
277
|
# Append an empty word if we had trailing whitespace
|
|
238
278
|
str_words << '' if str_trail.length > 0
|
|
239
|
-
|
|
279
|
+
|
|
240
280
|
# Place the word list into an instance variable
|
|
241
281
|
self.tab_words = str_words
|
|
242
|
-
|
|
282
|
+
|
|
243
283
|
# Pop the last word and pass it to the real method
|
|
244
284
|
tab_complete_stub(self.tab_words.pop)
|
|
245
285
|
end
|
|
246
286
|
|
|
247
|
-
# Performs tab completion of a command, if supported
|
|
287
|
+
# Performs tab completion of a command, if supported
|
|
248
288
|
# Current words can be found in self.tab_words
|
|
249
289
|
#
|
|
250
290
|
def tab_complete_stub(str)
|
|
251
291
|
items = []
|
|
252
|
-
|
|
292
|
+
|
|
253
293
|
return nil if not str
|
|
254
|
-
|
|
294
|
+
|
|
255
295
|
# puts "Words(#{tab_words.join(", ")}) Partial='#{str}'"
|
|
256
|
-
|
|
296
|
+
|
|
257
297
|
# Next, try to match internal command or value completion
|
|
258
298
|
# Enumerate each entry in the dispatcher stack
|
|
259
299
|
dispatcher_stack.each { |dispatcher|
|
|
260
|
-
|
|
300
|
+
|
|
261
301
|
# If no command is set and it supports commands, add them all
|
|
262
302
|
if (tab_words.empty? and dispatcher.respond_to?('commands'))
|
|
263
303
|
items.concat(dispatcher.commands.keys)
|
|
@@ -285,15 +325,15 @@ module DispatcherShell
|
|
|
285
325
|
rescue RegexpError
|
|
286
326
|
str = Regexp.escape(str)
|
|
287
327
|
end
|
|
288
|
-
|
|
328
|
+
|
|
289
329
|
# XXX - This still doesn't fix some Regexp warnings:
|
|
290
330
|
# ./lib/rex/ui/text/dispatcher_shell.rb:171: warning: regexp has `]' without escape
|
|
291
331
|
|
|
292
332
|
# Match based on the partial word
|
|
293
|
-
items.find_all { |e|
|
|
333
|
+
items.find_all { |e|
|
|
294
334
|
e =~ /^#{str}/
|
|
295
335
|
# Prepend the rest of the command (or it gets replaced!)
|
|
296
|
-
}.map { |e|
|
|
336
|
+
}.map { |e|
|
|
297
337
|
tab_words.dup.push(e).join(' ')
|
|
298
338
|
}
|
|
299
339
|
end
|
|
@@ -337,12 +377,12 @@ module DispatcherShell
|
|
|
337
377
|
next if not dispatcher.respond_to?('commands')
|
|
338
378
|
|
|
339
379
|
begin
|
|
340
|
-
if (dispatcher.commands.has_key?(method))
|
|
380
|
+
if (dispatcher.commands.has_key?(method) or dispatcher.deprecated_commands.include?(method))
|
|
341
381
|
self.on_command_proc.call(line.strip) if self.on_command_proc
|
|
342
382
|
run_command(dispatcher, method, arguments)
|
|
343
383
|
found = true
|
|
344
384
|
end
|
|
345
|
-
rescue
|
|
385
|
+
rescue
|
|
346
386
|
error = $!
|
|
347
387
|
|
|
348
388
|
print_error(
|
|
@@ -373,7 +413,7 @@ module DispatcherShell
|
|
|
373
413
|
#
|
|
374
414
|
def run_command(dispatcher, method, arguments)
|
|
375
415
|
self.busy = true
|
|
376
|
-
|
|
416
|
+
|
|
377
417
|
if(blocked_command?(method))
|
|
378
418
|
print_error("The #{method} command has been disabled.")
|
|
379
419
|
else
|
|
@@ -440,7 +480,7 @@ module DispatcherShell
|
|
|
440
480
|
#
|
|
441
481
|
# Return a readable version of a help banner for all of the enstacked
|
|
442
482
|
# dispatchers.
|
|
443
|
-
#
|
|
483
|
+
#
|
|
444
484
|
# See +CommandDispatcher#help_to_s+
|
|
445
485
|
#
|
|
446
486
|
def help_to_s(opts = {})
|
|
@@ -477,7 +517,7 @@ module DispatcherShell
|
|
|
477
517
|
self.blocked || return
|
|
478
518
|
self.blocked.delete(cmd)
|
|
479
519
|
end
|
|
480
|
-
|
|
520
|
+
|
|
481
521
|
|
|
482
522
|
attr_accessor :dispatcher_stack # :nodoc:
|
|
483
523
|
attr_accessor :tab_words # :nodoc:
|
data/lib/rex/ui/text/input.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# -*- coding: binary -*-
|
|
1
2
|
require 'rex/ui'
|
|
2
3
|
|
|
3
4
|
module Rex
|
|
@@ -14,7 +15,7 @@ require 'rex/io/stream_abstraction'
|
|
|
14
15
|
class Input::Buffer < Rex::Ui::Text::Input
|
|
15
16
|
|
|
16
17
|
class BufferSock
|
|
17
|
-
include Rex::IO::StreamAbstraction
|
|
18
|
+
include Rex::IO::StreamAbstraction
|
|
18
19
|
def write(buf, opts={})
|
|
19
20
|
syswrite(buf)
|
|
20
21
|
end
|
|
@@ -36,25 +37,25 @@ class Input::Buffer < Rex::Ui::Text::Input
|
|
|
36
37
|
def put(msg, opts={})
|
|
37
38
|
@sock.lsock.write(msg)
|
|
38
39
|
end
|
|
39
|
-
|
|
40
|
+
|
|
40
41
|
#
|
|
41
42
|
# Wait for a line of input to be read from a socket.
|
|
42
43
|
#
|
|
43
44
|
def gets
|
|
44
45
|
# Initialize the line buffer
|
|
45
46
|
line = ''
|
|
46
|
-
|
|
47
|
+
|
|
47
48
|
# Read data one byte at a time until we see a LF
|
|
48
49
|
while (true)
|
|
49
50
|
break if line.include?("\n")
|
|
50
|
-
|
|
51
|
+
|
|
51
52
|
# Read another character of input
|
|
52
53
|
char = @sock.rsock.getc
|
|
53
|
-
|
|
54
|
+
|
|
54
55
|
# Append this character to the string
|
|
55
56
|
line << char
|
|
56
57
|
end
|
|
57
|
-
|
|
58
|
+
|
|
58
59
|
return line
|
|
59
60
|
end
|
|
60
61
|
|