librex 0.0.4 → 0.0.5
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.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
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -58,13 +58,14 @@ class Console::CommandDispatcher::Sniffer
|
|
|
58
58
|
def cmd_sniffer_start(*args)
|
|
59
59
|
intf = args[0].to_i
|
|
60
60
|
if (intf == 0)
|
|
61
|
-
print_error("Usage: sniffer_start [interface-id] [packet-buffer (1-200000)]")
|
|
61
|
+
print_error("Usage: sniffer_start [interface-id] [packet-buffer (1-200000)] [bpf filter (posix meterpreter only)]")
|
|
62
62
|
return
|
|
63
63
|
end
|
|
64
64
|
maxp = args[1].to_i
|
|
65
65
|
maxp = 50000 if maxp == 0
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
filter = args[2..-1].join(" ")
|
|
67
|
+
|
|
68
|
+
client.sniffer.capture_start(intf, maxp, filter)
|
|
68
69
|
print_status("Capture started on interface #{intf} (#{maxp} packet buffer)")
|
|
69
70
|
return true
|
|
70
71
|
end
|
|
File without changes
|
|
@@ -47,7 +47,8 @@ class Console::CommandDispatcher::Stdapi::Fs
|
|
|
47
47
|
"getlwd" => "Print local working directory",
|
|
48
48
|
"lpwd" => "Print local working directory",
|
|
49
49
|
"rm" => "Delete the specified file",
|
|
50
|
-
"del"
|
|
50
|
+
"del" => "Delete the specified file",
|
|
51
|
+
"search" => "Search for files"
|
|
51
52
|
}
|
|
52
53
|
end
|
|
53
54
|
|
|
@@ -58,6 +59,60 @@ class Console::CommandDispatcher::Stdapi::Fs
|
|
|
58
59
|
"Stdapi: File system"
|
|
59
60
|
end
|
|
60
61
|
|
|
62
|
+
#
|
|
63
|
+
# Search for files.
|
|
64
|
+
#
|
|
65
|
+
def cmd_search( *args )
|
|
66
|
+
|
|
67
|
+
root = nil
|
|
68
|
+
glob = nil
|
|
69
|
+
recurse = true
|
|
70
|
+
|
|
71
|
+
opts = Rex::Parser::Arguments.new(
|
|
72
|
+
"-h" => [ false, "Help Banner." ],
|
|
73
|
+
"-d" => [ true, "The directory/drive to begin searching from. Leave empty to search all drives. (Default: #{root})" ],
|
|
74
|
+
"-f" => [ true, "The file pattern glob to search for. (e.g. *secret*.doc?)" ],
|
|
75
|
+
"-r" => [ true, "Recursivly search sub directories. (Default: #{recurse})" ]
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
opts.parse(args) { | opt, idx, val |
|
|
79
|
+
case opt
|
|
80
|
+
when "-h"
|
|
81
|
+
print_line( "Usage: search [-d dir] [-r recurse] -f pattern" )
|
|
82
|
+
print_line( "Search for files." )
|
|
83
|
+
print_line( opts.usage )
|
|
84
|
+
return
|
|
85
|
+
when "-d"
|
|
86
|
+
root = val
|
|
87
|
+
when "-f"
|
|
88
|
+
glob = val
|
|
89
|
+
when "-r"
|
|
90
|
+
recurse = false if( val =~ /^(f|n|0)/i )
|
|
91
|
+
end
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if( not glob )
|
|
95
|
+
print_error( "You must specify a valid file glob to search for, e.g. >search -f *.doc" )
|
|
96
|
+
return
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
files = client.fs.file.search( root, glob, recurse )
|
|
100
|
+
|
|
101
|
+
if( not files.empty? )
|
|
102
|
+
print_line( "Found #{files.length} result#{ files.length > 1 ? 's' : '' }..." )
|
|
103
|
+
files.each do | file |
|
|
104
|
+
if( file['size'] > 0 )
|
|
105
|
+
print( " #{file['path']}#{ file['path'].empty? ? '' : '\\' }#{file['name']} (#{file['size']} bytes)\n" )
|
|
106
|
+
else
|
|
107
|
+
print( " #{file['path']}#{ file['path'].empty? ? '' : '\\' }#{file['name']}\n" )
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
else
|
|
111
|
+
print_line( "No files matching your search were found." )
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
end
|
|
115
|
+
|
|
61
116
|
#
|
|
62
117
|
# Reads the contents of a file and prints them to the screen.
|
|
63
118
|
#
|
|
@@ -134,10 +134,32 @@ class Console::CommandDispatcher::Stdapi::Net
|
|
|
134
134
|
print("\n" + tbl.to_s + "\n")
|
|
135
135
|
end
|
|
136
136
|
when "add"
|
|
137
|
+
# Satisfy check to see that formatting is correct
|
|
138
|
+
unless Rex::Socket::RangeWalker.new(args[0]).length == 1
|
|
139
|
+
print_error "Invalid IP Address"
|
|
140
|
+
return false
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
unless Rex::Socket::RangeWalker.new(args[1]).length == 1
|
|
144
|
+
print_error "Invalid Subnet mask"
|
|
145
|
+
return false
|
|
146
|
+
end
|
|
147
|
+
|
|
137
148
|
print_line("Creating route #{args[0]}/#{args[1]} -> #{args[2]}")
|
|
138
149
|
|
|
139
150
|
client.net.config.add_route(*args)
|
|
140
151
|
when "delete"
|
|
152
|
+
# Satisfy check to see that formatting is correct
|
|
153
|
+
unless Rex::Socket::RangeWalker.new(args[0]).length == 1
|
|
154
|
+
print_error "Invalid IP Address"
|
|
155
|
+
return false
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
unless Rex::Socket::RangeWalker.new(args[1]).length == 1
|
|
159
|
+
print_error "Invalid Subnet mask"
|
|
160
|
+
return false
|
|
161
|
+
end
|
|
162
|
+
|
|
141
163
|
print_line("Deleting route #{args[0]}/#{args[1]} -> #{args[2]}")
|
|
142
164
|
|
|
143
165
|
client.net.config.remove_route(*args)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/rex/post/permission.rb
CHANGED
|
File without changes
|
data/lib/rex/post/process.rb
CHANGED
|
File without changes
|
data/lib/rex/post/thread.rb
CHANGED
|
File without changes
|
data/lib/rex/post/ui.rb
CHANGED
|
File without changes
|
data/lib/rex/proto.rb
CHANGED
|
File without changes
|
data/lib/rex/proto.rb.ts.rb
CHANGED
|
File without changes
|
data/lib/rex/proto/dcerpc.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -272,7 +272,7 @@ require 'rex/proto/smb/exceptions'
|
|
|
272
272
|
end
|
|
273
273
|
|
|
274
274
|
# Perform a DCE/RPC Function Call
|
|
275
|
-
def call(function, data)
|
|
275
|
+
def call(function, data, do_recv = true)
|
|
276
276
|
|
|
277
277
|
frag_size = data.length
|
|
278
278
|
if options['frag_size']
|
|
@@ -291,6 +291,8 @@ require 'rex/proto/smb/exceptions'
|
|
|
291
291
|
self.write(packet)
|
|
292
292
|
}
|
|
293
293
|
|
|
294
|
+
return true if not do_recv
|
|
295
|
+
|
|
294
296
|
raw_response = ''
|
|
295
297
|
|
|
296
298
|
begin
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/rex/proto/dcerpc/ndr.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# $Id: constants.rb 9990 2010-08-13 03:11:30Z jduck $
|
|
2
|
+
require 'rex/proto/dhcp'
|
|
3
|
+
|
|
4
|
+
module Rex
|
|
5
|
+
module Proto
|
|
6
|
+
module DHCP
|
|
7
|
+
|
|
8
|
+
Request = 1
|
|
9
|
+
Response = 2
|
|
10
|
+
|
|
11
|
+
DHCPDiscover = 1
|
|
12
|
+
DHCPOffer = 2
|
|
13
|
+
DHCPRequest = 3
|
|
14
|
+
DHCPAck = 5
|
|
15
|
+
|
|
16
|
+
DHCPMagic = "\x63\x82\x53\x63"
|
|
17
|
+
|
|
18
|
+
OpDHCPServer = 0x36
|
|
19
|
+
OpLeaseTime = 0x33
|
|
20
|
+
OpSubnetMask = 1
|
|
21
|
+
OpRouter = 3
|
|
22
|
+
OpDns = 6
|
|
23
|
+
OpEnd = 0xff
|
|
24
|
+
|
|
25
|
+
PXEMagic = "\xF1\x00\x74\x7E"
|
|
26
|
+
OpPXEMagic = 0xD0
|
|
27
|
+
OpPXEConfigFile = 0xD1
|
|
28
|
+
OpPXEPathPrefix = 0xD2
|
|
29
|
+
OpPXERebootTime = 0xD3
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
# $Id: server.rb 10261 2010-09-08 17:06:31Z jduck $
|
|
2
|
+
|
|
3
|
+
require 'rex/socket'
|
|
4
|
+
require 'rex/proto/dhcp'
|
|
5
|
+
|
|
6
|
+
module Rex
|
|
7
|
+
module Proto
|
|
8
|
+
module DHCP
|
|
9
|
+
|
|
10
|
+
##
|
|
11
|
+
#
|
|
12
|
+
# DHCP Server class
|
|
13
|
+
# not completely configurable - written specifically for a PXE server
|
|
14
|
+
# - scriptjunkie
|
|
15
|
+
##
|
|
16
|
+
|
|
17
|
+
class Server
|
|
18
|
+
|
|
19
|
+
include Rex::Socket
|
|
20
|
+
|
|
21
|
+
def initialize(hash, context = {})
|
|
22
|
+
self.listen_host = '0.0.0.0' # clients don't already have addresses. Needs to be 0.0.0.0
|
|
23
|
+
self.listen_port = 67 # mandatory (bootps)
|
|
24
|
+
self.context = context
|
|
25
|
+
self.sock = nil
|
|
26
|
+
|
|
27
|
+
@shutting_down = false
|
|
28
|
+
|
|
29
|
+
self.myfilename = hash['FILENAME'] || ""
|
|
30
|
+
self.myfilename << ("\x00" * (128 - self.myfilename.length))
|
|
31
|
+
|
|
32
|
+
source = hash['SRVHOST'] || Rex::Socket.source_address
|
|
33
|
+
self.ipstring = Rex::Socket.addr_aton(source)
|
|
34
|
+
|
|
35
|
+
ipstart = hash['DHCPIPSTART']
|
|
36
|
+
if ipstart
|
|
37
|
+
self.start_ip = Rex::Socket.addr_atoi(ipstart)
|
|
38
|
+
else
|
|
39
|
+
self.start_ip = "#{self.ipstring[0..2]}\x20" #default range x.x.x.32-254
|
|
40
|
+
end
|
|
41
|
+
self.current_ip = start_ip
|
|
42
|
+
|
|
43
|
+
ipend = hash['DHCPIPEND']
|
|
44
|
+
if ipend
|
|
45
|
+
self.end_ip = Rex::Socket.addr_atoi(ipend)
|
|
46
|
+
else
|
|
47
|
+
self.end_ip = "#{self.ipstring[0..2]}\xfe"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# netmask
|
|
51
|
+
netmask = hash['NETMASK'] || "255.255.255.0"
|
|
52
|
+
self.netmaskn = Rex::Socket.addr_aton(netmask)
|
|
53
|
+
|
|
54
|
+
# router
|
|
55
|
+
router = hash['ROUTER'] || source
|
|
56
|
+
self.router = Rex::Socket.addr_aton(router)
|
|
57
|
+
|
|
58
|
+
# dns
|
|
59
|
+
dnsserv = hash['DNSSERVER'] || source
|
|
60
|
+
self.dnsserv = Rex::Socket.addr_aton(dnsserv)
|
|
61
|
+
|
|
62
|
+
# broadcast
|
|
63
|
+
if hash['BROADCAST']
|
|
64
|
+
self.broadcasta = Rex::Socket.addr_aton(hash['BROADCAST'])
|
|
65
|
+
else
|
|
66
|
+
self.broadcasta = Rex::Socket.addr_itoa( self.start_ip | (Rex::Socket.addr_ntoi(self.netmaskn) ^ 0xffffffff) )
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
self.served = {}
|
|
70
|
+
if (hash['SERVEONCE'])
|
|
71
|
+
self.serveOnce = true
|
|
72
|
+
else
|
|
73
|
+
self.serveOnce = false
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
if (hash['PXE'])
|
|
77
|
+
self.servePXE = true
|
|
78
|
+
else
|
|
79
|
+
self.servePXE = false
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
self.leasetime = 600
|
|
83
|
+
self.relayip = "\x00\x00\x00\x00" # relay ip - not currently suported
|
|
84
|
+
self.pxeconfigfile = "update2"
|
|
85
|
+
self.pxepathprefix = ""
|
|
86
|
+
self.pxereboottime = 2000
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
# Start the DHCP server
|
|
91
|
+
def start
|
|
92
|
+
self.sock = Rex::Socket::Udp.create(
|
|
93
|
+
'LocalHost' => listen_host,
|
|
94
|
+
'LocalPort' => listen_port,
|
|
95
|
+
'Context' => context
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
self.thread = Thread.new {
|
|
99
|
+
monitor_socket
|
|
100
|
+
}
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Stop the DHCP server
|
|
104
|
+
def stop
|
|
105
|
+
@shutting_down = true
|
|
106
|
+
self.thread.kill
|
|
107
|
+
self.sock.close rescue nil
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
# Set an option
|
|
112
|
+
def set_option(opts)
|
|
113
|
+
allowed_options = [
|
|
114
|
+
:serveOnce, :servePXE, :relayip, :leasetime, :dnsserv,
|
|
115
|
+
:pxeconfigfile, :pxepathprefix, :pxereboottime, :router
|
|
116
|
+
]
|
|
117
|
+
|
|
118
|
+
opts.each_pair { |k,v|
|
|
119
|
+
next if not v
|
|
120
|
+
if allowed_options.include?(k)
|
|
121
|
+
self.instance_variable_set("@#{k}", v)
|
|
122
|
+
end
|
|
123
|
+
}
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
# Send a single packet to the specified host
|
|
128
|
+
def send_packet(ip, pkt)
|
|
129
|
+
port = 68 # bootpc
|
|
130
|
+
if ip
|
|
131
|
+
self.sock.sendto( pkt, ip, port )
|
|
132
|
+
else
|
|
133
|
+
if not self.sock.sendto( pkt, '255.255.255.255', port )
|
|
134
|
+
self.sock.sendto( pkt, self.broadcasta, port )
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
attr_accessor :listen_host, :listen_port, :context, :leasetime, :relayip, :router, :dnsserv
|
|
140
|
+
attr_accessor :sock, :thread, :myfilename, :ipstring, :served, :serveOnce
|
|
141
|
+
attr_accessor :current_ip, :start_ip, :end_ip, :broadcasta, :netmaskn
|
|
142
|
+
attr_accessor :servePXE, :pxeconfigfile, :pxepathprefix, :pxereboottime
|
|
143
|
+
|
|
144
|
+
protected
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
# See if there is anything to do.. If so, dispatch it.
|
|
148
|
+
def monitor_socket
|
|
149
|
+
while true
|
|
150
|
+
rds = [@sock]
|
|
151
|
+
wds = []
|
|
152
|
+
eds = [@sock]
|
|
153
|
+
|
|
154
|
+
r,w,e = ::IO.select(rds,wds,eds,1)
|
|
155
|
+
|
|
156
|
+
if (r != nil and r[0] == self.sock)
|
|
157
|
+
buf,host,port = self.sock.recvfrom(65535)
|
|
158
|
+
# Lame compatabilitiy :-/
|
|
159
|
+
from = [host, port]
|
|
160
|
+
dispatch_request(from, buf)
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
def dhcpoption(type, val = nil)
|
|
167
|
+
ret = ''
|
|
168
|
+
ret << [type].pack('C')
|
|
169
|
+
|
|
170
|
+
if val
|
|
171
|
+
ret << [val.length].pack('C') + val
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
ret
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# Dispatch a packet that we received
|
|
178
|
+
def dispatch_request(from, buf)
|
|
179
|
+
type = buf.unpack('C').first
|
|
180
|
+
if (type != Request)
|
|
181
|
+
#dlog("Unknown DHCP request type: #{type}")
|
|
182
|
+
return
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# parse out the members
|
|
186
|
+
hwtype = buf[1,1]
|
|
187
|
+
hwlen = buf[2,1].unpack("C").first
|
|
188
|
+
hops = buf[3,1]
|
|
189
|
+
txid = buf[4..7]
|
|
190
|
+
elapsed = buf[8..9]
|
|
191
|
+
flags = buf[10..11]
|
|
192
|
+
clientip = buf[12..15]
|
|
193
|
+
givenip = buf[16..19]
|
|
194
|
+
nextip = buf[20..23]
|
|
195
|
+
relayip = buf[24..27]
|
|
196
|
+
clienthwaddr = buf[28..(27+hwlen)]
|
|
197
|
+
servhostname = buf[44..107]
|
|
198
|
+
filename = buf[108..235]
|
|
199
|
+
magic = buf[236..239]
|
|
200
|
+
|
|
201
|
+
if (magic != DHCPMagic)
|
|
202
|
+
#dlog("Invalid DHCP request - bad magic.")
|
|
203
|
+
return
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
messageType = 0
|
|
207
|
+
pxeclient = false
|
|
208
|
+
|
|
209
|
+
# options parsing loop
|
|
210
|
+
spot = 240
|
|
211
|
+
while (spot < buf.length - 3 && buf[spot] != 0xff)
|
|
212
|
+
optionType = buf[spot,1].unpack("C").first
|
|
213
|
+
optionLen = buf[spot + 1,1].unpack("C").first
|
|
214
|
+
optionValue = buf[(spot + 2)..(spot + optionLen + 1)]
|
|
215
|
+
spot = spot + optionLen + 2
|
|
216
|
+
if optionType == 53
|
|
217
|
+
messageType = optionValue.unpack("C").first
|
|
218
|
+
elsif optionType == 150
|
|
219
|
+
pxeclient = true
|
|
220
|
+
end
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
if pxeclient == false && self.servePXE == true
|
|
224
|
+
#dlog ("No tftp server request; ignoring (probably not PXE client)")
|
|
225
|
+
return
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# prepare response
|
|
229
|
+
pkt = [Response].pack('C')
|
|
230
|
+
pkt << buf[1..7] #hwtype, hwlen, hops, txid
|
|
231
|
+
pkt << "\x00\x00\x00\x00" #elapsed, flags
|
|
232
|
+
pkt << clientip
|
|
233
|
+
|
|
234
|
+
# give next ip address (not super reliable high volume but it should work for a basic server)
|
|
235
|
+
self.current_ip += 1
|
|
236
|
+
if self.current_ip > self.end_ip
|
|
237
|
+
self.current_ip = self.start_ip
|
|
238
|
+
end
|
|
239
|
+
pkt << Rex::Socket.addr_iton(self.current_ip)
|
|
240
|
+
pkt << self.ipstring #next server ip
|
|
241
|
+
pkt << self.relayip
|
|
242
|
+
pkt << buf[28..43] #client hw address
|
|
243
|
+
pkt << servhostname
|
|
244
|
+
pkt << self.myfilename
|
|
245
|
+
pkt << magic
|
|
246
|
+
pkt << "\x35\x01" #Option
|
|
247
|
+
|
|
248
|
+
if messageType == DHCPDiscover #DHCP Discover - send DHCP Offer
|
|
249
|
+
pkt << [DHCPOffer].pack('C')
|
|
250
|
+
# check if already served based on hw addr (MAC address)
|
|
251
|
+
if self.serveOnce == true && self.served.has_key?(buf[28..43])
|
|
252
|
+
#dlog ("Already served; allowing normal boot")
|
|
253
|
+
return
|
|
254
|
+
end
|
|
255
|
+
elsif messageType == DHCPRequest #DHCP Request - send DHCP ACK
|
|
256
|
+
pkt << [DHCPAck].pack('C')
|
|
257
|
+
# now we ignore their discovers (but we'll respond to requests in case a packet was lost)
|
|
258
|
+
self.served.merge!( buf[28..43] => true )
|
|
259
|
+
else
|
|
260
|
+
#dlog("ignoring unknown DHCP request - type #{messageType}")
|
|
261
|
+
return
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
# Options!
|
|
265
|
+
pkt << dhcpoption(OpDHCPServer, self.ipstring)
|
|
266
|
+
pkt << dhcpoption(OpLeaseTime, [self.leasetime].pack('N'))
|
|
267
|
+
pkt << dhcpoption(OpSubnetMask, self.netmaskn)
|
|
268
|
+
pkt << dhcpoption(OpRouter, self.router)
|
|
269
|
+
pkt << dhcpoption(OpDns, self.dnsserv)
|
|
270
|
+
pkt << dhcpoption(OpPXEMagic, PXEMagic)
|
|
271
|
+
pkt << dhcpoption(OpPXEConfigFile, self.pxeconfigfile)
|
|
272
|
+
pkt << dhcpoption(OpPXEPathPrefix, self.pxepathprefix)
|
|
273
|
+
pkt << dhcpoption(OpPXERebootTime, [self.pxereboottime].pack('N'))
|
|
274
|
+
pkt << dhcpoption(OpEnd)
|
|
275
|
+
|
|
276
|
+
pkt << ("\x00" * 32) #padding
|
|
277
|
+
|
|
278
|
+
send_packet(nil, pkt)
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
end
|
|
284
|
+
end
|
|
285
|
+
end
|