There are many ways to gain control over a compromised system and a common method is to gain command prompt access. However, most basic firewalls block direct remote connections, which is one benefit of using a reverse shell, to bypass firewall restrictions. The basic premise of my two scripts will be that one machine (Attacker) will act as a Server, which I will use Kali Linux, and the second machine (Victim) will act as the Client, which will be a distribution of Linux - Ubuntu. In the two scripts, the Victim machine will initiate a connection to the Attacker’s machine where the Attacker's machine will listen for and accept incoming connections on a specified port.
Source Code Step-by-Step Explanation
Attacker’s Code (Server)
1. Input Host IP Address and Port Number
2. Create socket with socket.socket function
3. Bind socket to IP Address & Port with socket.bind function
4. Put the socket in listening mode with socket.listen function
5. Accept connection with socket.accept function
6. “While” loop that sends commands to the Client and retrieves/prints results until “exit” is entered
7. Close connection
Victim’s Code (Client)
1. Input Host IP Address and Port Number
2. Create socket with socket.socket function
3. Connect to Server
4. “While” loop that receives commands from the Server, executes/retrieves results, and sends results back to the Server until “exit” is entered
5. Close connection
On this page of the site you can watch the video online How to Code a Reverse Shell Program in Python | Class Presentation | Programming for Cybersecurity with a duration of hours minute second in good quality, which was uploaded by the user TLT TV 17 August 2021, share the link with friends and acquaintances, this video has already been watched 17 times on youtube and it was liked by 0 viewers. Enjoy your viewing!