The following code is an example of a reverse backdoor (proxy/shell) that creates a connection back to a running nc (netcat) listener hosted on our attack machine.
This example uses the loopback address (localhost/127.0.0.1) for demonstration.
First, start a netcat listener on your attack machine (e.g. Kali Linux).
$ nc -lvnp 4444
listening on [any] 4444
Secondly, run the python reverse shell on the target host to create a connection back to the attack system.
$ python3.10 reverse_shell.py