首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

Python 格式化字符串漏洞(Django为例)

master/formatstring.md Python中的格式化字符串 Python中也有格式化字符串的方法,在Python2老版本中使用如下方法格式化字符串: "My name is %s" % ('phithon...', ) "My name is %(name)%" % {'name':'phithon'} 后面为字符串对象增加了format方法,改进后的格式化字符串用法为: "My name is {}".format...('phithon') "My name is {name}".format(name='phithon') 很多人一直认为前后两者的差别,仅仅是换了一个写法而已,但实际上format方法已经包罗万象了...https://docs.python.org/3.6/library/string.html#formatstrings 举一些例子吧: "{username}".format(username='phithon...r}".format(username='phithon') # 等同于 repr(username) "{number:0.2f}".format(number=0.5678) # 等同于 "%0.2f

1.4K20
您找到你想要的搜索结果了吗?
是的
没有找到

浅析白盒审计中的字符编码及SQL注入

之后的phithon内容管理系统会逐步完善,但会一直使用这个数据表。...把phithon内容管理系统中set names修改成gb2312: ? 结果就是不能注入了: ? 有些同学不信的话,也可以把数据库编码也改成gb2312,也是不成功的。...我们继续做试验,phithon内容管理系统v1.2:,就用mysql_real_escape_string来过滤输入: ? 我们来试试能不能注入: ? 一样没压力注入。...比如,我们的phithon内容管理系统v2.0版本更新如下: ? 已经不能够注入了: ? 在我审计过的代码中,大部分cms是以这样的方式来避免宽字符注入的。...比如我们的phithon内容管理系统v3.0 ? 我们可以看到,它在sql语句执行前,将character_set_client设置成了binary,所以可以避免宽字符注入的问题。

81631
领券