whitespaces and show help in case no option is provided

git-svn-id: file:///home/svn/framework3/trunk@13828 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Carlos Perez 2011-10-07 01:32:44 +00:00
parent 7d7795eb46
commit f948dab24a
1 changed files with 10 additions and 3 deletions

View File

@ -4,12 +4,13 @@
# This is meant as an illustration.
#
spawn = false
kill = false
target_pid = nil
opts = Rex::Parser::Arguments.new(
"-h" => [ false,"Help menu." ],
"-h" => [ false, "Help menu." ],
"-f" => [ false, "Launch a process and migrate into the new process"],
"-p" => [ true , "PID to migrate to."],
"-k" => [ false, "Kill original process."]
@ -31,7 +32,6 @@ opts.parse(args) { |opt, idx, val|
end
}
# Creates a temp notepad.exe to migrate to depending the architecture.
def create_temp_proc()
sysinfo = client.sys.config.sysinfo
@ -46,6 +46,13 @@ def create_temp_proc()
proc = client.sys.process.execute(cmd, nil, {'Hidden' => true })
return proc.pid
end
# In case no option is provided show help
if args.length == 0
print_line(opts.usage)
raise Rex::Script::Completed
end
### Main ###
if client.platform =~ /win32|win64/
server = client.sys.process.open