我在 Windows 7 中使用 python 3.3.0。我有两个文件:dork.txt 和 fuzz.py
dork.txt 包含以下内容:
/about.php?id=1
/en/company/news/full.php?Id=232
/music.php?title=11
fuzz.py 包含以下内容:
srcurl = "ANY-WEBSITE"
drkfuz = open("dorks.txt", "r").readlines()
print("\n[+] Number of dork names to be fuzzed:",len(drkfuz))
for dorks in drkfuz:
dorks = dorks.rstrip("\n")
srcurl = "http://"+srcurl+dorks
requrl = urllib.request.Request(srcurl)
#httpreq = urllib.request.urlopen(requrl)
# Starting the request
try:
httpreq = urllib.request.urlopen(requrl)
except urllib.error.HTTPError as e:
print ("[!] Error code: ", e.code)
print("")
#sys.exit(1)
except urllib.error.URLError as e:
print ("[!] Reason: ", e.reason)
print("")
#sys.exit(1)
#if e.code != 404:
if httpreq.getcode() == 200:
print("\n*****srcurl********\n",srcurl)
return srcurl
因此,当我输入正确的网站名称时/about.php?id=1
,它可以正常工作。但是当我提供具有 的网站时/en/company/news/full.php?Id=232
,它首先打印Error code: 404
然后给我以下错误:UnboundLocalError: local
variable 'e' referenced before assignment
或UnboundLocalError: local variable 'httpreq' referenced before assignment
我可以理解,如果网站没有包含的页面/about.php?id=1
,它会给出Error code: 404
但为什么它不返回for
循环来检查文本文件中剩余的傻瓜???为什么它停在这里并抛出错误?
我想制作一个脚本来从一个网站地址中找出有效页面,例如:www.xyz.com