好的。所以。我试图用暴力破解不和谐链接的最后3个字母(这是难题的一部分,请不要判断我)。第一部分是众所周知的,因为如果有的话,由于多种明显的原因,整个事情就没有意义。我做了一个剧本。我使用了硒框架来访问邀请页面并搜索“邀请无效”消息。页面会一点一点地加载,因此我的脚本将等待标题栏完全加载,然后检查页面源是否包含:'Invite Invalid'(或'Einladungungültig',因为discord检测到im的来源)。非常简单。但是:几个小时后,整个过程崩溃了。不仅如此,我的整个PC都无法再访问Internet(直到一切重启后,我重新启动它为止)。尽管并非总是在同一时间发生,但该错误是可重现的。 知道为什么会这样吗?提前谢谢。
class title_bar_loaded(object):
#callable, checks if title bar is loaded
import time
from _thread import start_new_thread
from selenium.webdriver.support.ui import WebDriverWait
from selenium import webdriver
# some stuff
threads_done = 0
thread_number = 4
timeout = 60
invites = []
starting_bit = 'http://discord.gg/akfs'
missing_letters = 3
def check_invite(b, driver):
driver.get(b)
try:
WebDriverWait(driver,timeout).until(title_bar_loaded())
except:
driver.refresh()
return check_invite(b,driver)
page = driver.page_source
return not 'Einladung ungültig' in str(page) # german because ip
def try_loop(num):
global threads_done
start = int(52**3 / thread_number * num)
end = int(52**3 / thread_number * (num+1))
driver= webdriver.Chrome('Z:/Downloads/chromedriver/chromedriver.exe')
driver.implicitly_wait(timeout)
driver.minimize_window()
for i in range(start, end): # this loop goes through all possibilities
invite = create(i)
ok = check_invite(invite,driver)
if ok:
print(invite)
invites.append(invite)
threads_done += 1
def create(pos):
#creates an invite link based on the number pos and the given part
# 'akfs' so pos = 0 would be akfsaaa and pos = 1 would be akfsAaa
# because for some reason caps matters in discord links
def main():
# creates the threads, calls try_loop for each, but puts a different
# number into every single one
# keep script active after all threads have been started and print all
# invites after being done
if __name__ == '__main__':
main()