librex 0.0.65 → 0.0.66
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- coding: binary -*-
|
1
2
|
require 'rex/post/meterpreter'
|
2
3
|
|
3
4
|
module Rex
|
@@ -18,7 +19,7 @@ class Console::CommandDispatcher::Priv
|
|
18
19
|
|
19
20
|
Klass = Console::CommandDispatcher::Priv
|
20
21
|
|
21
|
-
Dispatchers =
|
22
|
+
Dispatchers =
|
22
23
|
[
|
23
24
|
Klass::Elevate,
|
24
25
|
Klass::Passwd,
|
@@ -58,4 +59,4 @@ end
|
|
58
59
|
end
|
59
60
|
end
|
60
61
|
end
|
61
|
-
end
|
62
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- coding: binary -*-
|
1
2
|
require 'rex/post/meterpreter'
|
2
3
|
|
3
4
|
module Rex
|
@@ -15,7 +16,7 @@ class Console::CommandDispatcher::Priv::Elevate
|
|
15
16
|
Klass = Console::CommandDispatcher::Priv::Elevate
|
16
17
|
|
17
18
|
include Console::CommandDispatcher
|
18
|
-
|
19
|
+
|
19
20
|
ELEVATE_TECHNIQUE_NONE = -1
|
20
21
|
ELEVATE_TECHNIQUE_ANY = 0
|
21
22
|
ELEVATE_TECHNIQUE_SERVICE_NAMEDPIPE = 1
|
@@ -23,7 +24,7 @@ class Console::CommandDispatcher::Priv::Elevate
|
|
23
24
|
ELEVATE_TECHNIQUE_SERVICE_TOKENDUP = 3
|
24
25
|
ELEVATE_TECHNIQUE_VULN_KITRAP0D = 4
|
25
26
|
|
26
|
-
ELEVATE_TECHNIQUE_DESCRIPTION = [ "All techniques available",
|
27
|
+
ELEVATE_TECHNIQUE_DESCRIPTION = [ "All techniques available",
|
27
28
|
"Service - Named Pipe Impersonation (In Memory/Admin)",
|
28
29
|
"Service - Named Pipe Impersonation (Dropper/Admin)",
|
29
30
|
"Service - Token Duplication (In Memory/Admin)",
|
@@ -44,23 +45,23 @@ class Console::CommandDispatcher::Priv::Elevate
|
|
44
45
|
def name
|
45
46
|
"Priv: Elevate"
|
46
47
|
end
|
47
|
-
|
48
|
+
|
48
49
|
|
49
50
|
#
|
50
51
|
# Attempt to elevate the meterpreter to that of local system.
|
51
52
|
#
|
52
53
|
def cmd_getsystem( *args )
|
53
|
-
|
54
|
+
|
54
55
|
technique = ELEVATE_TECHNIQUE_ANY
|
55
|
-
|
56
|
+
|
56
57
|
desc = ""
|
57
58
|
ELEVATE_TECHNIQUE_DESCRIPTION.each_index { |i| desc += "\n\t\t#{i} : #{ELEVATE_TECHNIQUE_DESCRIPTION[i]}" }
|
58
|
-
|
59
|
+
|
59
60
|
getsystem_opts = Rex::Parser::Arguments.new(
|
60
61
|
"-h" => [ false, "Help Banner." ],
|
61
62
|
"-t" => [ true, "The technique to use. (Default to \'#{technique}\')." + desc ]
|
62
63
|
)
|
63
|
-
|
64
|
+
|
64
65
|
getsystem_opts.parse(args) { | opt, idx, val |
|
65
66
|
case opt
|
66
67
|
when "-h"
|
@@ -77,16 +78,16 @@ class Console::CommandDispatcher::Priv::Elevate
|
|
77
78
|
print_error( "Technique '#{technique}' is out of range." );
|
78
79
|
return false;
|
79
80
|
end
|
80
|
-
|
81
|
+
|
81
82
|
result = client.priv.getsystem( technique )
|
82
|
-
|
83
|
+
|
83
84
|
# got system?
|
84
85
|
if result[0]
|
85
86
|
print_line( "...got system (via technique #{result[1]})." );
|
86
87
|
else
|
87
88
|
print_line( "...failed to get system." );
|
88
89
|
end
|
89
|
-
|
90
|
+
|
90
91
|
return result
|
91
92
|
end
|
92
93
|
|
@@ -95,4 +96,4 @@ end
|
|
95
96
|
end
|
96
97
|
end
|
97
98
|
end
|
98
|
-
end
|
99
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- coding: binary -*-
|
1
2
|
require 'rex/post/meterpreter'
|
2
3
|
|
3
4
|
module Rex
|
@@ -104,7 +105,7 @@ class Console::CommandDispatcher::Priv::Timestomp
|
|
104
105
|
# If any one of the four times were specified, change them.
|
105
106
|
if (modified or accessed or creation or emodified)
|
106
107
|
print_status("Setting specific MACE attributes on #{file_path}")
|
107
|
-
client.priv.fs.set_file_mace(file_path, modified, accessed,
|
108
|
+
client.priv.fs.set_file_mace(file_path, modified, accessed,
|
108
109
|
creation, emodified)
|
109
110
|
end
|
110
111
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- coding: binary -*-
|
1
2
|
require 'rex/post/meterpreter'
|
2
3
|
|
3
4
|
module Rex
|
@@ -33,28 +34,29 @@ class Console::CommandDispatcher::Sniffer
|
|
33
34
|
"sniffer_stop" => "Stop packet capture on a specific interface",
|
34
35
|
"sniffer_stats" => "View statistics of an active capture",
|
35
36
|
"sniffer_dump" => "Retrieve captured packet data to PCAP file",
|
37
|
+
"sniffer_release" => "Free captured packets on a specific interface instead of downloading them",
|
36
38
|
}
|
37
39
|
end
|
38
40
|
|
39
41
|
|
40
42
|
def cmd_sniffer_interfaces(*args)
|
41
|
-
|
43
|
+
|
42
44
|
ifaces = client.sniffer.interfaces()
|
43
45
|
|
44
46
|
print_line()
|
45
47
|
|
46
48
|
ifaces.each do |i|
|
47
|
-
print_line(sprintf("%d - '%s' ( type:%d mtu:%d usable:%s dhcp:%s wifi:%s )",
|
49
|
+
print_line(sprintf("%d - '%s' ( type:%d mtu:%d usable:%s dhcp:%s wifi:%s )",
|
48
50
|
i['idx'], i['description'],
|
49
51
|
i['type'], i['mtu'], i['usable'], i['dhcp'], i['wireless'])
|
50
52
|
)
|
51
53
|
end
|
52
|
-
|
54
|
+
|
53
55
|
print_line()
|
54
56
|
|
55
57
|
return true
|
56
58
|
end
|
57
|
-
|
59
|
+
|
58
60
|
def cmd_sniffer_start(*args)
|
59
61
|
intf = args.shift.to_i
|
60
62
|
if (intf == 0)
|
@@ -63,87 +65,102 @@ class Console::CommandDispatcher::Sniffer
|
|
63
65
|
end
|
64
66
|
maxp = (args.shift || 50000).to_i
|
65
67
|
bpf = args.join(" ")
|
66
|
-
|
68
|
+
|
67
69
|
client.sniffer.capture_start(intf, maxp, bpf)
|
68
70
|
print_status("Capture started on interface #{intf} (#{maxp} packet buffer)")
|
69
71
|
return true
|
70
72
|
end
|
71
|
-
|
73
|
+
|
72
74
|
def cmd_sniffer_stop(*args)
|
73
|
-
|
75
|
+
intf = args[0].to_i
|
74
76
|
if (intf == 0)
|
75
77
|
print_error("Usage: sniffer_stop [interface-id]")
|
76
78
|
return
|
77
79
|
end
|
78
|
-
|
79
|
-
client.sniffer.capture_stop(intf)
|
80
|
+
|
81
|
+
res = client.sniffer.capture_stop(intf)
|
80
82
|
print_status("Capture stopped on interface #{intf}")
|
83
|
+
print_status("There are #{res[:packets]} packets (#{res[:bytes]} bytes) remaining")
|
84
|
+
print_status("Download or release them using 'sniffer_dump' or 'sniffer_release'")
|
81
85
|
return true
|
82
86
|
end
|
83
|
-
|
87
|
+
|
84
88
|
def cmd_sniffer_stats(*args)
|
85
|
-
|
89
|
+
intf = args[0].to_i
|
86
90
|
if (intf == 0)
|
87
91
|
print_error("Usage: sniffer_stats [interface-id]")
|
88
92
|
return
|
89
93
|
end
|
90
|
-
|
94
|
+
|
91
95
|
stats = client.sniffer.capture_stats(intf)
|
92
96
|
print_status("Capture statistics for interface #{intf}")
|
93
97
|
stats.each_key do |k|
|
94
98
|
print_line("\t#{k}: #{stats[k]}")
|
95
99
|
end
|
96
|
-
|
97
|
-
return true
|
100
|
+
|
101
|
+
return true
|
102
|
+
end
|
103
|
+
|
104
|
+
def cmd_sniffer_release(*args)
|
105
|
+
intf = args[0].to_i
|
106
|
+
if (intf == 0)
|
107
|
+
print_error("Usage: sniffer_release [interface-id]")
|
108
|
+
return
|
109
|
+
end
|
110
|
+
|
111
|
+
res = client.sniffer.capture_release(intf)
|
112
|
+
print_status("Flushed #{res[:packets]} packets (#{res[:bytes]} bytes) from interface #{intf}")
|
113
|
+
|
114
|
+
return true
|
98
115
|
end
|
99
|
-
|
116
|
+
|
100
117
|
def cmd_sniffer_dump(*args)
|
101
|
-
|
118
|
+
intf = args[0].to_i
|
102
119
|
if (intf == 0 or not args[1])
|
103
120
|
print_error("Usage: sniffer_dump [interface-id] [pcap-file]")
|
104
121
|
return
|
105
122
|
end
|
106
|
-
|
123
|
+
|
107
124
|
path_cap = args[1]
|
108
125
|
path_raw = args[1] + '.raw'
|
109
|
-
|
126
|
+
|
110
127
|
fd = ::File.new(path_raw, 'wb+')
|
111
|
-
|
128
|
+
|
112
129
|
print_status("Flushing packet capture buffer for interface #{intf}...")
|
113
130
|
res = client.sniffer.capture_dump(intf)
|
114
131
|
print_status("Flushed #{res[:packets]} packets (#{res[:bytes]} bytes)")
|
115
|
-
|
132
|
+
|
116
133
|
bytes_all = res[:bytes] || 0
|
117
134
|
bytes_got = 0
|
118
135
|
bytes_pct = 0
|
119
|
-
|
136
|
+
linktype = res[:linktype]
|
120
137
|
while (bytes_all > 0)
|
121
138
|
res = client.sniffer.capture_dump_read(intf,1024*512)
|
122
|
-
|
139
|
+
|
123
140
|
bytes_got += res[:bytes]
|
124
141
|
|
125
142
|
pct = ((bytes_got.to_f / bytes_all.to_f) * 100).to_i
|
126
143
|
if(pct > bytes_pct)
|
127
144
|
print_status("Downloaded #{"%.3d" % pct}% (#{bytes_got}/#{bytes_all})...")
|
128
145
|
bytes_pct = pct
|
129
|
-
end
|
146
|
+
end
|
130
147
|
break if res[:bytes] == 0
|
131
148
|
fd.write(res[:data])
|
132
149
|
end
|
133
|
-
|
150
|
+
|
134
151
|
fd.close
|
135
|
-
|
152
|
+
|
136
153
|
print_status("Download completed, converting to PCAP...")
|
137
|
-
|
154
|
+
|
138
155
|
fd = nil
|
139
156
|
if(::File.exist?(path_cap))
|
140
157
|
fd = ::File.new(path_cap, 'ab+')
|
141
158
|
else
|
142
159
|
fd = ::File.new(path_cap, 'wb+')
|
143
|
-
fd.write([0xa1b2c3d4, 2, 4, 0, 0, 65536,
|
144
|
-
end
|
160
|
+
fd.write([0xa1b2c3d4, 2, 4, 0, 0, 65536, linktype].pack('NnnNNNN'))
|
161
|
+
end
|
145
162
|
|
146
|
-
pkts = {}
|
163
|
+
pkts = {}
|
147
164
|
od = ::File.new(path_raw, 'rb')
|
148
165
|
|
149
166
|
|
@@ -151,27 +168,27 @@ class Console::CommandDispatcher::Sniffer
|
|
151
168
|
while(true)
|
152
169
|
buf = od.read(20)
|
153
170
|
break if not buf
|
154
|
-
|
171
|
+
|
155
172
|
idh,idl,thi,tlo,len = buf.unpack('N5')
|
156
173
|
break if not len
|
157
|
-
if(len > 10000)
|
174
|
+
if(len > 10000)
|
158
175
|
print_error("Corrupted packet data (length:#{len})")
|
159
176
|
break
|
160
177
|
end
|
161
|
-
|
178
|
+
|
162
179
|
pkt_id = (idh << 32) +idl
|
163
180
|
pkt_ts = Rex::Proto::SMB::Utils.time_smb_to_unix(thi,tlo)
|
164
181
|
pkt = od.read(len)
|
165
|
-
|
182
|
+
|
166
183
|
fd.write([pkt_ts,0,len,len].pack('NNNN')+pkt)
|
167
184
|
end
|
168
185
|
od.close
|
169
186
|
fd.close
|
170
|
-
|
187
|
+
|
171
188
|
::File.unlink(path_raw)
|
172
189
|
print_status("PCAP file written to #{path_cap}")
|
173
|
-
end
|
174
|
-
|
190
|
+
end
|
191
|
+
|
175
192
|
#
|
176
193
|
# Name for this dispatcher
|
177
194
|
# sni
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- coding: binary -*-
|
1
2
|
require 'rex/post/meterpreter'
|
2
3
|
|
3
4
|
module Rex
|
@@ -20,7 +21,7 @@ class Console::CommandDispatcher::Stdapi
|
|
20
21
|
|
21
22
|
Klass = Console::CommandDispatcher::Stdapi
|
22
23
|
|
23
|
-
Dispatchers =
|
24
|
+
Dispatchers =
|
24
25
|
[
|
25
26
|
Klass::Fs,
|
26
27
|
Klass::Net,
|
@@ -62,4 +63,4 @@ end
|
|
62
63
|
end
|
63
64
|
end
|
64
65
|
end
|
65
|
-
end
|
66
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- coding: binary -*-
|
1
2
|
require 'tempfile'
|
2
3
|
require 'rex/post/meterpreter'
|
3
4
|
|
@@ -34,24 +35,56 @@ class Console::CommandDispatcher::Stdapi::Fs
|
|
34
35
|
# List of supported commands.
|
35
36
|
#
|
36
37
|
def commands
|
37
|
-
{
|
38
|
+
all = {
|
38
39
|
"cat" => "Read the contents of a file to the screen",
|
39
40
|
"cd" => "Change directory",
|
41
|
+
"del" => "Delete the specified file",
|
40
42
|
"download" => "Download a file or directory",
|
41
43
|
"edit" => "Edit a file",
|
44
|
+
"getlwd" => "Print local working directory",
|
42
45
|
"getwd" => "Print working directory",
|
46
|
+
"lcd" => "Change local working directory",
|
47
|
+
"lpwd" => "Print local working directory",
|
43
48
|
"ls" => "List files",
|
44
49
|
"mkdir" => "Make directory",
|
45
50
|
"pwd" => "Print working directory",
|
51
|
+
"rm" => "Delete the specified file",
|
46
52
|
"rmdir" => "Remove directory",
|
53
|
+
"search" => "Search for files",
|
47
54
|
"upload" => "Upload a file or directory",
|
48
|
-
"lcd" => "Change local working directory",
|
49
|
-
"getlwd" => "Print local working directory",
|
50
|
-
"lpwd" => "Print local working directory",
|
51
|
-
"rm" => "Delete the specified file",
|
52
|
-
"del" => "Delete the specified file",
|
53
|
-
"search" => "Search for files"
|
54
55
|
}
|
56
|
+
|
57
|
+
reqs = {
|
58
|
+
"cat" => [ ],
|
59
|
+
"cd" => [ "stdapi_fs_chdir" ],
|
60
|
+
"del" => [ "stdapi_fs_rm" ],
|
61
|
+
"download" => [ ],
|
62
|
+
"edit" => [ ],
|
63
|
+
"getlwd" => [ ],
|
64
|
+
"getwd" => [ "stdapi_fs_getwd" ],
|
65
|
+
"lcd" => [ ],
|
66
|
+
"lpwd" => [ ],
|
67
|
+
"ls" => [ "stdapi_fs_stat", "stdapi_fs_ls" ],
|
68
|
+
"mkdir" => [ "stdapi_fs_mkdir" ],
|
69
|
+
"pwd" => [ "stdapi_fs_getwd" ],
|
70
|
+
"rmdir" => [ "stdapi_fs_delete_dir" ],
|
71
|
+
"rm" => [ "stdapi_fs_delete_file" ],
|
72
|
+
"search" => [ "stdapi_fs_search" ],
|
73
|
+
"upload" => [ ],
|
74
|
+
}
|
75
|
+
|
76
|
+
all.delete_if do |cmd, desc|
|
77
|
+
del = false
|
78
|
+
reqs[cmd].each do |req|
|
79
|
+
next if client.commands.include? req
|
80
|
+
del = true
|
81
|
+
break
|
82
|
+
end
|
83
|
+
|
84
|
+
del
|
85
|
+
end
|
86
|
+
|
87
|
+
all
|
55
88
|
end
|
56
89
|
|
57
90
|
#
|
@@ -65,18 +98,18 @@ class Console::CommandDispatcher::Stdapi::Fs
|
|
65
98
|
# Search for files.
|
66
99
|
#
|
67
100
|
def cmd_search( *args )
|
68
|
-
|
101
|
+
|
69
102
|
root = nil
|
70
103
|
glob = nil
|
71
104
|
recurse = true
|
72
|
-
|
105
|
+
|
73
106
|
opts = Rex::Parser::Arguments.new(
|
74
107
|
"-h" => [ false, "Help Banner." ],
|
75
108
|
"-d" => [ true, "The directory/drive to begin searching from. Leave empty to search all drives. (Default: #{root})" ],
|
76
109
|
"-f" => [ true, "The file pattern glob to search for. (e.g. *secret*.doc?)" ],
|
77
110
|
"-r" => [ true, "Recursivly search sub directories. (Default: #{recurse})" ]
|
78
111
|
)
|
79
|
-
|
112
|
+
|
80
113
|
opts.parse(args) { | opt, idx, val |
|
81
114
|
case opt
|
82
115
|
when "-h"
|
@@ -92,14 +125,14 @@ class Console::CommandDispatcher::Stdapi::Fs
|
|
92
125
|
recurse = false if( val =~ /^(f|n|0)/i )
|
93
126
|
end
|
94
127
|
}
|
95
|
-
|
128
|
+
|
96
129
|
if( not glob )
|
97
130
|
print_error( "You must specify a valid file glob to search for, e.g. >search -f *.doc" )
|
98
131
|
return
|
99
132
|
end
|
100
|
-
|
133
|
+
|
101
134
|
files = client.fs.file.search( root, glob, recurse )
|
102
|
-
|
135
|
+
|
103
136
|
if( not files.empty? )
|
104
137
|
print_line( "Found #{files.length} result#{ files.length > 1 ? 's' : '' }..." )
|
105
138
|
files.each do | file |
|
@@ -112,9 +145,9 @@ class Console::CommandDispatcher::Stdapi::Fs
|
|
112
145
|
else
|
113
146
|
print_line( "No files matching your search were found." )
|
114
147
|
end
|
115
|
-
|
148
|
+
|
116
149
|
end
|
117
|
-
|
150
|
+
|
118
151
|
#
|
119
152
|
# Reads the contents of a file and prints them to the screen.
|
120
153
|
#
|
@@ -124,13 +157,17 @@ class Console::CommandDispatcher::Stdapi::Fs
|
|
124
157
|
return true
|
125
158
|
end
|
126
159
|
|
127
|
-
|
160
|
+
if (client.fs.file.stat(args[0]).directory?)
|
161
|
+
print_error("#{args[0]} is a directory")
|
162
|
+
else
|
163
|
+
fd = client.fs.file.new(args[0], "rb")
|
128
164
|
|
129
|
-
|
130
|
-
|
131
|
-
|
165
|
+
until fd.eof?
|
166
|
+
print(fd.read)
|
167
|
+
end
|
132
168
|
|
133
|
-
|
169
|
+
fd.close
|
170
|
+
end
|
134
171
|
|
135
172
|
true
|
136
173
|
end
|
@@ -165,7 +202,7 @@ class Console::CommandDispatcher::Stdapi::Fs
|
|
165
202
|
|
166
203
|
return true
|
167
204
|
end
|
168
|
-
|
205
|
+
|
169
206
|
#
|
170
207
|
# Delete the specified file.
|
171
208
|
#
|
@@ -179,7 +216,7 @@ class Console::CommandDispatcher::Stdapi::Fs
|
|
179
216
|
|
180
217
|
return true
|
181
218
|
end
|
182
|
-
|
219
|
+
|
183
220
|
alias :cmd_del :cmd_rm
|
184
221
|
|
185
222
|
def cmd_download_help
|
@@ -188,7 +225,7 @@ class Console::CommandDispatcher::Stdapi::Fs
|
|
188
225
|
print_line "Downloads remote files and directories to the local machine."
|
189
226
|
print_line @@download_opts.usage
|
190
227
|
end
|
191
|
-
|
228
|
+
|
192
229
|
#
|
193
230
|
# Downloads a file or directory from the remote machine to the local
|
194
231
|
# machine.
|
@@ -246,7 +283,7 @@ class Console::CommandDispatcher::Stdapi::Fs
|
|
246
283
|
}
|
247
284
|
end
|
248
285
|
}
|
249
|
-
|
286
|
+
|
250
287
|
return true
|
251
288
|
end
|
252
289
|
|
@@ -307,6 +344,7 @@ class Console::CommandDispatcher::Stdapi::Fs
|
|
307
344
|
path = args[0] || client.fs.dir.getwd
|
308
345
|
tbl = Rex::Ui::Text::Table.new(
|
309
346
|
'Header' => "Listing: #{path}",
|
347
|
+
'SortIndex' => 4,
|
310
348
|
'Columns' =>
|
311
349
|
[
|
312
350
|
'Mode',
|
@@ -317,26 +355,31 @@ class Console::CommandDispatcher::Stdapi::Fs
|
|
317
355
|
])
|
318
356
|
|
319
357
|
items = 0
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
358
|
+
stat = client.fs.file.stat(path)
|
359
|
+
if stat.directory?
|
360
|
+
# Enumerate each item...
|
361
|
+
# No need to sort as Table will do it for us
|
362
|
+
client.fs.dir.entries_with_info(path).each { |p|
|
363
|
+
|
364
|
+
tbl <<
|
365
|
+
[
|
366
|
+
p['StatBuf'] ? p['StatBuf'].prettymode : '',
|
367
|
+
p['StatBuf'] ? p['StatBuf'].size : '',
|
368
|
+
p['StatBuf'] ? p['StatBuf'].ftype[0,3] : '',
|
369
|
+
p['StatBuf'] ? p['StatBuf'].mtime : '',
|
370
|
+
p['FileName'] || 'unknown'
|
371
|
+
]
|
372
|
+
|
373
|
+
items += 1
|
374
|
+
}
|
375
|
+
|
376
|
+
if (items > 0)
|
377
|
+
print("\n" + tbl.to_s + "\n")
|
378
|
+
else
|
379
|
+
print_line("No entries exist in #{path}")
|
380
|
+
end
|
338
381
|
else
|
339
|
-
print_line("
|
382
|
+
print_line("#{stat.prettymode} #{stat.size} #{stat.ftype[0,3]} #{stat.mtime} #{path}")
|
340
383
|
end
|
341
384
|
|
342
385
|
return true
|
@@ -444,7 +487,7 @@ class Console::CommandDispatcher::Stdapi::Fs
|
|
444
487
|
}
|
445
488
|
end
|
446
489
|
}
|
447
|
-
|
490
|
+
|
448
491
|
return true
|
449
492
|
end
|
450
493
|
|