Replicating Metasploit's screen capturing

In this section, we will automate capturing a screenshot from the target machine and retrieve it over HTTP reverse shell. Getting a screenshot from the target Desktop can be useful to see what programs and activities are going on on the target side. In Metasploit Meterpreter, there is a function called screengrab(), which will take a snapshot from the target machine and transfer it back to the attacker machine. So here, we will do something similar in our existing HTTP shell. For this purpose, we will be using a library called Pillow at the target. This is a high-level image library in Python. The installation is quite simple. You just need to run pip install Pillow via cmd.

Before doing that, just ...

Get Python for Offensive PenTest now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.