for word in raw_words:
# 删除末尾置顶空行如\r\n等
word = word.rstrip()
if resume isnotNone:
if found_resume:
words.put(word)
else:
if word == resume:
found_resume = True
print("Resuming wordlist from : {} ".format(resume))
else:
words.put(word)
return words
然后我们需要完成一个用来扫描的函数,首先他回判断队列中的内容是否为空,如果不为空就拿出来一个进行使用,然后根据是否存在"."来判断其是目录还是文件,并且如果我们使用的是无后缀的字典,那么我们回根据传入的extensions参数中的内容去给我们的字典加入相应的后缀,并存入扫描使用的列表中,最后依次从这个列表中获取内容,加在我们的url后面,尝试去访问,根据访问的结果判断是否存在这个文件。
# 如果没有后缀则添加后缀
if extensions and"."notin attempt:
for extension in extensions:
attempt_list.append("/{}{}".format(attempt,extension))
for brute in attempt_list:
url = "{}{}".format(target_url,brute)
try:
r = requests.get(url,headers=header)
if len(r.text) and r.status_code in code_list:
print("[{}] => {}".format(r.status_code,url))
except:
pass