aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/cheat/pass
blob: b45b586d144e99d3fc22c330da746a5709a92761 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Autotype:
autotype: user :tab pass :enter

# check if pawned

Python de Dropper:
```
import urllib2
import hashlib
 
CLEAN = 0
PWNED = 1
ERROR = -1
 
def check_password(password):
    m = hashlib.sha1()
    m.update(password.encode('utf-8'))
    hx = m.hexdigest().upper()
 
    headers = {
        'User-Agent': 'pass-check',
        'api-version' : '2'
    }
 
    try:
        req = urllib2.Request('https://api.pwnedpasswords.com/range/' + hx[:5], headers=headers)
        response = urllib2.urlopen(req)
        for line in response.read().splitlines():
            if hx[5:] == line.split(":")[0]:
                return PWNED
        return CLEAN
 
    except:
        return ERROR
 
if __name__ == '__main__':
    if check_password("Password1") == PWNED:
        print("PWNED !")
    else:
        print("MAYBE")
```

https://gitlab.com/darnir/pass-audit