1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-07-18 18:31:41 +02:00

Remove scripts/meterpreter/get_env.rb

This commit is contained in:
bcoles 2022-07-28 17:34:13 +10:00
parent 81ca555d28
commit d45a8aa9fb
No known key found for this signature in database
GPG Key ID: 3EB700FCFBA899B5

View File

@ -1,48 +0,0 @@
##
# WARNING: Metasploit no longer maintains or accepts meterpreter scripts.
# If you'd like to improve this script, please try to port it as a post
# module instead. Thank you.
##
#-------------------------------------------------------------------------------
#Options and Option Parsing
opts = Rex::Parser::Arguments.new(
"-h" => [ false, "Help menu." ]
)
var_names = []
var_names << registry_enumvals("HKEY_CURRENT_USER\\Volatile Environment")
var_names << registry_enumvals("HKEY_CURRENT_USER\\Environment")
var_names << registry_enumvals("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment")
def list_env_vars(var_names)
print_status("Getting all System and User Variables")
tbl = Rex::Text::Table.new(
'Header' => "Enviroment Variable list",
'Indent' => 1,
'Columns' =>
[
"Name",
"Value"
])
@client.sys.config.getenvs(*var_names.flatten).each do |k, v|
tbl << [k, v]
end
print("\n" + tbl.to_s + "\n")
end
opts.parse(args) { |opt, idx, val|
case opt
when "-h"
print_line "Meterpreter Script for extracting a list of all System and User environment variables."
print_line(opts.usage)
raise Rex::Script::Completed
end
}
if client.platform == 'windows'
list_env_vars(var_names)
else
print_error("This version of Meterpreter is not supported with this Script!")
raise Rex::Script::Completed
end