librex 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +12 -0
- data/lib/rex.rb +0 -0
- data/lib/rex.rb.ts.rb +0 -0
- data/lib/rex/LICENSE +0 -0
- data/lib/rex/arch.rb +0 -0
- data/lib/rex/arch/sparc.rb +0 -0
- data/lib/rex/arch/sparc.rb.ut.rb +0 -0
- data/lib/rex/arch/x86.rb +0 -0
- data/lib/rex/arch/x86.rb.ut.rb +0 -0
- data/lib/rex/assembly/nasm.rb +0 -0
- data/lib/rex/assembly/nasm.rb.ut.rb +0 -0
- data/lib/rex/codepage.map +0 -0
- data/lib/rex/compat.rb +0 -0
- data/lib/rex/constants.rb +0 -0
- data/lib/rex/elfparsey.rb +0 -0
- data/lib/rex/elfparsey/elf.rb +0 -0
- data/lib/rex/elfparsey/elfbase.rb +2 -4
- data/lib/rex/elfparsey/exceptions.rb +0 -0
- data/lib/rex/elfscan.rb +0 -0
- data/lib/rex/elfscan/scanner.rb +0 -0
- data/lib/rex/elfscan/search.rb +10 -10
- data/lib/rex/encoder/alpha2.rb +0 -0
- data/lib/rex/encoder/alpha2/alpha_mixed.rb +0 -0
- data/lib/rex/encoder/alpha2/alpha_upper.rb +0 -0
- data/lib/rex/encoder/alpha2/generic.rb +0 -0
- data/lib/rex/encoder/alpha2/unicode_mixed.rb +0 -0
- data/lib/rex/encoder/alpha2/unicode_upper.rb +0 -0
- data/lib/rex/encoder/ndr.rb +0 -0
- data/lib/rex/encoder/ndr.rb.ut.rb +0 -0
- data/lib/rex/encoder/nonalpha.rb +0 -0
- data/lib/rex/encoder/nonupper.rb +0 -0
- data/lib/rex/encoder/xdr.rb +0 -0
- data/lib/rex/encoder/xdr.rb.ut.rb +0 -0
- data/lib/rex/encoder/xor.rb +0 -0
- data/lib/rex/encoder/xor/dword.rb +0 -0
- data/lib/rex/encoder/xor/dword_additive.rb +0 -0
- data/lib/rex/encoders/xor_dword.rb +0 -0
- data/lib/rex/encoders/xor_dword_additive.rb +0 -0
- data/lib/rex/encoders/xor_dword_additive.rb.ut.rb +0 -0
- data/lib/rex/encoding/xor.rb +0 -0
- data/lib/rex/encoding/xor.rb.ts.rb +0 -0
- data/lib/rex/encoding/xor/byte.rb +0 -0
- data/lib/rex/encoding/xor/byte.rb.ut.rb +0 -0
- data/lib/rex/encoding/xor/dword.rb +0 -0
- data/lib/rex/encoding/xor/dword.rb.ut.rb +0 -0
- data/lib/rex/encoding/xor/dword_additive.rb +0 -0
- data/lib/rex/encoding/xor/dword_additive.rb.ut.rb +0 -0
- data/lib/rex/encoding/xor/exceptions.rb +0 -0
- data/lib/rex/encoding/xor/generic.rb +0 -0
- data/lib/rex/encoding/xor/generic.rb.ut.rb +0 -0
- data/lib/rex/encoding/xor/qword.rb +0 -0
- data/lib/rex/encoding/xor/word.rb +0 -0
- data/lib/rex/encoding/xor/word.rb.ut.rb +0 -0
- data/lib/rex/exceptions.rb +0 -0
- data/lib/rex/exceptions.rb.ut.rb +0 -0
- data/lib/rex/exploitation/cmdstager.rb +0 -0
- data/lib/rex/exploitation/cmdstager/base.rb +6 -1
- data/lib/rex/exploitation/cmdstager/debug_asm.rb +0 -0
- data/lib/rex/exploitation/cmdstager/debug_write.rb +0 -0
- data/lib/rex/exploitation/cmdstager/tftp.rb +8 -8
- data/lib/rex/exploitation/cmdstager/vbs.rb +0 -0
- data/lib/rex/exploitation/egghunter.rb +143 -36
- data/lib/rex/exploitation/egghunter.rb.ut.rb +0 -0
- data/lib/rex/exploitation/encryptjs.rb +0 -0
- data/lib/rex/exploitation/heaplib.js.b64 +0 -0
- data/lib/rex/exploitation/heaplib.rb +0 -0
- data/lib/rex/exploitation/javascriptosdetect.rb +114 -15
- data/lib/rex/exploitation/obfuscatejs.rb +0 -0
- data/lib/rex/exploitation/omelet.rb +320 -0
- data/lib/rex/exploitation/omelet.rb.ut.rb +13 -0
- data/lib/rex/exploitation/opcodedb.rb +0 -0
- data/lib/rex/exploitation/opcodedb.rb.ut.rb +0 -0
- data/lib/rex/exploitation/seh.rb +0 -0
- data/lib/rex/exploitation/seh.rb.ut.rb +0 -0
- data/lib/rex/file.rb +1 -1
- data/lib/rex/file.rb.ut.rb +0 -0
- data/lib/rex/image_source.rb +0 -0
- data/lib/rex/image_source/disk.rb +0 -0
- data/lib/rex/image_source/image_source.rb +0 -0
- data/lib/rex/image_source/memory.rb +0 -0
- data/lib/rex/io/bidirectional_pipe.rb +0 -0
- data/lib/rex/io/datagram_abstraction.rb +0 -0
- data/lib/rex/io/stream.rb +1 -1
- data/lib/rex/io/stream_abstraction.rb +0 -0
- data/lib/rex/io/stream_server.rb +0 -0
- data/lib/rex/job_container.rb +0 -1
- data/lib/rex/logging.rb +0 -0
- data/lib/rex/logging/log_dispatcher.rb +0 -0
- data/lib/rex/logging/log_sink.rb +0 -0
- data/lib/rex/logging/sinks/flatfile.rb +0 -0
- data/lib/rex/logging/sinks/stderr.rb +0 -0
- data/lib/rex/machparsey.rb +0 -0
- data/lib/rex/machparsey/exceptions.rb +0 -0
- data/lib/rex/machparsey/machbase.rb +0 -0
- data/lib/rex/machscan.rb +0 -0
- data/lib/rex/machscan/scanner.rb +0 -0
- data/lib/rex/mime.rb +0 -0
- data/lib/rex/mime/header.rb +0 -0
- data/lib/rex/mime/message.rb +0 -0
- data/lib/rex/mime/part.rb +0 -0
- data/lib/rex/nop/opty2.rb +0 -0
- data/lib/rex/nop/opty2.rb.ut.rb +0 -0
- data/lib/rex/nop/opty2_tables.rb +0 -0
- data/lib/rex/ole.rb +0 -0
- data/lib/rex/ole/clsid.rb +0 -0
- data/lib/rex/ole/difat.rb +0 -0
- data/lib/rex/ole/directory.rb +0 -0
- data/lib/rex/ole/direntry.rb +0 -0
- data/lib/rex/ole/docs/dependencies.txt +8 -0
- data/lib/rex/ole/docs/references.txt +1 -0
- data/lib/rex/ole/fat.rb +0 -0
- data/lib/rex/ole/header.rb +3 -3
- data/lib/rex/ole/minifat.rb +0 -0
- data/lib/rex/ole/storage.rb +4 -4
- data/lib/rex/ole/stream.rb +0 -0
- data/lib/rex/ole/substorage.rb +0 -0
- data/lib/rex/ole/util.rb +0 -0
- data/lib/rex/parser/arguments.rb +0 -0
- data/lib/rex/parser/arguments.rb.ut.rb +0 -0
- data/lib/rex/parser/ini.rb +0 -0
- data/lib/rex/parser/ini.rb.ut.rb +0 -0
- data/lib/rex/parser/nexpose_xml.rb +0 -0
- data/lib/rex/parser/nmap_xml.rb +0 -0
- data/lib/rex/payloads.rb +0 -0
- data/lib/rex/payloads/win32.rb +0 -0
- data/lib/rex/payloads/win32/common.rb +0 -0
- data/lib/rex/payloads/win32/kernel.rb +0 -0
- data/lib/rex/payloads/win32/kernel/common.rb +0 -0
- data/lib/rex/payloads/win32/kernel/migration.rb +0 -0
- data/lib/rex/payloads/win32/kernel/recovery.rb +0 -0
- data/lib/rex/peparsey.rb +0 -0
- data/lib/rex/peparsey/exceptions.rb +0 -0
- data/lib/rex/peparsey/pe.rb +7 -1
- data/lib/rex/peparsey/pe_memdump.rb +0 -0
- data/lib/rex/peparsey/pebase.rb +27 -2
- data/lib/rex/peparsey/section.rb +0 -0
- data/lib/rex/pescan.rb +0 -0
- data/lib/rex/pescan/analyze.rb +0 -0
- data/lib/rex/pescan/scanner.rb +0 -0
- data/lib/rex/pescan/search.rb +0 -0
- data/lib/rex/platforms.rb +0 -0
- data/lib/rex/platforms/windows.rb +0 -0
- data/lib/rex/poly.rb +0 -0
- data/lib/rex/poly/block.rb +0 -0
- data/lib/rex/poly/register.rb +0 -0
- data/lib/rex/poly/register/x86.rb +0 -0
- data/lib/rex/post.rb +0 -0
- data/lib/rex/post/dir.rb +0 -0
- data/lib/rex/post/file.rb +0 -0
- data/lib/rex/post/file_stat.rb +0 -0
- data/lib/rex/post/gen.pl +0 -0
- data/lib/rex/post/io.rb +0 -0
- data/lib/rex/post/meterpreter.rb +0 -0
- data/lib/rex/post/meterpreter/channel.rb +0 -0
- data/lib/rex/post/meterpreter/channel_container.rb +0 -0
- data/lib/rex/post/meterpreter/channels/pool.rb +0 -0
- data/lib/rex/post/meterpreter/channels/pools/file.rb +0 -0
- data/lib/rex/post/meterpreter/channels/pools/stream_pool.rb +0 -0
- data/lib/rex/post/meterpreter/channels/stream.rb +0 -0
- data/lib/rex/post/meterpreter/client.rb +3 -0
- data/lib/rex/post/meterpreter/client_core.rb +0 -0
- data/lib/rex/post/meterpreter/dependencies.rb +0 -0
- data/lib/rex/post/meterpreter/extension.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/espia/espia.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/espia/tlv.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/incognito/incognito.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/incognito/tlv.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/networkpug/networkpug.rb +57 -0
- data/lib/rex/post/meterpreter/extensions/networkpug/tlv.rb +15 -0
- data/lib/rex/post/meterpreter/extensions/priv/fs.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/priv/passwd.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/priv/priv.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/priv/tlv.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/sniffer/sniffer.rb +2 -1
- data/lib/rex/post/meterpreter/extensions/sniffer/tlv.rb +12 -10
- data/lib/rex/post/meterpreter/extensions/stdapi/constants.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/fs/dir.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb +31 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/fs/file_stat.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/fs/io.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/net/config.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/net/interface.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/net/route.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_server_channel.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/{railgun → stdapi/railgun}/api_constants.rb +38106 -38105
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_advapi32.rb +1804 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_iphlpapi.rb +96 -0
- data/lib/rex/post/meterpreter/extensions/{railgun → stdapi/railgun/def}/def_kernel32.rb +3848 -3678
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_ntdll.rb +153 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_shell32.rb +21 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_user32.rb +3169 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_ws2_32.rb +599 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/model.rb +540 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/multicall.rb +308 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/railgun/railgun.rb +196 -0
- data/lib/rex/post/meterpreter/extensions/{railgun → stdapi/railgun}/tlv.rb +6 -9
- data/lib/rex/post/meterpreter/extensions/stdapi/stdapi.rb +5 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/config.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/event_log.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/event_log_subsystem/event_record.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/power.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/process.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/process_subsystem/image.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/process_subsystem/io.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/process_subsystem/memory.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/process_subsystem/thread.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/registry.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_key.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/registry_subsystem/registry_value.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/sys/thread.rb +0 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/tlv.rb +6 -0
- data/lib/rex/post/meterpreter/extensions/stdapi/ui.rb +0 -0
- data/lib/rex/post/meterpreter/inbound_packet_handler.rb +0 -0
- data/lib/rex/post/meterpreter/object_aliases.rb +0 -0
- data/lib/rex/post/meterpreter/packet.rb +23 -1
- data/lib/rex/post/meterpreter/packet_dispatcher.rb +13 -2
- data/lib/rex/post/meterpreter/packet_parser.rb +0 -0
- data/lib/rex/post/meterpreter/packet_response_waiter.rb +17 -10
- data/lib/rex/post/meterpreter/ui/console.rb +0 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher.rb +0 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb +12 -7
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/espia.rb +0 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/incognito.rb +0 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/networkpug.rb +221 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/priv.rb +0 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/priv/elevate.rb +0 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/priv/passwd.rb +0 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/priv/timestomp.rb +0 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/sniffer.rb +4 -3
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi.rb +0 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/fs.rb +56 -1
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb +22 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/sys.rb +0 -0
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/ui.rb +0 -0
- data/lib/rex/post/meterpreter/ui/console/interactive_channel.rb +0 -0
- data/lib/rex/post/permission.rb +0 -0
- data/lib/rex/post/process.rb +0 -0
- data/lib/rex/post/thread.rb +0 -0
- data/lib/rex/post/ui.rb +0 -0
- data/lib/rex/proto.rb +0 -0
- data/lib/rex/proto.rb.ts.rb +0 -0
- data/lib/rex/proto/dcerpc.rb +0 -0
- data/lib/rex/proto/dcerpc.rb.ts.rb +0 -0
- data/lib/rex/proto/dcerpc/client.rb +3 -1
- data/lib/rex/proto/dcerpc/exceptions.rb +0 -0
- data/lib/rex/proto/dcerpc/handle.rb +0 -0
- data/lib/rex/proto/dcerpc/handle.rb.ut.rb +0 -0
- data/lib/rex/proto/dcerpc/ndr.rb +0 -0
- data/lib/rex/proto/dcerpc/ndr.rb.ut.rb +0 -0
- data/lib/rex/proto/dcerpc/packet.rb +0 -0
- data/lib/rex/proto/dcerpc/packet.rb.ut.rb +0 -0
- data/lib/rex/proto/dcerpc/response.rb.ut.rb +0 -0
- data/lib/rex/proto/dcerpc/uuid.rb +0 -0
- data/lib/rex/proto/dcerpc/uuid.rb.ut.rb +0 -0
- data/lib/rex/proto/dhcp.rb +7 -0
- data/lib/rex/proto/dhcp/constants.rb +33 -0
- data/lib/rex/proto/dhcp/server.rb +285 -0
- data/lib/rex/proto/drda.rb +0 -0
- data/lib/rex/proto/drda.rb.ts.rb +0 -0
- data/lib/rex/proto/drda/constants.rb +0 -0
- data/lib/rex/proto/drda/constants.rb.ut.rb +0 -0
- data/lib/rex/proto/drda/packet.rb +0 -0
- data/lib/rex/proto/drda/packet.rb.ut.rb +0 -0
- data/lib/rex/proto/drda/utils.rb +0 -0
- data/lib/rex/proto/drda/utils.rb.ut.rb +0 -0
- data/lib/rex/proto/http.rb +0 -0
- data/lib/rex/proto/http.rb.ts.rb +0 -0
- data/lib/rex/proto/http/client.rb +27 -2
- data/lib/rex/proto/http/client.rb.ut.rb +4 -2
- data/lib/rex/proto/http/handler.rb +0 -0
- data/lib/rex/proto/http/handler/erb.rb +0 -0
- data/lib/rex/proto/http/handler/erb.rb.ut.rb +0 -0
- data/lib/rex/proto/http/handler/erb.rb.ut.rb.rhtml +0 -0
- data/lib/rex/proto/http/handler/proc.rb +6 -0
- data/lib/rex/proto/http/handler/proc.rb.ut.rb +0 -0
- data/lib/rex/proto/http/header.rb +0 -0
- data/lib/rex/proto/http/header.rb.ut.rb +0 -0
- data/lib/rex/proto/http/packet.rb +20 -19
- data/lib/rex/proto/http/packet.rb.ut.rb +0 -0
- data/lib/rex/proto/http/request.rb +0 -0
- data/lib/rex/proto/http/request.rb.ut.rb +0 -0
- data/lib/rex/proto/http/response.rb +0 -0
- data/lib/rex/proto/http/response.rb.ut.rb +0 -0
- data/lib/rex/proto/http/server.rb +5 -3
- data/lib/rex/proto/http/server.rb.ut.rb +0 -0
- data/lib/rex/proto/proxy/socks4a.rb +440 -0
- data/lib/rex/proto/smb.rb +0 -0
- data/lib/rex/proto/smb.rb.ts.rb +0 -0
- data/lib/rex/proto/smb/client.rb +110 -61
- data/lib/rex/proto/smb/client.rb.ut.rb +0 -0
- data/lib/rex/proto/smb/constants.rb +5 -3
- data/lib/rex/proto/smb/constants.rb.ut.rb +0 -0
- data/lib/rex/proto/smb/crypt.rb +0 -0
- data/lib/rex/proto/smb/crypt.rb.ut.rb +0 -0
- data/lib/rex/proto/smb/exceptions.rb +0 -0
- data/lib/rex/proto/smb/simpleclient.rb +0 -0
- data/lib/rex/proto/smb/simpleclient.rb.ut.rb +0 -0
- data/lib/rex/proto/smb/utils.rb +2 -0
- data/lib/rex/proto/smb/utils.rb.ut.rb +0 -0
- data/lib/rex/proto/sunrpc.rb +0 -0
- data/lib/rex/proto/sunrpc/client.rb +0 -0
- data/lib/rex/proto/tftp.rb +10 -1
- data/lib/rex/proto/tftp/constants.rb +5 -3
- data/lib/rex/proto/tftp/server.rb +79 -9
- data/lib/rex/script.rb +0 -0
- data/lib/rex/script/base.rb +0 -0
- data/lib/rex/script/meterpreter.rb +0 -0
- data/lib/rex/script/shell.rb +0 -0
- data/lib/rex/service.rb +0 -0
- data/lib/rex/service_manager.rb +0 -0
- data/lib/rex/service_manager.rb.ut.rb +0 -0
- data/lib/rex/services/local_relay.rb +0 -0
- data/lib/rex/socket.rb +6 -4
- data/lib/rex/socket.rb.ut.rb +0 -0
- data/lib/rex/socket/comm.rb +0 -0
- data/lib/rex/socket/comm/local.rb +0 -0
- data/lib/rex/socket/comm/local.rb.ut.rb +0 -0
- data/lib/rex/socket/ip.rb +0 -0
- data/lib/rex/socket/parameters.rb +0 -0
- data/lib/rex/socket/parameters.rb.ut.rb +0 -0
- data/lib/rex/socket/range_walker.rb +0 -0
- data/lib/rex/socket/range_walker.rb.ut.rb +0 -0
- data/lib/rex/socket/ssl_tcp.rb +1 -1
- data/lib/rex/socket/ssl_tcp.rb.ut.rb +0 -0
- data/lib/rex/socket/ssl_tcp_server.rb +0 -0
- data/lib/rex/socket/ssl_tcp_server.rb.ut.rb +0 -0
- data/lib/rex/socket/subnet_walker.rb +0 -0
- data/lib/rex/socket/subnet_walker.rb.ut.rb +0 -0
- data/lib/rex/socket/switch_board.rb.ut.rb +0 -0
- data/lib/rex/socket/tcp.rb +0 -0
- data/lib/rex/socket/tcp.rb.ut.rb +0 -0
- data/lib/rex/socket/tcp_server.rb +0 -0
- data/lib/rex/socket/tcp_server.rb.ut.rb +0 -0
- data/lib/rex/socket/udp.rb +0 -0
- data/lib/rex/socket/udp.rb.ut.rb +0 -0
- data/lib/rex/struct2.rb +0 -0
- data/lib/rex/struct2/c_struct.rb +0 -0
- data/lib/rex/struct2/c_struct_template.rb +0 -0
- data/lib/rex/struct2/constant.rb +0 -0
- data/lib/rex/struct2/element.rb +0 -0
- data/lib/rex/struct2/generic.rb +0 -0
- data/lib/rex/struct2/restraint.rb +0 -0
- data/lib/rex/struct2/s_string.rb +0 -0
- data/lib/rex/struct2/s_struct.rb +0 -0
- data/lib/rex/sync.rb +0 -0
- data/lib/rex/sync/event.rb +0 -0
- data/lib/rex/sync/read_write_lock.rb +0 -0
- data/lib/rex/sync/ref.rb +0 -0
- data/lib/rex/sync/thread_safe.rb +0 -0
- data/lib/rex/test.rb +0 -0
- data/lib/rex/text.rb +13 -3
- data/lib/rex/text.rb.ut.rb +9 -4
- data/lib/rex/time.rb +0 -0
- data/lib/rex/transformer.rb +0 -0
- data/lib/rex/transformer.rb.ut.rb +0 -0
- data/lib/rex/ui.rb +0 -0
- data/lib/rex/ui/interactive.rb +0 -0
- data/lib/rex/ui/output.rb +0 -0
- data/lib/rex/ui/output/none.rb +0 -0
- data/lib/rex/ui/progress_tracker.rb +0 -0
- data/lib/rex/ui/subscriber.rb +0 -0
- data/lib/rex/ui/text/color.rb +0 -0
- data/lib/rex/ui/text/color.rb.ut.rb +0 -0
- data/lib/rex/ui/text/dispatcher_shell.rb +0 -0
- data/lib/rex/ui/text/input.rb +0 -0
- data/lib/rex/ui/text/input/buffer.rb +0 -0
- data/lib/rex/ui/text/input/readline.rb +0 -0
- data/lib/rex/ui/text/input/socket.rb +0 -0
- data/lib/rex/ui/text/input/stdio.rb +0 -0
- data/lib/rex/ui/text/irb_shell.rb +0 -0
- data/lib/rex/ui/text/output.rb +0 -0
- data/lib/rex/ui/text/output/buffer.rb +0 -0
- data/lib/rex/ui/text/output/file.rb +0 -0
- data/lib/rex/ui/text/output/socket.rb +0 -0
- data/lib/rex/ui/text/output/stdio.rb +0 -0
- data/lib/rex/ui/text/progress_tracker.rb +0 -0
- data/lib/rex/ui/text/progress_tracker.rb.ut.rb +0 -0
- data/lib/rex/ui/text/shell.rb +9 -6
- data/lib/rex/ui/text/table.rb +5 -0
- data/lib/rex/ui/text/table.rb.ut.rb +0 -0
- data/lib/rex/zip.rb +0 -0
- data/lib/rex/zip/archive.rb +29 -1
- data/lib/rex/zip/blocks.rb +0 -0
- data/lib/rex/zip/entry.rb +5 -1
- metadata +369 -413
- data/README +0 -8
- data/lib/rex/post/meterpreter/extensions/railgun/api.rb +0 -9303
- data/lib/rex/post/meterpreter/extensions/railgun/railgun.rb +0 -815
- data/lib/rex/post/meterpreter/ui/console/command_dispatcher/railgun.rb +0 -57
@@ -26,6 +26,7 @@ module Rex
|
|
26
26
|
module Post
|
27
27
|
module Meterpreter
|
28
28
|
module Extensions
|
29
|
+
module Stdapi
|
29
30
|
module Railgun
|
30
31
|
|
31
32
|
TLV_TYPE_EXTENSION_RAILGUN = 0
|
@@ -36,19 +37,15 @@ TLV_TYPE_RAILGUN_BUFFERBLOB_INOUT = TLV_META_TYPE_RAW | (TLV_TYPE_EXTENSION_R
|
|
36
37
|
|
37
38
|
TLV_TYPE_RAILGUN_BACK_BUFFERBLOB_OUT = TLV_META_TYPE_RAW | (TLV_TYPE_EXTENSION_RAILGUN + TLV_EXTENSIONS + 5)
|
38
39
|
TLV_TYPE_RAILGUN_BACK_BUFFERBLOB_INOUT = TLV_META_TYPE_RAW | (TLV_TYPE_EXTENSION_RAILGUN + TLV_EXTENSIONS + 6)
|
39
|
-
TLV_TYPE_RAILGUN_BACK_RET =
|
40
|
+
TLV_TYPE_RAILGUN_BACK_RET = TLV_META_TYPE_QWORD | (TLV_TYPE_EXTENSION_RAILGUN + TLV_EXTENSIONS + 7)
|
40
41
|
TLV_TYPE_RAILGUN_BACK_ERR = TLV_META_TYPE_UINT | (TLV_TYPE_EXTENSION_RAILGUN + TLV_EXTENSIONS + 8)
|
41
42
|
|
42
43
|
TLV_TYPE_RAILGUN_DLLNAME = TLV_META_TYPE_STRING | (TLV_TYPE_EXTENSION_RAILGUN + TLV_EXTENSIONS + 9)
|
43
44
|
TLV_TYPE_RAILGUN_FUNCNAME = TLV_META_TYPE_STRING | (TLV_TYPE_EXTENSION_RAILGUN + TLV_EXTENSIONS + 10)
|
44
45
|
TLV_TYPE_RAILGUN_MULTI_GROUP = TLV_META_TYPE_GROUP | (TLV_TYPE_EXTENSION_RAILGUN + TLV_EXTENSIONS + 11)
|
45
46
|
|
47
|
+
TLV_TYPE_RAILGUN_MEM_ADDRESS = TLV_META_TYPE_QWORD | (TLV_TYPE_EXTENSION_RAILGUN + TLV_EXTENSIONS + 12 )
|
48
|
+
TLV_TYPE_RAILGUN_MEM_DATA = TLV_META_TYPE_RAW | (TLV_TYPE_EXTENSION_RAILGUN + TLV_EXTENSIONS + 13 )
|
49
|
+
TLV_TYPE_RAILGUN_MEM_LENGTH = TLV_META_TYPE_UINT | (TLV_TYPE_EXTENSION_RAILGUN + TLV_EXTENSIONS + 14 )
|
46
50
|
|
47
|
-
|
48
|
-
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
51
|
+
end; end; end; end; end; end
|
@@ -14,6 +14,7 @@ require 'rex/post/meterpreter/extensions/stdapi/sys/process'
|
|
14
14
|
require 'rex/post/meterpreter/extensions/stdapi/sys/registry'
|
15
15
|
require 'rex/post/meterpreter/extensions/stdapi/sys/event_log'
|
16
16
|
require 'rex/post/meterpreter/extensions/stdapi/sys/power'
|
17
|
+
require 'rex/post/meterpreter/extensions/stdapi/railgun/railgun'
|
17
18
|
require 'rex/post/meterpreter/extensions/stdapi/ui'
|
18
19
|
|
19
20
|
module Rex
|
@@ -69,6 +70,10 @@ class Stdapi < Extension
|
|
69
70
|
'socket' => Rex::Post::Meterpreter::Extensions::Stdapi::Net::Socket.new(client)
|
70
71
|
})
|
71
72
|
},
|
73
|
+
{
|
74
|
+
'name' => 'railgun',
|
75
|
+
'ext' => Rex::Post::Meterpreter::Extensions::Stdapi::Railgun::Railgun.new(client)
|
76
|
+
},
|
72
77
|
{
|
73
78
|
'name' => 'ui',
|
74
79
|
'ext' => UI.new(client)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -28,8 +28,14 @@ TLV_TYPE_DIRECTORY_PATH = TLV_META_TYPE_STRING | 1200
|
|
28
28
|
TLV_TYPE_FILE_NAME = TLV_META_TYPE_STRING | 1201
|
29
29
|
TLV_TYPE_FILE_PATH = TLV_META_TYPE_STRING | 1202
|
30
30
|
TLV_TYPE_FILE_MODE = TLV_META_TYPE_STRING | 1203
|
31
|
+
TLV_TYPE_FILE_SIZE = TLV_META_TYPE_UINT | 1204
|
32
|
+
|
31
33
|
TLV_TYPE_STAT_BUF = TLV_META_TYPE_COMPLEX | 1220
|
32
34
|
|
35
|
+
TLV_TYPE_SEARCH_RECURSE = TLV_META_TYPE_BOOL | 1230
|
36
|
+
TLV_TYPE_SEARCH_GLOB = TLV_META_TYPE_STRING | 1231
|
37
|
+
TLV_TYPE_SEARCH_ROOT = TLV_META_TYPE_STRING | 1232
|
38
|
+
TLV_TYPE_SEARCH_RESULTS = TLV_META_TYPE_GROUP | 1233
|
33
39
|
##
|
34
40
|
#
|
35
41
|
# Net
|
File without changes
|
File without changes
|
File without changes
|
@@ -20,6 +20,7 @@ TLV_META_TYPE_STRING = (1 << 16)
|
|
20
20
|
TLV_META_TYPE_UINT = (1 << 17)
|
21
21
|
TLV_META_TYPE_RAW = (1 << 18)
|
22
22
|
TLV_META_TYPE_BOOL = (1 << 19)
|
23
|
+
TLV_META_TYPE_QWORD = (1 << 20)
|
23
24
|
TLV_META_TYPE_COMPRESSED = (1 << 29)
|
24
25
|
TLV_META_TYPE_GROUP = (1 << 30)
|
25
26
|
TLV_META_TYPE_COMPLEX = (1 << 31)
|
@@ -31,6 +32,7 @@ TLV_META_MASK = (
|
|
31
32
|
TLV_META_TYPE_UINT |
|
32
33
|
TLV_META_TYPE_RAW |
|
33
34
|
TLV_META_TYPE_BOOL |
|
35
|
+
TLV_META_TYPE_QWORD |
|
34
36
|
TLV_META_TYPE_GROUP |
|
35
37
|
TLV_META_TYPE_COMPLEX
|
36
38
|
)
|
@@ -132,6 +134,7 @@ class Tlv
|
|
132
134
|
when TLV_META_TYPE_UINT; "INT"
|
133
135
|
when TLV_META_TYPE_RAW; "RAW"
|
134
136
|
when TLV_META_TYPE_BOOL; "BOOL"
|
137
|
+
when TLV_META_TYPE_QWORD; "QWORD"
|
135
138
|
when TLV_META_TYPE_GROUP; "GROUP"
|
136
139
|
when TLV_META_TYPE_COMPLEX; "COMPLEX"
|
137
140
|
else; 'unknown-meta-type'
|
@@ -214,7 +217,7 @@ class Tlv
|
|
214
217
|
# Serializers
|
215
218
|
#
|
216
219
|
##
|
217
|
-
|
220
|
+
|
218
221
|
#
|
219
222
|
# Converts the TLV to raw.
|
220
223
|
#
|
@@ -225,6 +228,8 @@ class Tlv
|
|
225
228
|
raw += "\x00"
|
226
229
|
elsif (self.type & TLV_META_TYPE_UINT == TLV_META_TYPE_UINT)
|
227
230
|
raw = [value].pack("N")
|
231
|
+
elsif (self.type & TLV_META_TYPE_QWORD == TLV_META_TYPE_QWORD)
|
232
|
+
raw = [ self.htonq( value.to_i ) ].pack("Q")
|
228
233
|
elsif (self.type & TLV_META_TYPE_BOOL == TLV_META_TYPE_BOOL)
|
229
234
|
if (value == true)
|
230
235
|
raw = [1].pack("c")
|
@@ -284,6 +289,9 @@ class Tlv
|
|
284
289
|
end
|
285
290
|
elsif (self.type & TLV_META_TYPE_UINT == TLV_META_TYPE_UINT)
|
286
291
|
self.value = raw.unpack("NNN")[2]
|
292
|
+
elsif (self.type & TLV_META_TYPE_QWORD == TLV_META_TYPE_QWORD)
|
293
|
+
self.value = raw.unpack("NNQ")[2]
|
294
|
+
self.value = self.ntohq( self.value )
|
287
295
|
elsif (self.type & TLV_META_TYPE_BOOL == TLV_META_TYPE_BOOL)
|
288
296
|
self.value = raw.unpack("NNc")[2]
|
289
297
|
|
@@ -298,6 +306,20 @@ class Tlv
|
|
298
306
|
|
299
307
|
return length;
|
300
308
|
end
|
309
|
+
|
310
|
+
protected
|
311
|
+
|
312
|
+
def htonq( value )
|
313
|
+
if( [1].pack( 's' ) == [1].pack( 'n' ) )
|
314
|
+
return value
|
315
|
+
end
|
316
|
+
return [ value ].pack( 'Q' ).reverse.unpack( 'Q' ).first
|
317
|
+
end
|
318
|
+
|
319
|
+
def ntohq( value )
|
320
|
+
return htonq( value )
|
321
|
+
end
|
322
|
+
|
301
323
|
end
|
302
324
|
|
303
325
|
###
|
@@ -58,7 +58,18 @@ module PacketDispatcher
|
|
58
58
|
raw = packet.to_r
|
59
59
|
|
60
60
|
if (raw)
|
61
|
-
|
61
|
+
begin
|
62
|
+
bytes = self.sock.write(raw)
|
63
|
+
rescue ::Exception => e
|
64
|
+
# Mark the session itself as dead
|
65
|
+
self.alive = false
|
66
|
+
|
67
|
+
# Indicate that the dispatcher should shut down too
|
68
|
+
@finish = true
|
69
|
+
|
70
|
+
# Reraise the error to the top-level caller
|
71
|
+
raise e
|
72
|
+
end
|
62
73
|
end
|
63
74
|
|
64
75
|
return bytes
|
@@ -129,7 +140,7 @@ module PacketDispatcher
|
|
129
140
|
|
130
141
|
# Spawn a thread for receiving packets
|
131
142
|
self.receiver_thread = ::Thread.new do
|
132
|
-
while (
|
143
|
+
while (self.alive)
|
133
144
|
begin
|
134
145
|
rv = Rex::ThreadSafe.select([ self.sock.fd ], nil, nil, 0.25)
|
135
146
|
ping_time = 60
|
File without changes
|
@@ -27,7 +27,19 @@ class PacketResponseWaiter
|
|
27
27
|
self.completion_routine = completion_routine
|
28
28
|
self.completion_param = completion_param
|
29
29
|
else
|
30
|
-
self.done
|
30
|
+
self.done = false
|
31
|
+
self.wthread = initialize_waiter_thread
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
#
|
36
|
+
# Create an idle thread we can wait on
|
37
|
+
#
|
38
|
+
def initialize_waiter_thread
|
39
|
+
::Thread.new do
|
40
|
+
while (! self.done)
|
41
|
+
::IO.select(nil,nil,nil,5.0)
|
42
|
+
end
|
31
43
|
end
|
32
44
|
end
|
33
45
|
|
@@ -49,6 +61,7 @@ class PacketResponseWaiter
|
|
49
61
|
self.completion_routine.call(response, self.completion_param)
|
50
62
|
else
|
51
63
|
self.done = true
|
64
|
+
self.wthread.kill
|
52
65
|
end
|
53
66
|
end
|
54
67
|
|
@@ -58,16 +71,10 @@ class PacketResponseWaiter
|
|
58
71
|
#
|
59
72
|
def wait(interval)
|
60
73
|
if( interval and interval == -1 )
|
61
|
-
|
62
|
-
::IO.select(nil, nil, nil, 0.1)
|
63
|
-
end
|
74
|
+
self.wthread.join
|
64
75
|
else
|
65
76
|
begin
|
66
|
-
Timeout.timeout(interval) {
|
67
|
-
while(not self.done)
|
68
|
-
::IO.select(nil, nil, nil, 0.1)
|
69
|
-
end
|
70
|
-
}
|
77
|
+
Timeout.timeout(interval) { self.wthread.join }
|
71
78
|
rescue Timeout::Error
|
72
79
|
self.response = nil
|
73
80
|
end
|
@@ -75,7 +82,7 @@ class PacketResponseWaiter
|
|
75
82
|
return self.response
|
76
83
|
end
|
77
84
|
|
78
|
-
attr_accessor :rid, :done, :response # :nodoc:
|
85
|
+
attr_accessor :rid, :done, :response, :wthread # :nodoc:
|
79
86
|
attr_accessor :completion_routine, :completion_param # :nodoc:
|
80
87
|
end
|
81
88
|
|
File without changes
|
File without changes
|
@@ -354,18 +354,23 @@ class Console::CommandDispatcher::Core
|
|
354
354
|
end
|
355
355
|
|
356
356
|
def cmd_run_tabs(str, words)
|
357
|
+
tabs = []
|
357
358
|
if(not words[1] or not words[1].match(/^\//))
|
358
359
|
begin
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
360
|
+
[
|
361
|
+
::Msf::Sessions::Meterpreter::ScriptBase,
|
362
|
+
::Msf::Sessions::Meterpreter::UserScriptBase
|
363
|
+
].each do |dir|
|
364
|
+
next if not ::File.exist? dir
|
365
|
+
tabs += ::Dir.new(dir).find_all { |e|
|
366
|
+
path = dir + ::File::SEPARATOR + e
|
367
|
+
::File.file?(path) and ::File.readable?(path)
|
368
|
+
}
|
369
|
+
end
|
366
370
|
rescue Exception
|
367
371
|
end
|
368
372
|
end
|
373
|
+
return tabs.map { |e| e.sub!(/\.rb$/, '') }
|
369
374
|
end
|
370
375
|
|
371
376
|
|
File without changes
|
File without changes
|
@@ -0,0 +1,221 @@
|
|
1
|
+
require 'rex/post/meterpreter'
|
2
|
+
|
3
|
+
module Rex
|
4
|
+
module Post
|
5
|
+
module Meterpreter
|
6
|
+
module Ui
|
7
|
+
|
8
|
+
# Rex::Ui::Text::IrbShell.new(binding).run
|
9
|
+
|
10
|
+
class Console::CommandDispatcher::NetworkPug
|
11
|
+
|
12
|
+
Klass = Console::CommandDispatcher::NetworkPug
|
13
|
+
|
14
|
+
include Console::CommandDispatcher
|
15
|
+
|
16
|
+
@@options = Rex::Parser::Arguments.new(
|
17
|
+
"-i" => [ true, "Interface on remote machine to listen on" ],
|
18
|
+
"-f" => [ true, "Additional pcap filtering mechanism" ],
|
19
|
+
"-v" => [ false, "Virtual NIC (packets only for your TAP dev locally)" ]
|
20
|
+
)
|
21
|
+
|
22
|
+
def initialize(shell)
|
23
|
+
@thread_stuff = nil
|
24
|
+
@tapdev = nil
|
25
|
+
@channel = nil
|
26
|
+
|
27
|
+
super
|
28
|
+
end
|
29
|
+
|
30
|
+
attr_accessor :thread_stuff
|
31
|
+
attr_accessor :tapdev
|
32
|
+
attr_accessor :channel
|
33
|
+
|
34
|
+
|
35
|
+
#
|
36
|
+
# List of supported commands.
|
37
|
+
#
|
38
|
+
def commands
|
39
|
+
{
|
40
|
+
"networkpug_start" => "Start slinging packets between hosts",
|
41
|
+
"networkpug_stop" => "Stop slinging packets between hosts",
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
def setup_tapdev
|
46
|
+
# XXX, look at how to use windows equivilient and include
|
47
|
+
|
48
|
+
tapdev = ::File.open("/dev/net/tun", "wb+")
|
49
|
+
|
50
|
+
0.upto(16) { |idx|
|
51
|
+
name = "npug#{idx}"
|
52
|
+
|
53
|
+
ifreq = [ name, 0x1000 | 0x02, "" ].pack("a16va14")
|
54
|
+
|
55
|
+
begin
|
56
|
+
tapdev.ioctl(0x400454ca, ifreq) # is there a better way than hex constant
|
57
|
+
rescue Errno::EBUSY
|
58
|
+
next
|
59
|
+
end
|
60
|
+
|
61
|
+
ifreq = [ name ].pack("a32")
|
62
|
+
|
63
|
+
tapdev.ioctl(0x8927, ifreq)
|
64
|
+
|
65
|
+
# print_line(Rex::Text.hexify(ifreq))
|
66
|
+
|
67
|
+
mac = sprintf("%02x:%02x:%02x:%02x:%02x:%02x", ifreq[18], ifreq[19], ifreq[20], ifreq[21], ifreq[22], ifreq[23])
|
68
|
+
|
69
|
+
return tapdev, name, mac
|
70
|
+
}
|
71
|
+
|
72
|
+
tapdev.close()
|
73
|
+
return nil, nil, nil
|
74
|
+
end
|
75
|
+
|
76
|
+
def proxy_packets()
|
77
|
+
while 1
|
78
|
+
# Ghetto :\
|
79
|
+
|
80
|
+
sd = Rex::ThreadSafe.select([ @channel.lsock, @tapdev ], nil, nil)
|
81
|
+
|
82
|
+
sd[0].each { |s|
|
83
|
+
if(s == @channel.lsock) # Packet from remote host to local TAP dev
|
84
|
+
len = @channel.lsock.read(2)
|
85
|
+
len = len.unpack('n')[0]
|
86
|
+
|
87
|
+
#print_line("Got #{len} bytes from remote host's network")
|
88
|
+
|
89
|
+
if(len > 1514 or len == 0)
|
90
|
+
@tapdev.close()
|
91
|
+
print_line("length is invalid .. #{len} ?, de-synchronized ? ")
|
92
|
+
end
|
93
|
+
|
94
|
+
packet = @channel.lsock.read(len)
|
95
|
+
|
96
|
+
print_line("packet from remote host:\n" + Rex::Text.hexify(packet))
|
97
|
+
|
98
|
+
@tapdev.syswrite(packet)
|
99
|
+
|
100
|
+
elsif(s == @tapdev)
|
101
|
+
# Packet from tapdev to remote host network
|
102
|
+
|
103
|
+
packet = @tapdev.sysread(1514)
|
104
|
+
|
105
|
+
print_line("packet to remote host:\n" + Rex::Text.hexify(packet))
|
106
|
+
|
107
|
+
@channel.write(packet)
|
108
|
+
end
|
109
|
+
} if(sd)
|
110
|
+
|
111
|
+
if(not sd)
|
112
|
+
print_line("hmmm. ")
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def cmd_networkpug_start(*args)
|
118
|
+
# PKS - I suck at ruby ;\
|
119
|
+
|
120
|
+
virtual_nic = false
|
121
|
+
filter = nil
|
122
|
+
interface = nil
|
123
|
+
|
124
|
+
if(args.length == 0)
|
125
|
+
args.unshift("-h")
|
126
|
+
end
|
127
|
+
|
128
|
+
@@options.parse(args) { |opt, idx, val|
|
129
|
+
# print_line("before: #{opt} #{idx} #{val} || virtual nic: #{virtual_nic}, filter: #{filter}, interface: #{interface}")
|
130
|
+
case opt
|
131
|
+
when "-v"
|
132
|
+
virtual_nic = true
|
133
|
+
|
134
|
+
when "-f"
|
135
|
+
filter = val
|
136
|
+
|
137
|
+
when "-i"
|
138
|
+
interface = val
|
139
|
+
|
140
|
+
when "-h"
|
141
|
+
print_error("Usage: networkpug_start -i interface [options]")
|
142
|
+
print_error("")
|
143
|
+
print_error(@@options.usage)
|
144
|
+
end
|
145
|
+
# print_line("after: #{opt} #{idx} #{val} || virtual nic: #{virtual_nic}, filter: #{filter}, interface: #{interface}")
|
146
|
+
|
147
|
+
}
|
148
|
+
|
149
|
+
if (interface == nil)
|
150
|
+
print_error("Usage: networkpug_start -i interface [options]")
|
151
|
+
print_error("")
|
152
|
+
print_error(@@options.usage)
|
153
|
+
return
|
154
|
+
end
|
155
|
+
|
156
|
+
@tapdev, tapname, mac = setup_tapdev
|
157
|
+
|
158
|
+
if(@tapdev == nil)
|
159
|
+
print_status("Failed to create tapdev")
|
160
|
+
return
|
161
|
+
end
|
162
|
+
|
163
|
+
# PKS, we should implement multiple filter strings and let the
|
164
|
+
# remote host build it properly.
|
165
|
+
# not (our conn) and (virtual nic filter) and (custom filter)
|
166
|
+
# print_line("before virtual, filter is #{filter}")
|
167
|
+
|
168
|
+
if(filter == nil and virtual_nic == true)
|
169
|
+
filter = "ether host #{mac}"
|
170
|
+
elsif(filter != nil and virtual_nic == true)
|
171
|
+
filter += " and ether host #{mac}"
|
172
|
+
#print_line("Adjusted filter is #{filter}")
|
173
|
+
end
|
174
|
+
|
175
|
+
print_line("#{tapname} created with a hwaddr of #{mac}, ctrl-c when done")
|
176
|
+
|
177
|
+
response, @channel = client.networkpug.networkpug_start(interface, filter)
|
178
|
+
|
179
|
+
if(@channel)
|
180
|
+
@thread_stuff = ::Thread.new {
|
181
|
+
proxy_packets()
|
182
|
+
}
|
183
|
+
|
184
|
+
print_line("Packet slinger for #{interface} has a thread structure of #{@thread_stuff}")
|
185
|
+
end
|
186
|
+
|
187
|
+
return true
|
188
|
+
end
|
189
|
+
|
190
|
+
def cmd_networkpug_stop(*args)
|
191
|
+
interface = args[0]
|
192
|
+
if (interface == nil)
|
193
|
+
print_error("Usage: networkpug_stop [interface]")
|
194
|
+
return
|
195
|
+
end
|
196
|
+
|
197
|
+
if(@thread_stuff)
|
198
|
+
::Thread.kill(@thread_stuff)
|
199
|
+
::Thread.join(@thread_stuff)
|
200
|
+
|
201
|
+
@thread_stuff = nil
|
202
|
+
|
203
|
+
@channel.close
|
204
|
+
@tapdev.close
|
205
|
+
end
|
206
|
+
|
207
|
+
client.networkpug.networkpug_stop(interface)
|
208
|
+
print_status("Packet slinging stopped on #{interface}")
|
209
|
+
return true
|
210
|
+
end
|
211
|
+
|
212
|
+
def name
|
213
|
+
"NetworkPug"
|
214
|
+
end
|
215
|
+
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|