Skip to content

Instantly share code, notes, and snippets.

View limhoff-r7's full-sized avatar

Luke Imhoff limhoff-r7

  • Rapid7, Inc.
  • Austin, TX
View GitHub Profile
@limhoff-r7
limhoff-r7 / rspec log
Created April 25, 2013 14:38
RSpec 3 deprecation warnings
WARNING: subject accessed in a `before(:all)` hook at:
/Users/luke.imhoff/git/limhoff-r7/metasploit-framework/spec/lib/rex/post/meterpreter/packet_spec.rb:455:in `block (3 levels) in <top (required)>'
This is deprecated behavior that will not be supported in RSpec 3.
`let` and `subject` declarations are not intended to be called
in a `before(:all)` hook, as they exist to define state that
is reset between each example, while `before(:all)` exists to
define state that is shared across examples in an example group.
@limhoff-r7
limhoff-r7 / console.txt
Last active December 21, 2015 13:29
New msfconsole search syntax. Comparison of using all operators (for auxiliary module) vs raw SQL query.
# each operator is on its own line just so it's easier to read.
search
description:"Module Description 1"
disclosed_on:"2013-08-21"
license:"Module License 1"
name:"Module Name 1"
privileged:"false"
stance:"aggressive"
actions.name:"Metasploit::Model::Module::Action#name 1"
architectures.abbreviation:"armle"
@limhoff-r7
limhoff-r7 / mdm_module_ancestor_real_paths_vs_files
Created September 10, 2013 16:52
The files that aren't loading on the module caching branches. Non-loading files are `+` additions in the below diff.
--- /tmp/mdm_module_ancestors.txt 2013-09-09 13:37:40.000000000 -0500
+++ file_list.txt 2013-09-09 09:45:26.000000000 -0500
@@ -1,4 +1,4 @@
-/Users/luke.imhoff/.msf4/modules/exploits/windows/wireshark.rb
+modules/auxiliary/admin/2wire/xslt_password_reset.rb
modules/auxiliary/admin/backupexec/dump.rb
modules/auxiliary/admin/backupexec/registry.rb
modules/auxiliary/admin/cisco/cisco_secure_acs_bypass.rb
@@ -110,6 +110,7 @@
modules/auxiliary/dos/dhcp/isc_dhcpd_clientid.rb
@limhoff-r7
limhoff-r7 / metasploit_class.rb
Created September 20, 2013 19:25
Finding `Mdm::Module::Class` by INTERSECTING `Mdm::Module::Ancestor#descendants`, which are `Mdm::Module::Classes`, to determine if a new `Mdm::Module::Class` should be created for the combination of one or two `Mdm::Module::Ancestor`. Uses WeakRef to allow garbage collection of `Mdm::Module::Class` after use.
# `*::Module::Class` holding metadata for this class.
#
# @return [Mdm::Module::Class]
def module_class
begin
strong_reference = nil
if @module_class
strong_reference = @module_class.__getobj__
else
@limhoff-r7
limhoff-r7 / metasploit_module.rb
Created September 20, 2013 21:30
Use WeakRef to allow ActiveRecords to be collected, but allow the ActiveRecord to be recreated when needed. Allows a module, class, or instance to keep track of its own metadata without constantly having the metadata in memory and allowing the metadata to be reused without needing pass it through all the cache construction.
resurrecting_attr_accessor :module_ancestor do
ActiveRecord::Base.connection_pool.with_connection do
Mdm::Module::Ancestor.where(real_path_sha1_hex_digest: real_path_sha1_hex_digest).first
end
end
@limhoff-r7
limhoff-r7 / pubkey.txt
Created November 1, 2013 18:27
Luke Imhoff (Git Signing) <luke_imhoff@rapid7.com> GPG Public Key
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.12 (Darwin)
mQINBFCSc3gBEADZ87idVNrYddHP7cvIp9iLcpjVHBAsI7Z6HGe+wnSx5xSMZ994
5AoWLhQaVkN6L6Xqn/yr82LEZvRMNyVj5N7s8nT7m8oZwaqxZZugUk6ZtxzD98Om
ytKm5SDJrj52UFXaiGQueljSwy3eWAOgYyuBJsyk9bcUOCPzv2xbA5So5UZ8mN69
L0woT/jXorEvNldE4XbBF7Hujgnry0IsM5H/xX2r7ltRuOIUTYtNLRa/CrhYaiky
gUmtXFg1EqKD3p5BzyWoHnLNgxQSSuClln87H/icUGjzHyk+9O38wBkebt8YGoz/
tXiAeVkYYXWNwo3UudkruPZ1i5BYWeRHoAKspFajeE64kbILFsfPYFTCoREj6ByL
2PR1g3pni90qVabjyA3NZZyX+RG5g3rUD/jhYmEbsWLoK1uN4Epc3R/rF+I3bHxC
@limhoff-r7
limhoff-r7 / query.sql
Created January 14, 2014 22:12
Combinations of architecture and platform for all non-generic payloads (generic payloads support all combinations, so they need to be excluded)
SELECT COUNT(module_classes.full_name),
architectures.abbreviation,
platforms.fully_qualified_name
FROM module_instances
INNER JOIN module_classes
ON module_classes.id = module_instances.module_class_id
INNER JOIN module_architectures
ON module_architectures.module_instance_id = module_instances.id
INNER JOIN architectures
ON architectures.id = module_architectures.architecture_id
@limhoff-r7
limhoff-r7 / debug-configuration.md
Last active April 14, 2021 21:54
Running msfconsole with Rubymine remote debugger so that tab completion works in msfconsole
  1. Click Run in the window menu
  2. Click Edit Configurations
  3. Click the + in the top left of the configurations window
  4. Select Ruby remote debug
  5. Enter the below information
  6. Click Apply to save the configuration
  7. Click Ok to close the configurations window

Ruby remote debug

msfconsole (tab completion)

@limhoff-r7
limhoff-r7 / public.key
Created January 30, 2014 17:35
My git signing key for 2014-01-30 to 2014-04-30
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.12 (Darwin)
mQINBFLqiNkBEADpVwLNGVkfx3fbZ6RxVZCRzMW/Pum88VIXQe/KmnltyEBX9GsY
jH3hwn4gEjSR6NctSCqMcarJd4orv6GF9Bdy8Kj9PnNchl2zuKL0StzkFI48SGFl
gEDJsyLCNSzIDD9pwjxZDcHXhz8v06I+YSSL3YW3zKzZ7QmG9MuYbFhDq8ZO6HKb
lKf7WhOjVqHdxzsrCGrkIe5MqSh5yxfRaYUtt4SbmfaFOI/oxTtGL67VcIOF9Osb
Cp8g8AS/jtl9UGt9jgF0y6Duqne4anwujykMFcBXzlVA55fpmckTXYgqJfE65CiZ
IwXH/QuyrhwdNR2IeahHqKTX44Up/S3O6w197XaIfQ9ZKWOK5JRlDH4BQ/o1/y2p
/hkFUeyiWQ1i6X81bTX0P1Uuztzgp3QNZhHGx2qCiV8w9/BZEZ3yScTzlgSN1Xlz
@limhoff-r7
limhoff-r7 / automatic_payload_reference_name.rb
Created February 25, 2014 16:04
How to find a compatibility payload from a list of reference names
exploit = framework.modules.create_from_module_class(module_class)
# ensure target is set correct
reference_names = # Array<Mdm::Module::Class#reference_name> order by preference with most desired first.
payload_compatibility = exploit.target.payload_compatibility(reference_names: reference_names)
payload_reference_name = payload_compatibility.preferred_class_reference_name