diff --git a/lib/msf/ui/console/command_dispatcher/common.rb b/lib/msf/ui/console/command_dispatcher/common.rb index f9a5cc9201..8d5ee29f29 100644 --- a/lib/msf/ui/console/command_dispatcher/common.rb +++ b/lib/msf/ui/console/command_dispatcher/common.rb @@ -12,7 +12,7 @@ module CommandDispatcher # These are functions that are used in two or more command dispatchers. module Common - + # Parse +arg+ into a {Rex::Socket::RangeWalker} and append the result into +host_ranges+ # # @note This modifies +host_ranges+ in place @@ -41,7 +41,7 @@ module Common end return true end - + # # Parse +arg+ into an array of ports and append the result into +port_ranges+ # @@ -62,7 +62,7 @@ module Common end return true end - + # # Set RHOSTS in the +active_module+'s (or global if none) datastore from an array of addresses # @@ -119,6 +119,7 @@ module Common if (p) p_opt = Serializer::ReadableText.dump_options(p, ' ') print("\nPayload options (#{mod.datastore['PAYLOAD']}):\n\n#{p_opt}\n") if (p_opt and p_opt.length > 0) + print(" **DisablePayloadHandler: True (RHOST and RPORT settings will be ignored!)**\n\n") if mod.datastore['DisablePayloadHandler'] end end @@ -137,8 +138,8 @@ module Common # Uncomment this line if u want target like msf2 format #print("\nTarget: #{mod.target.name}\n\n") end - - + + end end diff --git a/tools/dev/find_release_notes.rb b/tools/dev/find_release_notes.rb old mode 100644 new mode 100755 index fbd073a5ae..e70f0c12d3 --- a/tools/dev/find_release_notes.rb +++ b/tools/dev/find_release_notes.rb @@ -1,5 +1,10 @@ #!/usr/bin/env ruby +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + require 'net/http' require 'nokogiri' require 'thread' diff --git a/tools/dev/msftidy.rb b/tools/dev/msftidy.rb index 6faf2a536c..726da767a2 100755 --- a/tools/dev/msftidy.rb +++ b/tools/dev/msftidy.rb @@ -1,11 +1,13 @@ #!/usr/bin/env ruby # -*- coding: binary -*- + # # Check (recursively) for style compliance violations and other # tree inconsistencies. # # by jduck, todb, and friends # + require 'fileutils' require 'find' require 'time' @@ -216,7 +218,7 @@ class Msftidy end # See if 'require "rubygems"' or equivalent is used, and - # warn if so. Since Ruby 1.9 this has not been necessary and + # warn if so. Since Ruby 1.9 this has not been necessary and # the framework only suports 1.9+ def check_rubygems @lines.each do |line| diff --git a/tools/dev/pre-commit-hook.rb b/tools/dev/pre-commit-hook.rb index de99d598cd..3ba1d94cc7 100755 --- a/tools/dev/pre-commit-hook.rb +++ b/tools/dev/pre-commit-hook.rb @@ -1,5 +1,6 @@ #!/usr/bin/env ruby +# # Check that modules actually pass msftidy checks before committing # or after merging. # @@ -15,6 +16,7 @@ # That way, you will track changes to this script when it updates # (rarely). If you'd prefer to copy it directly, that's okay, too (mark # it +x and don't name it filename.rb, just filename). +# def merge_error_message msg = [] diff --git a/tools/exploit/egghunter.rb b/tools/exploit/egghunter.rb index 93a0cc3e2b..eb8c2ad241 100755 --- a/tools/exploit/egghunter.rb +++ b/tools/exploit/egghunter.rb @@ -1,5 +1,10 @@ #!/usr/bin/env ruby +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + msfbase = __FILE__ while File.symlink?(msfbase) msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase)) diff --git a/tools/exploit/exe2vba.rb b/tools/exploit/exe2vba.rb index 965e86baed..61cfb96405 100755 --- a/tools/exploit/exe2vba.rb +++ b/tools/exploit/exe2vba.rb @@ -1,12 +1,14 @@ #!/usr/bin/env ruby -# -# $Id$ + +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + # # This script converts an EXE to a VBA script for Word/Excel # Credit to PriestMaster for the original C code # -# $Revision$ -# msfbase = __FILE__ while File.symlink?(msfbase) diff --git a/tools/exploit/exe2vbs.rb b/tools/exploit/exe2vbs.rb index b37f9cf2db..3b0c36098f 100755 --- a/tools/exploit/exe2vbs.rb +++ b/tools/exploit/exe2vbs.rb @@ -1,11 +1,13 @@ #!/usr/bin/env ruby -# -# $Id$ + +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + # # This script converts an EXE to a vbs script # -# $Revision$ -# msfbase = __FILE__ while File.symlink?(msfbase) diff --git a/tools/exploit/find_badchars.rb b/tools/exploit/find_badchars.rb index 95552e7160..2d5fa758f5 100755 --- a/tools/exploit/find_badchars.rb +++ b/tools/exploit/find_badchars.rb @@ -1,12 +1,14 @@ #!/usr/bin/env ruby -# -# $Id$ + +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + # # This script is intended to assist an exploit developer in deducing what # "bad characters" exist for a given input path to a program. # -# $Revision$ -# msfbase = __FILE__ while File.symlink?(msfbase) diff --git a/tools/exploit/jsobfu.rb b/tools/exploit/jsobfu.rb index 833e310198..d30d72a780 100755 --- a/tools/exploit/jsobfu.rb +++ b/tools/exploit/jsobfu.rb @@ -1,5 +1,10 @@ #!/usr/bin/env ruby +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + msfbase = __FILE__ while File.symlink?(msfbase) msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase)) diff --git a/tools/exploit/metasm_shell.rb b/tools/exploit/metasm_shell.rb index 39ec5417cd..784717c1ef 100755 --- a/tools/exploit/metasm_shell.rb +++ b/tools/exploit/metasm_shell.rb @@ -1,19 +1,22 @@ #!/usr/bin/env ruby -# -# $Id$ + +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + # # This tool provides an easy way to see what opcodes are associated with # certain x86 instructions by making use of Metasm! Also allows to get # friendly output from a GAS assembler source code file. # -# -# $Revision$ -# +# # This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2007 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory +# msfbase = __FILE__ while File.symlink?(msfbase) diff --git a/tools/exploit/msf_irb_shell.rb b/tools/exploit/msf_irb_shell.rb index caa6c324fa..5eff862b4c 100755 --- a/tools/exploit/msf_irb_shell.rb +++ b/tools/exploit/msf_irb_shell.rb @@ -1,8 +1,9 @@ #!/usr/bin/env ruby -# -# $Id$ -# $Revision$ -# + +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## msfbase = __FILE__ while File.symlink?(msfbase) diff --git a/tools/exploit/msu_finder.rb b/tools/exploit/msu_finder.rb index 5203a5b167..52403afbb3 100755 --- a/tools/exploit/msu_finder.rb +++ b/tools/exploit/msu_finder.rb @@ -1,5 +1,10 @@ #!/usr/bin/env ruby +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + require 'patch_finder/core/helper' require 'patch_finder/msu' require 'optparse' diff --git a/tools/exploit/nasm_shell.rb b/tools/exploit/nasm_shell.rb index f2f3ce652e..4553de42e3 100755 --- a/tools/exploit/nasm_shell.rb +++ b/tools/exploit/nasm_shell.rb @@ -1,13 +1,15 @@ #!/usr/bin/env ruby -# -# $Id$ + +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + # # This tool provides an easy way to see what opcodes are associated with # certain x86 instructions by making use of nasm if it is installed and # reachable through the PATH environment variable. # -# $Revision$ -# msfbase = __FILE__ while File.symlink?(msfbase) @@ -43,7 +45,7 @@ shell.init_ui(Rex::Ui::Text::Input::Stdio.new, Rex::Ui::Text::Output::Stdio.new) shell.run { |line| line.gsub!(/(\r|\n)/, '') - line.gsub!(/\\n/, "\n") + line.gsub!(/\\n/, "\n") break if (line =~ /^(exit|quit)/i) diff --git a/tools/exploit/pattern_create.rb b/tools/exploit/pattern_create.rb index 6767eeb08c..ce6b51e997 100755 --- a/tools/exploit/pattern_create.rb +++ b/tools/exploit/pattern_create.rb @@ -1,5 +1,10 @@ #!/usr/bin/env ruby +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + msfbase = __FILE__ while File.symlink?(msfbase) msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase)) diff --git a/tools/exploit/pattern_offset.rb b/tools/exploit/pattern_offset.rb index ff1daac58d..c6c910bea0 100755 --- a/tools/exploit/pattern_offset.rb +++ b/tools/exploit/pattern_offset.rb @@ -1,5 +1,10 @@ #!/usr/bin/env ruby +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + msfbase = __FILE__ while File.symlink?(msfbase) msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase)) diff --git a/tools/exploit/pdf2xdp.rb b/tools/exploit/pdf2xdp.rb index 4428c17c6b..63a8275ba4 100755 --- a/tools/exploit/pdf2xdp.rb +++ b/tools/exploit/pdf2xdp.rb @@ -1,11 +1,13 @@ #!/usr/bin/env ruby +# # This script converts a PDF file to an equivalent XML Data Package file, # which can be opened by Adobe Reader as well and typically escapes AV # detection better than a "normal" PDF # # Alexander 'alech' Klink, 2011 # public domain / CC-0 +# require 'base64' diff --git a/tools/exploit/psexec.rb b/tools/exploit/psexec.rb index 950f14e94e..7533d38d9b 100755 --- a/tools/exploit/psexec.rb +++ b/tools/exploit/psexec.rb @@ -1,5 +1,10 @@ #!/usr/bin/env ruby -# + +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + # # This is rough and dirty standalone (Rex only) psexec implementation # @@ -302,4 +307,3 @@ rescue ::Interrupt rescue ::Exception #raise $! end - diff --git a/tools/exploit/reg.rb b/tools/exploit/reg.rb index 242fb48df1..15eaaf586e 100755 --- a/tools/exploit/reg.rb +++ b/tools/exploit/reg.rb @@ -1,10 +1,13 @@ #!/usr/bin/env ruby -# -# $Id$ + +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + # # This script acts as a small registry reader. # You may easily automate a lot of registry forensics with a proper method. -# $Revision$ # msfbase = __FILE__ diff --git a/tools/exploit/virustotal.rb b/tools/exploit/virustotal.rb index 286c6611cf..e50467bddd 100755 --- a/tools/exploit/virustotal.rb +++ b/tools/exploit/virustotal.rb @@ -27,7 +27,6 @@ # sinn3r # - msfbase = __FILE__ while File.symlink?(msfbase) msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase)) diff --git a/tools/hardware/elm327_relay.rb b/tools/hardware/elm327_relay.rb index b3c97bcec4..732042bfb0 100755 --- a/tools/hardware/elm327_relay.rb +++ b/tools/hardware/elm327_relay.rb @@ -1,21 +1,22 @@ #!/usr/bin/env ruby -# ELM327 and STN1100 MCU interface to the Metasploit HWBridge - ## # This module requires Metasploit: https://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## -#### +# +# ELM327 and STN1100 MCU interface to the Metasploit HWBridge +# + +# # This module requires a connected ELM327 or STN1100 is connected to -# the machines serial. Sets up a basic RESTful web server to communicate +# the machines serial. Sets up a basic RESTful web server to communicate # # Requires MSF and the serialport gem to be installed. # - `gem install serialport` # - or, if using rvm: `rvm gemset install serialport` -#### - +# ### Non-typical gem ### begin @@ -119,7 +120,7 @@ module ELM327HWBridgeRelay 'DefaultOptions' => { 'SRVPORT' => self.server_port, - 'URIPATH' => "/" + 'URIPATH' => "/" })) self.serial_port = @opts[:serial] if @opts.has_key? :serial self.serial_baud = @opts[:baud].to_i if @opts.has_key? :baud @@ -134,7 +135,7 @@ module ELM327HWBridgeRelay @supported_buses = [ { "bus_name" => "can0" } ] end - # Sends a serial command to the ELM327. Automatically appends \r\n + # Sends a serial command to the ELM327. Automatically appends \r\n # # @param cmd [String] Serial AT command for ELM327 # @return [String] Response between command and '>' prompt @@ -149,7 +150,7 @@ module ELM327HWBridgeRelay # Connects to the ELM327, resets paramters, gets device version and sets up general comms. # Serial params are set via command options or during initialization # - # @return [SerialPort] SerialPort object for communications. Also available as @ser + # @return [SerialPort] SerialPort object for communications. Also available as @ser def connect_to_device() begin @ser = SerialPort.new(self.serial_port, self.serial_baud, self.serial_bits, self.serial_stop_bits, SerialPort::NONE) @@ -218,7 +219,7 @@ module ELM327HWBridgeRelay { "system_timezone" => Time.now.getlocal.zone } end - # Returns supported buses. Can0 is always available + # Returns supported buses. Can0 is always available # TODO: Use custom methods to force non-standard buses such as kline # # @return [Hash] Hash of supported_buses @@ -228,7 +229,7 @@ module ELM327HWBridgeRelay # Sends CAN packet # - # @param id [String] ID as a hex string + # @param id [String] ID as a hex string # @param data [String] String of HEX bytes to send # @return [Hash] Success Hash def cansend(id, data) @@ -238,7 +239,7 @@ module ELM327HWBridgeRelay resp = send_cmd("ATSH#{id}") if resp == "OK" send_cmd("ATR0") # Disable response checks - send_cmd("ATCAF0") # Turn off ISO-TP formating + send_cmd("ATCAF0") # Turn off ISO-TP formatting else return result end @@ -269,11 +270,11 @@ module ELM327HWBridgeRelay result["success"] = false srcid = "%03X" % srcid.to_i(16) dstid = "%03X" % dstid.to_i(16) - send_cmd("ATCAF1") # Turn on ISO-TP formatting - send_cmd("ATR1") # Turn on responses - send_cmd("ATSH#{srcid}") # Src Header + send_cmd("ATCAF1") # Turn on ISO-TP formatting + send_cmd("ATR1") # Turn on responses + send_cmd("ATSH#{srcid}") # Src Header send_cmd("ATCRA#{dstid}") # Resp Header - send_cmd("ATCFC1") # Enable flow control + send_cmd("ATCFC1"). # Enable flow control resp = send_cmd(data) @packets_sent += 1 @last_sent = Time.now() @@ -345,7 +346,7 @@ module ELM327HWBridgeRelay end end - # Main run operation. Connects to device then runs the server + # Main run operation. Connects to device then runs the server def run connect_to_device() exploit() @@ -377,7 +378,7 @@ module ELM327HWBridgeRelay # Returns the parsed options from ARGV # # raise [OptionParser::InvalidOption] Invalid option found - # @return [OptionParser, Hash] The OptionParser object and an hash containg the options + # @return [OptionParser, Hash] The OptionParser object and an hash containing the options def self.get_parsed_options options = {} parser = OptionParser.new do |opt| @@ -423,3 +424,4 @@ if __FILE__ == $PROGRAM_NAME $stdout.puts("Shutting down") end end + diff --git a/tools/hardware/killerbee_msfrelay b/tools/hardware/killerbee_msfrelay.py similarity index 100% rename from tools/hardware/killerbee_msfrelay rename to tools/hardware/killerbee_msfrelay.py diff --git a/tools/modules/aws-aggregator-userdata.sh b/tools/modules/aws-aggregator-userdata.sh old mode 100644 new mode 100755 diff --git a/tools/modules/committer_count.rb b/tools/modules/committer_count.rb index f0b6a97827..f5794f9672 100755 --- a/tools/modules/committer_count.rb +++ b/tools/modules/committer_count.rb @@ -1,5 +1,6 @@ #!/usr/bin/env ruby +# # The committer_count.rb is a way to tell who's been active over the last # given period. It's of course, quite coarse -- someone with 10 commits in a day # may or may not be more productive than someone with 3, but over long enough @@ -19,6 +20,7 @@ # # History with colors and e-mail addresses (respecting .mailmap): # git log --pretty=format:"%C(white)%ad %C(yellow)%h %Cblue'%aN' <%aE> %Cgreen%f%Creset" --date=short +# class GitLogLine < Struct.new(:date, :hash, :author, :message) end diff --git a/tools/modules/file_pull_requests.rb b/tools/modules/file_pull_requests.rb index 547561ff18..5c60159bb5 100755 --- a/tools/modules/file_pull_requests.rb +++ b/tools/modules/file_pull_requests.rb @@ -1,13 +1,16 @@ #!/usr/bin/env ruby -### +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + # # This tool allows you to find all the pull requests for a particular file in the Metasploit # repository. It does not include commit history from SVN. # # Author: sinn3r # -### require 'net/http' require 'optparse' diff --git a/tools/modules/generate_mettle_payloads.rb b/tools/modules/generate_mettle_payloads.rb index c9b7dddc94..7def0c0284 100755 --- a/tools/modules/generate_mettle_payloads.rb +++ b/tools/modules/generate_mettle_payloads.rb @@ -1,4 +1,5 @@ #!/usr/bin/env ruby + # # This script generates Mettle payload wrappers # diff --git a/tools/modules/missing_payload_tests.rb b/tools/modules/missing_payload_tests.rb index 203f9dae2d..0b824e1921 100755 --- a/tools/modules/missing_payload_tests.rb +++ b/tools/modules/missing_payload_tests.rb @@ -1,9 +1,16 @@ #!/usr/bin/env ruby +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + +# # Reads untest payload modules from log/untested-payloads.log (which can be produced by running `rake spec`) and prints -# the statements that need to be added to `spec/modules/payloads_spec.rb`. **Note: this script depends on the payload +# the statements that need to be added to `spec/modules/payloads_spec.rb`. **Note: this script depends on the payload # being loadable, so if module is not loadable, then the developer must manually determine which single needs to be tested # or which combinations of stages and stagers need to be tested.** +# msfbase = __FILE__ while File.symlink?(msfbase) diff --git a/tools/modules/module_author.rb b/tools/modules/module_author.rb index 0fe02efa9e..1c8d2c02df 100755 --- a/tools/modules/module_author.rb +++ b/tools/modules/module_author.rb @@ -1,7 +1,10 @@ #!/usr/bin/env ruby -# -# $Id$ -# $Revision$ + +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + # # This script lists each module by its author(s) and # the number of modules per author diff --git a/tools/modules/module_commits.rb b/tools/modules/module_commits.rb index 3f659bdf08..85eb85e7a0 100755 --- a/tools/modules/module_commits.rb +++ b/tools/modules/module_commits.rb @@ -1,9 +1,16 @@ #!/usr/bin/env ruby +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + +# # Check the commit history of a module or tree of modules. # and sort by number of commits. # # Usage: tools/module_commits.rb [module dir | module fname] +# require 'find' diff --git a/tools/modules/module_count.rb b/tools/modules/module_count.rb index 1cadf7b6e3..bdd95b703e 100755 --- a/tools/modules/module_count.rb +++ b/tools/modules/module_count.rb @@ -1,6 +1,13 @@ #!/usr/bin/env ruby +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + +# # Lists the current count of modules, by type, and outputs a bare CSV. +# msfbase = __FILE__ while File.symlink?(msfbase) @@ -39,7 +46,7 @@ $framework.modules.each do |name, mod| [:exploit, :auxiliary, :post, :payload, :encoder, :nop].each do |meth| interrogative = "#{meth}?".intern if this_mod.send(interrogative) - module_types[meth] += 1 + module_types[meth] += 1 end end end diff --git a/tools/modules/module_description.rb b/tools/modules/module_description.rb old mode 100644 new mode 100755 index 3816bfa8f4..c9ecb687f9 --- a/tools/modules/module_description.rb +++ b/tools/modules/module_description.rb @@ -1,11 +1,13 @@ #!/usr/bin/env ruby -# -# $Id$ + +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + # # This script lists each module with its description # -# $Revision$ -# msfbase = __FILE__ while File.symlink?(msfbase) diff --git a/tools/modules/module_disclodate.rb b/tools/modules/module_disclodate.rb index eafce24b33..fb33b5755b 100755 --- a/tools/modules/module_disclodate.rb +++ b/tools/modules/module_disclodate.rb @@ -1,7 +1,10 @@ #!/usr/bin/env ruby -# -# $Id$ -# $Revision$ + +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + # # This script lists each module by its disclosure date # diff --git a/tools/modules/module_license.rb b/tools/modules/module_license.rb index 71628257b2..ced768e068 100755 --- a/tools/modules/module_license.rb +++ b/tools/modules/module_license.rb @@ -1,11 +1,13 @@ #!/usr/bin/env ruby -# -# $Id$ + +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + # # This script lists each module by its licensing terms # -# $Revision$ -# msfbase = __FILE__ while File.symlink?(msfbase) diff --git a/tools/modules/module_mixins.rb b/tools/modules/module_mixins.rb index ca704a5333..147588df4f 100755 --- a/tools/modules/module_mixins.rb +++ b/tools/modules/module_mixins.rb @@ -1,11 +1,13 @@ #!/usr/bin/env ruby -# -# $Id$ + +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + # # This script lists all modules with their mixins. Handy for finding different "kinds" of modules. # -# $Revision$ -# msfbase = __FILE__ while File.symlink?(msfbase) @@ -46,7 +48,7 @@ if ARGV[0] mod_hash[m] ||= 0 mod_hash[m] += 1 longest_name = m.to_s.size unless m.to_s.size < longest_name - end + end end mod_hash.sort_by {|a| a[1]}.reverse.each do |arr| puts "%-#{longest_name}s | %d" % arr diff --git a/tools/modules/module_payloads.rb b/tools/modules/module_payloads.rb index b3350aa389..afe920e61f 100755 --- a/tools/modules/module_payloads.rb +++ b/tools/modules/module_payloads.rb @@ -1,11 +1,13 @@ #!/usr/bin/env ruby -# -# $Id$ + +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + # # This script lists each exploit module by its compatible payloads # -# $Revision$ -# msfbase = __FILE__ while File.symlink?(msfbase) @@ -31,4 +33,3 @@ $framework.exploits.each_module { |name, mod| puts "#{x.refname.ljust 40} - #{n}" } } - diff --git a/tools/modules/module_ports.rb b/tools/modules/module_ports.rb index 7502f1010f..70ac8c81b3 100755 --- a/tools/modules/module_ports.rb +++ b/tools/modules/module_ports.rb @@ -1,11 +1,13 @@ #!/usr/bin/env ruby -# -# $Id$ + +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + # # This script lists each module by the default ports it uses # -# $Revision$ -# msfbase = __FILE__ while File.symlink?(msfbase) diff --git a/tools/modules/module_rank.rb b/tools/modules/module_rank.rb index 6c8fa00086..4affbf62c9 100755 --- a/tools/modules/module_rank.rb +++ b/tools/modules/module_rank.rb @@ -1,11 +1,13 @@ #!/usr/bin/env ruby -# -# $Id$ + +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + # # This script lists each module with its rank # -# $Revision$ -# msfbase = __FILE__ while File.symlink?(msfbase) diff --git a/tools/modules/module_reference.rb b/tools/modules/module_reference.rb index 729c4fd0d7..b8d2360630 100755 --- a/tools/modules/module_reference.rb +++ b/tools/modules/module_reference.rb @@ -1,4 +1,10 @@ #!/usr/bin/env ruby + +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + # # This script lists each module with its references # diff --git a/tools/modules/module_targets.rb b/tools/modules/module_targets.rb index a3a7c036c5..6c81157f94 100755 --- a/tools/modules/module_targets.rb +++ b/tools/modules/module_targets.rb @@ -1,11 +1,13 @@ #!/usr/bin/env ruby -# -# $Id$ + +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + # # This script lists all modules with their targets # -# $Revision$ -# msfbase = __FILE__ while File.symlink?(msfbase) diff --git a/tools/modules/payload_lengths.rb b/tools/modules/payload_lengths.rb index a31de48632..724ea880ab 100755 --- a/tools/modules/payload_lengths.rb +++ b/tools/modules/payload_lengths.rb @@ -1,8 +1,10 @@ #!/usr/bin/env ruby -# -# $Id$ -# $Revision$ -# + +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + # This script lists each payload module along with its length # NOTE: No encoding or BadChar handling is performed # diff --git a/tools/modules/update_payload_cached_sizes.rb b/tools/modules/update_payload_cached_sizes.rb index c5542cef87..f3c17ac05a 100755 --- a/tools/modules/update_payload_cached_sizes.rb +++ b/tools/modules/update_payload_cached_sizes.rb @@ -1,4 +1,10 @@ #!/usr/bin/env ruby + +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + # # This script updates the CachedSize constants in payload modules # @@ -31,4 +37,3 @@ framework.payloads.each_module do |name, mod| $stdout.puts "[*] Updating the CacheSize for #{mod.file_path}..." Msf::Util::PayloadCachedSize.update_module_cached_size(mod_inst) end - diff --git a/tools/modules/verify_datastore.rb b/tools/modules/verify_datastore.rb index 38ffd6922e..0b5064be0a 100755 --- a/tools/modules/verify_datastore.rb +++ b/tools/modules/verify_datastore.rb @@ -1,6 +1,5 @@ #!/usr/bin/env ruby -# -# $Id$ + # # This script parses a Metasploit module's use of the datastore to # ensure that all datastore elements are both declared and used. Adding @@ -12,8 +11,6 @@ # bash's "for i in path/to/modules/*.rb; do verify_datastore.rb $i; done" Also, # it assumes Metasploit's msf/core is in the load path. # -# $Revision$ -# infile = ARGV[0] unless(infile && File.readable?(infile)) @@ -111,4 +108,3 @@ end if undeclared_datastores.empty? && unused_datastores.empty? puts "[+] %-60s : okay" % [infile] end - diff --git a/tools/password/cpassword_decrypt.rb b/tools/password/cpassword_decrypt.rb index 335809e925..6019be9712 100755 --- a/tools/password/cpassword_decrypt.rb +++ b/tools/password/cpassword_decrypt.rb @@ -6,7 +6,7 @@ ## # -# This script will allow you to specify an encrypted cpassword string using the Microsofts public +# This script will allow you to specify an encrypted cpassword string using the Microsoft's public # AES key. This is useful if you don't or can't use the GPP post exploitation module. Just paste # the cpassword encrypted string found in groups.xml or scheduledtasks.xml and it will output the # decrypted string for you. diff --git a/tools/password/halflm_second.rb b/tools/password/halflm_second.rb index 21f312c2ca..eb3d44ddba 100755 --- a/tools/password/halflm_second.rb +++ b/tools/password/halflm_second.rb @@ -1,14 +1,16 @@ #!/usr/bin/env ruby -# -# $Id$ + +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + # # This script cracks a half-lm challenge/response hash that uses a # a static challenge key. The idea is you use rainbow tables to # crack the first 7 chars and this script to complete a few remaining. # If the password is longer than 10 characters, this script will fail. # -# $Revision$ -# msfbase = __FILE__ while File.symlink?(msfbase) diff --git a/tools/password/hmac_sha1_crack.rb b/tools/password/hmac_sha1_crack.rb index fb1acae806..243e78eed0 100755 --- a/tools/password/hmac_sha1_crack.rb +++ b/tools/password/hmac_sha1_crack.rb @@ -1,6 +1,10 @@ #!/usr/bin/env ruby -# -# $Id$ + +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + # # This script cracks HMAC SHA1 hashes. It is strangely necessary as existing tools # have issues with binary salt values and extremely large salt values. The primary diff --git a/tools/password/lm2ntcrack.rb b/tools/password/lm2ntcrack.rb index c6be3ada62..0a1cb60c8e 100755 --- a/tools/password/lm2ntcrack.rb +++ b/tools/password/lm2ntcrack.rb @@ -1,11 +1,14 @@ #!/usr/bin/env ruby -# -# $Id$ + +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + # # This script cracks any type of NTLM hash # Credit to -Yannick Hamon for the original idea/perl code # -Alexandre Maloteaux for improvments -# $Revision$ # msfbase = __FILE__ @@ -167,7 +170,7 @@ when "HALFLM" exit end calculatedhash = CRYPT::lm_hash(pass,true).unpack("H*")[0].upcase - puts "[*] The LM hash for #{pass.upcase} is : #{calculatedhash}" + puts "[*] The LM hash for #{pass.upcase} is : #{calculatedhash}" exit when PASS_MODE if not pass =~ /^.{0,7}$/ @@ -216,7 +219,7 @@ when "LM" exit end calculatedhash = CRYPT::lm_hash(pass.upcase).unpack("H*")[0].upcase - puts "[*] The LM hash for #{pass.upcase} is : #{calculatedhash}" + puts "[*] The LM hash for #{pass.upcase} is : #{calculatedhash}" exit when PASS_MODE if not pass =~ /^.{0,14}$/ @@ -261,7 +264,7 @@ when "NTLM" exit when HASH_MODE calculatedhash = CRYPT::ntlm_hash(pass).unpack("H*")[0].upcase - puts "[*] The NTLM hash for #{pass} is : #{calculatedhash}" + puts "[*] The NTLM hash for #{pass} is : #{calculatedhash}" exit when PASS_MODE if not hash =~ /^([a-fA-F0-9]{32})$/ @@ -327,7 +330,7 @@ when "HALFNETLMv1" :challenge => [ srvchal ].pack("H*") } calculatedhash = CRYPT::lm_response(arglm,true).unpack("H*")[0].upcase - puts "[*] The HALFNETLMv1 hash for #{pass.upcase} is : #{calculatedhash}" + puts "[*] The HALFNETLMv1 hash for #{pass.upcase} is : #{calculatedhash}" exit when PASS_MODE if not pass =~ /^.{0,7}$/ @@ -408,7 +411,7 @@ when "NETLMv1" :challenge => [ srvchal ].pack("H*") } calculatedhash = CRYPT::lm_response(arglm).unpack("H*")[0].upcase - puts "[*] The NETLMv1 hash for #{pass.upcase} is : #{calculatedhash}" + puts "[*] The NETLMv1 hash for #{pass.upcase} is : #{calculatedhash}" exit when PASS_MODE if not pass =~ /^.{1,14}$/ @@ -483,7 +486,7 @@ when "NETNTLMv1" argntlm = { :ntlm_hash => CRYPT::ntlm_hash(pass), :challenge => [ srvchal ].pack("H*") } calculatedhash = CRYPT::ntlm_response(argntlm).unpack("H*")[0].upcase - puts "[*] The NETNTLMv1 hash for #{pass} is : #{calculatedhash}" + puts "[*] The NETNTLMv1 hash for #{pass} is : #{calculatedhash}" exit when PASS_MODE if not hash =~ /^([a-fA-F0-9]{48})$/ @@ -577,7 +580,7 @@ when "NETNTLM2_SESSION" optntlm = { :client_challenge => [ clichal ].pack("H*")} calculatedhash = CRYPT::ntlm2_session(argntlm,optntlm).join[24,24].unpack("H*")[0].upcase - puts "[*] The NETNTLM2_SESSION hash for #{pass} is : #{calculatedhash}" + puts "[*] The NETNTLM2_SESSION hash for #{pass} is : #{calculatedhash}" exit when PASS_MODE if not hash =~ /^([a-fA-F0-9]{48})$/ diff --git a/tools/password/md5_lookup.rb b/tools/password/md5_lookup.rb index 1f50786dce..95a71da809 100755 --- a/tools/password/md5_lookup.rb +++ b/tools/password/md5_lookup.rb @@ -5,7 +5,6 @@ # Current source: https://github.com/rapid7/metasploit-framework ## -### # # This script will look up a collection of MD5 hashes (from a file) against the following databases # via md5cracker.org: @@ -21,7 +20,6 @@ # * hasherezade (http://hasherezade.net, @hasherezade) # * sinn3r (ported the module as a standalone msf tool) # -### # # Load our MSF API diff --git a/tools/password/vxdigger.rb b/tools/password/vxdigger.rb index ceeb464c2a..04ea2eb393 100755 --- a/tools/password/vxdigger.rb +++ b/tools/password/vxdigger.rb @@ -1,7 +1,5 @@ #!/usr/bin/env ruby -# $Id$ - # # This script scans a memory dump or firmware image for any password hashes that # happen to match the "master password" list generated by vxmaster. This is a @@ -9,8 +7,6 @@ # # (C) 2010 Rapid7 # -# $Revision$ -# def usage $stderr.puts "usage: #{$0} [dump-file] " @@ -61,4 +57,3 @@ hashes.each do |r| puts "[+] Password hash '#{k}' (##{x}) can be accessed with #{h.unpack("C*").map{|i| "\\x%.2x" % i}} [ '#{h}' ]" puts "[+]" end - diff --git a/tools/password/vxencrypt.rb b/tools/password/vxencrypt.rb index 109e7bf5cd..2e091b5c6b 100755 --- a/tools/password/vxencrypt.rb +++ b/tools/password/vxencrypt.rb @@ -1,11 +1,8 @@ #!/usr/bin/env ruby -# -# $Id$ + # # This script can be used to calculate hash values for VxWorks passwords. # -# $Revision$ -# def hashit(inp) if inp.length < 8 or inp.length > 120 diff --git a/tools/password/vxmaster.rb b/tools/password/vxmaster.rb index 7521f48801..822c4f64b5 100755 --- a/tools/password/vxmaster.rb +++ b/tools/password/vxmaster.rb @@ -1,7 +1,5 @@ #!/usr/bin/env ruby -# $Id$ - # # This script calculates all possible password hashes for the vxworks platform. # The generated list can be used to bruteforce authentication to any service @@ -9,16 +7,18 @@ # # (C) 2010 Rapid7 # -# $Revision$ -# +# # VxWorks converts the clear-text password into single integer value. This value # can only be one of about 210,000 possible options. The method below emulates # what the vxencrypt utility does and was implemented based on publicly indexed # documentation and source code snippets. +# +# # XXX: Newer VxWorks can use passwords up to 120 characters long, but this is # not very common in the wild. +# def vxworks_sum_from_pass(pass) if pass.length < 8 or pass.length > 40 diff --git a/tools/password/winscp_decrypt.rb b/tools/password/winscp_decrypt.rb index 4e8cd79932..5ef07b2999 100755 --- a/tools/password/winscp_decrypt.rb +++ b/tools/password/winscp_decrypt.rb @@ -1,5 +1,10 @@ #!/usr/bin/env ruby +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'rex/parser/winscp' diff --git a/tools/recon/google_geolocate_bssid.rb b/tools/recon/google_geolocate_bssid.rb index fc2e23737f..189421451d 100755 --- a/tools/recon/google_geolocate_bssid.rb +++ b/tools/recon/google_geolocate_bssid.rb @@ -1,4 +1,10 @@ #!/usr/bin/env ruby + +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + # # This tool asks Google for the location of a given set of BSSIDs # diff --git a/tools/recon/list_interfaces.rb b/tools/recon/list_interfaces.rb deleted file mode 100755 index 0cf1fb2169..0000000000 --- a/tools/recon/list_interfaces.rb +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env ruby -# -# $Id$ -# $Revision$ -# -# This small utility will display all the informations about the network interfaces -# that one can use under Windows with modules using pcaprub and having the INTERFACE option (ex: arp_poisonning, arp_sweep, ...). -# To use th interface option under Windows use the Index value displayed by this tool (ex: "SET INTERFACE 1") -# -# - -msfbase = __FILE__ -while File.symlink?(msfbase) - msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase)) -end - -$:.unshift(File.expand_path(File.join(File.dirname(msfbase), '..', '..','lib'))) -require 'msfenv' - -$:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB'] - -if RUBY_PLATFORM == "i386-mingw32" - begin - require 'network_interface' - rescue ::Exception => e - $stderr.puts "Error: NetworkInterface is not installed..." - exit - end - - unless ( - NetworkInterface.respond_to?(:interfaces) and - NetworkInterface.respond_to?(:addresses) and - NetworkInterface.respond_to?(:interface_info) - ) - $stderr.puts "Error: Looks like you are not running the latest version of NetworkInterface" - exit - end - found = false - NetworkInterface.interfaces.each_with_index do |iface, i| - found = true - detail = NetworkInterface.interface_info(iface) - addr = NetworkInterface.addresses(iface) - puts "#" * 70 - puts "" - puts "INDEX : " + (i + 1).to_s - puts "NAME : " + detail["name"] - puts "DESCRIPTION : " + detail["description"] - puts "GUID : " + detail["guid"] - if addr[NetworkInterface::AF_LINK][0]['addr'] - puts "MAC ADDRESS : #{addr[NetworkInterface::AF_LINK][0]['addr']}" - else - puts "MAC ADDRESS : NONE" - end - if addr[NetworkInterface::AF_INET][0]['addr'] and addr[NetworkInterface::AF_INET][0]['netmask'] - puts "IP ADDRESS : #{addr[NetworkInterface::AF_INET][0]['addr']}/#{addr[NetworkInterface::AF_INET][0]['netmask']}" - else - puts "IP ADDRESS : NONE" - end - puts "" - end - if found - puts "#" * 70 - else - $stderr.puts "Error, no network interfaces have been detected" - end -else - $stderr.puts "Error: This script is useful only on Windows, under other OS just use the built-in commands (ifconfig, ip link show, ...)" - exit -end diff --git a/tools/recon/makeiplist.rb b/tools/recon/makeiplist.rb index 912fbdeddf..37a8a36d25 100755 --- a/tools/recon/makeiplist.rb +++ b/tools/recon/makeiplist.rb @@ -1,12 +1,17 @@ #!/usr/bin/env ruby +## +# This module requires Metasploit: https://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + # -# This script takes a list of ranges and converts it to a per line ip list. +# This script takes a list of ranges and converts it to a per line IP list. # Demonstration: # echo 192.168.100.0-50 >> rangelist.txt # echo 192.155-156.0.1 >> rangelist.txt # echo 192.168.200.0/25 >> rangelist.txt -# ruby tools/makeiplist.rb +# ruby tools/recon/makeiplist.rb # # Author: # mubix @@ -25,10 +30,10 @@ require 'optparse' class OptsConsole def self.parse(args) - options = {'output' => 'iplist.txt'} + options = {} opts = OptionParser.new do |opts| - opts.banner = %Q|This script takes a list of ranges and converts it to a per line ip list. + opts.banner = %Q|This script takes a list of ranges and converts it to a per line IP list. Usage: #{__FILE__} [options]| opts.separator "" @@ -51,15 +56,23 @@ Usage: #{__FILE__} [options]| end end + opts.parse!(args) + if options.empty? + puts "[*] No options specified, try -h for usage" + exit + end + begin - opts.parse!(args) if options['input'] == nil puts opts - raise OptionParser::MissingArgument, "-i is a required option" + raise OptionParser::MissingArgument, '-i is a required argument' end unless ::File.exist?(options['input']) raise OptionParser::InvalidArgument, "Not found: #{options['input']}" end + if options['output'] == nil + options['output'] = 'iplist.txt' + end rescue OptionParser::InvalidOption puts "[*] Invalid option, try -h for usage" exit @@ -68,11 +81,6 @@ Usage: #{__FILE__} [options]| exit end - if options.empty? - puts "[*] No options specified, try -h for usage" - exit - end - options end end