나는 하나의 실험실 용 WebGoat 견본을 해결 해왔다. 연습 중 하나에서 자동으로 "테스트"를 수행하기 위해 urllib2와 함께 python 스크립트를 사용하려고 했으므로 수동으로 ascii (substr (first_name, 3,1))> 97 등을 사용해야했습니다.WebGoat URL에 대한 스크립트 액세스?
import urllib2
import urllib
import cookielib
import sys
myjar = cookielib.FileCookieJar("cookies.txt");
cookieHandler = urllib2.HTTPCookieProcessor(myjar)
password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
tlurl="http://localhost:8081/webgoat/attack"
password_mgr.add_password(None,tlurl,user="guest",passwd="guest")
authhandler = urllib2.HTTPBasicAuthHandler(password_mgr)
opener = urllib2.build_opener(cookieHandler, authhandler)
data = [('Connection','keep-alive'),('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; da; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7')]
def write_f_to_f(fname,f):
f1 = open(fname,"w")
f1.write(f.read())
f1.close()
def gen_req(url,referer=None):
req = urllib2.Request(url)
print "url: %s"%url
mydata = data
if referer != None:
mydata.append(('Referer',referer))
[ req.add_header(k,v) for k,v in mydata ]
return req
sys.stdout.flush()
url = "http://localhost:8081/webgoat/attack"
req = gen_req(url)
f = opener.open(req)
write_f_to_f("f1.html",f)
f.close()
params = urllib.urlencode({'start':'Start WebGoat'})
qs = urllib.urlencode({'Screen':107, 'menu':1200 })
url = "http://localhost:8081/webgoat/attack"
req = gen_req(url,url)
f = opener.open(req, params)
write_f_to_f("f2.html",f)
f.close()
ourl = url
url = "http://localhost:8081/webgoat/attack?%s"%qs
req = gen_req(url,ourl)
f = opener.open(req)
write_f_to_f("f3.html",f)
f.close()
ourl = url
url = "http://localhost:8081/webgoat/attack?%s"%qs
req = gen_req(url,ourl)
f = opener.open(req)
write_f_to_f("f4.html",f)
f.close()
NB : F2, F3 및 f4.html 일명 urllib2가 스크립트를 사용할 때 다른 URL을 시도 그겁니다 같은 페이지를 얻는 것은 모든 기본적인 첫 페이지와 브라우저에서 액세스하는 경우뿐만 아니라 같은 페이지입니다 : 나는 "어려운 길"이라는 과제에 대한 답을하고 그것을 들여 줬다. 지금 나는 어떤 종류의 메커니즘이 urllib 스크립트가 내용에 접근하는 것을 막는 지 궁금하다.
트라이 webgoat과 webgoat 콘솔 내 로컬 바람둥이 접근 에드은 말한다 :
Sat Feb 13 12:31:14 CET 2010 | 127.0.0.1:127.0.0.1 | org.owasp.webgoat.session.ErrorScreen | [Screen=107,menu=1200]
errorscreen createContent Error:null message:Invalid screen requested. Try: http://localhost/WebGoat/attack
- WebGoat: Sat Feb 13 12:31:14 CET 2010 | 127.0.0.1:127.0.0.1 | org.owasp.webgoat.session.ErrorScreen | [Screen=107,menu=1200]
Sat Feb 13 12:31:14 CET 2010 | 127.0.0.1:127.0.0.1 | org.owasp.webgoat.session.ErrorScreen | [Screen=107,menu=1200]
정말 지금까지 내가 말할 수있는 나를 도와 나던.
좀 더 자세한 정보를 제공 할 수 있습니까? 예상되는 결과는 무엇입니까? – jathanism
일반 브라우저를 사용할 때 "Screen = 1600"의 내용을 얻지 만 파이썬 스크립트를 사용할 때/webgoat/attack의 내용은 어떤 쿼리 문자열 없이도 얻을 수 있습니다. – svrist