def process(): videocode = input("请输入视频地址:") list_ini = getcomment.getlist(videocode) list_ini.soup() list_ini.finder() list_ini.getmark() bullet = (input('请输入要查找的关键词:')) all_bullet = list_ini.filterconcrete(bullet) all_crc32s = list_ini.getcrc32() #crackcrc32.create_table() crack.main() all_uid = [] for ch in all_crc32s: temp = crack.crackl4(ch)[0] #print(type(temp)) all_uid.append(temp) all_space = [] for ch in all_uid: temp = ['http://space.bilibili.com/', ch] buffer = ''.join(temp) all_space.append(buffer) user_nickname = visit.user_info(all_space) nicknames = user_nickname.getnickname() print('弹幕信息以及发送者信息:', '\n') for i in range(len(all_bullet)): temp = ['http://space.bilibili.com/', all_uid[i]] print('弹幕内容:', ' ', all_bullet[i], ' ', '用户昵称:', ' ', nicknames[i], ' ', '空间网址:', ' ', (''.join(temp))) return all_bullet, all_crc32s, all_space, all_uid, bullet, ch, i, list_ini, nicknames, user_nickname, videocode
import pyximport pyximport.install() import crack crack.main()
from crack import main if __name__ == '__main__': main()
totalattempts = 0 totalcorrect = 0 print "Suite | Captchas | Correct | Percentage" print "--------------------------------------------" for suite in os.listdir("./test/"): if suite.startswith('.'): continue # ignore config files args = '' if os.path.isfile("test/%s/test-args.txt"%(suite)): f = open("./test/%s/test-args.txt"%(suite),'r') args = f.read()[:-1] attempts = 0 correct = 0 for img in os.listdir("./test/%s/"%(suite)): if img == 'index.php' or img == 'test-args.txt': continue guess = crack.main(("./test/%s/%s %s"%(suite,img,args)).split(' ')) if img == guess[0]: solved.append(guess[0]) correct += 1 else: failed.append((guess,img)) attempts += 1 totalattempts += attempts totalcorrect += correct print "{0:10s} | {1:8d} | {2:7d} | {3:.2%}".format(suite,attempts,correct,float(correct)/float(attempts)) print "{0:10s} | {1:8d} | {2:7d} | {3:.2%}".format('Total',totalattempts,totalcorrect,float(totalcorrect)/float(totalattempts)) if '-v' in options: print "\n ----- Incorrect Cracks ----- " print "{0:10s} | {1:12s} | {2:s}".format('Actual','Guess','Confidence') print "-----------|--------------|-----------"