学无先后,达者为师

网站首页 编程语言 正文

python2中input()漏洞

作者:Pz_mstr 更新时间: 2022-05-12 编程语言

前言

Python2中有两种接收用户输入的方法
input():接收用户输入且不修改输入的类型
raw_input():接收用户输入并强制修改为字符串类型

input()漏洞

input()原样接收用户输入会导致严重的代码注入漏洞,下面请看例子:

例子1

passwd = "my123passwd"
temp = input("Enter passwd:")
if temp == passwd:
	print("Succees.")
else:
	print("Sorry")

在这里插入图片描述

例子2

input = input("Enter a number")
print(input)

在这里插入图片描述

原文链接:https://blog.csdn.net/qq_35544379/article/details/124055827

栏目分类
最近更新