Today morning i was scrolling through to GitHub (yes i actually do that) and found something quite interesting. There was this repo called “riposte” and it claimed that it could turn python scripts into a shell, YES, just like our favourite Metasploit Framework.
This is the repo btw https://github.com/fwkz/riposte
So i thought why not share this information with other Python developers and cyber security enthusiasts. I’ll keep this really short and straight to the point.
Install the library riposte and make sure that you are running python 3.6 or higher.
Then import the Riposte library. Also, its been a while since I’ve used the platform library. So i thought of incorporating that into my script.
On line 7 we add the prompt, you can customise it to your liking. Whatever you enclose between the double quotes, will be considered as the prompt.
Next we need to add commands to our shell. To do that always start of with @ sys.command. It is recommended to create a function write after that. The method platform.architecture() gives us the details about the type of processor which we are using. On line 12, we have another method called sys.success(), which basically is the print function, and displays the output on the shell.
Similarly, i created multiple functions for this interactive script. When you are done with your code, end the file by typing the sys.run() function. We do this to let the library know that the above code should be included in the shell. As seen on line 29.
It’s all done, we run the script by using python3 <script name.py> and there you have it. It works just like any other shell. If you press TAB, then its going to show you the options. Of course, if you type in an unknown command it will display an error.
I hope you all enjoyed reading this short post, its actually one of my first blog posts on this account. From time to time, i will be covering topics like Cyber Security, Programming and just tech in general sometimes.