title: How to import an already-open shell into metasploit
body: <p>As part of an exercise, I am targeting a Linux system deployed in a very unusual and restricted networking environment.  Among other things, there is no traditional networking route between the attacking machine and the victim machine; the machines cannot ping each other, nor can they communicate via TCP/IP.</p>
  <p>I have discovered a communications channel between the machines, and have written code that runs on the attacking machine.  It opens the channel and ultimately gives the user on the attacking machine a shell on the victim machine.</p>
  <p>An interaction looks something like this:</p>
  <pre><code>me@attacking-machine $ ./open-shell-on-victim --foo=foo_stuff --bar=bar_stuff
  Connecting...done
  # Now I have a shell on the victim machine
  user@victim-machine $ whoami
  user
  user@victim-machine $ hostname
  victim-machine
  </code></pre>
  <p>Now that I have a shell on the victim, I would like to leverage this to use metasploit to search for ways to escalate my privileges.</p>
  <p>My questions are:</p>
  <ol>
  <li><p>Now that I have a shell that I can launch by running a command on the attacking machine, how can I import this into a metasploit session, so I can use and manage the connection from the metasploit command line?</p>
  </li>
  <li><p>Is it possible to upgrade this shell to a meterpreter session, and if so, how to go about doing so?  Recall that there is no TCP/IP networking connection between the machines; the only communication is via the channel that I am exploiting to get the shell.</p>
  </li>
  </ol>