首页 > 代码库 > system()命令注入

system()命令注入

#include "stdlib.h"
#include "stdio.h"

void main()
{
	char s[255];
	
	while (1)
	{
		printf("input cmd: ");
		scanf("%s", s);
		system(s);
	}		
	
}

输入cmd1|pwd:cmd2指行;

输入cmd1&&cmd2:cmd1指行,cmd2执行;

输入cmd1&cmd2:cmd2执行,cmd1指行并挂住;

输入cmd1 & cmd2:cmd1执行,报错,cmd2执行;

输入cmd1;cmd2:cmd1指行,cmd2执行;


参考:

http://blog.csdn.net/hitwangpeng/article/details/45716821

system()命令注入