从网页上刮掉md5并将它们与普通密码进行比较

时间:2017-11-24 20:19:59

标签: python

所以我有以下代码通过一个给定的网页擦除并使用正则表达式找到md5s(我知道你从来没有在源代码中找到md5s但是它用于uni项目)。一旦找到md5s,它就会将它与常用密码列表进行比较,这些密码也会被哈希处理。问题是它总是返回md5s中没有一个匹配我知道是假的。

如果有人可以提供帮助那会很棒,但我觉得问题是插入using (ClientContext clientContext = new ClientContext("https://sharepointed.com")) { clientContext.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials; oWeb = clientContext.Web; List myList= oWeb.Lists.GetByTitle("MyList"); CamlQuery camlQuery = new CamlQuery(); camlQuery.ViewXml = ("<View><Query> <OrderBy> <FieldRef Name='ID' Ascending='False' /> </OrderBy> </Query> <RowLimit>1</RowLimit> </View>"); Microsoft.SharePoint.Client.ListItemCollection listItems = myList.GetItems(camlQuery); clientContext.Load(listItems); clientContext.ExecuteQuery(); } ,因为它可能无法迭代是我的预感。

md5

从REGEX输出

`[+] 6 md5s发现: 5efweev789d3d1d09794d8f021f40f0e 5fcfd41e547aewfwefwefff47fdd3739 9d377b10ce778few2334c7g2c63a229a FEA0F1F6FEDE90BDfn89049194DEAC11 aDsxMzE0MDY7ajsx785g90f0MjAwOzQw d1133275ee2118b9739440f759fc0524

比较输出

md5s = re.findall(r'[a-zA-Z0-9]{32}',webpage.decode())
md5s.sort()
print (f'[+] {len(md5s)} md5s Found:')
for md5 in md5s:
    print(md5)

passwd_found = False

dic = []

for k in dic:
    md5hash = hashlib.md5(k.encode('utf-8'))
    #print(md5hash.hexdigest())
    if md5 in md5hash.hexdigest():
        passwd_found = True
    else:
        passwd_found = False

    if passwd_found:
         print (f'[+] Password recovered: {k}')
    else:
         print ('[-] Password not recovered')

1 个答案:

答案 0 :(得分:2)

在此代码中,您认为 .model small .stack 100h .data num db 7,5,3,4,2 ;my array msg db "The min number is: $" .code main PROC mov ax,@data mov ds,ax mov ax, 0 mov bl, num [0] ; store first element of array in bl mov cx, 4 mov si, 1 ; index of second element calMin: mov al, num [si] cmp bl, al jng continue ; jng is used for signed numbers mov bl, al ; exchange values if smaller continue: inc si loop calMin mov ah, 09h mov dx, offset msg int 21h mov cl, bl neg cl ; 2's complement the min number ( to check if its negative or positive number ) js posNum ; jmp to posNum if sign flag is set mov bl, cl jz posNum negNum: mov ah, 02h mov dl, '-' ; print minus symbol if negative number int 21h posNum: mov ah, 02h mov dl, bl add dl, 48 int 21h exit: mov ah,04ch int 21h main ENDP END main 的价值是什么?

md5

在此代码段之前,for k in dic: md5hash = hashlib.md5(k.encode('utf-8')) #print(md5hash.hexdigest()) if md5 in md5hash.hexdigest(): passwd_found = True # ... 在循环中使用。 此时,md5的值是前一循环的最后一个值。 这几乎不是你想要的。

如果您想在md5(在您抓取的页面上)找到散列值出现的dic的值,最好这样做:

md5s

也就是说,将md5s = frozenset([m.lower() for m in md5s]) for k in dic: md5hash = hashlib.md5(k.encode('utf-8')) if md5hash.hexdigest() in md5s: print("found", k) 变成一组, 快速搜索它, 然后为md5s中的每个值, 检查其散列值是否包含在dic