-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreds.js
22 lines (20 loc) · 855 Bytes
/
creds.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
* This software is Copyright (c) 2016 AverageSecurityGuy <stephen at averagesecurityguy.info>,
* and it is hereby released to the general public under the following terms:
* Redistribution and use in source and binary forms, with or without
* modification, are permitted.
*/
try {
cursor = db.system.users.find();
while ( cursor.hasNext() ) {
c = cursor.next();
if (c['credentials']['MONGODB-CR']) {
print(c['user'] + ':' + c['db'] + ':' + c['credentials']['MONGODB-CR']);
}
if (c['credentials']['SCRAM-SHA-1']) {
s = c['credentials']['SCRAM-SHA-1'];
shash = '$scram$' + s['iterationCount'] + '$' + s['salt'].replace('=', '') + '$' + s['storedKey'].replace('=', '');
print(c['user'] + ':' + c['db'] + ':' + shash);
}
}
} catch(err) {}