Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to implement Code Audit with python

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how python implements code auditing. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Python Code Audit-Command execution vulnerability (self-written code) 0x00 source code def execute (request): context = {} ip= request.POST.get ("ip") username= request.POST.get ("username") password= request.POST.get ("password") idnex= int (request.POST.get ("index")) current_time=request.POST.get ("time") context = {"ip": ip, "username": username, "password": password "result": False} ippattern= "(25 [0-5] | 2 [0-4]\ d | [0-1]\ d {2} | [1-9]?\ d)\. (25 [0-5] | 2 [0-4]\ d | [0-1]\ d | [1-9]?\ d)\. (25 [0-5] | 2 [0-4]\ d | [0-1]\ d {2} | [1-9]?\ d)\ . (25 [0-5] | 2 [0-4]\ d | [0-1]\ d {2} | [1-9]?\ d) "if (re.match (ippattern) Ip): pass else: context ['error'] = "ip incorrectly formatted" log ("error", "[-]% s ip is error"% (ip)) print ("[-]% s ip malformed"% (ip)) # return render (request,' test.html', context) return HttpResponse (json.dumps (context)) try: length Scripts=executeScript.getScriptNums () if (idnex > length or idnex)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report