Skip to content

Instantly share code, notes, and snippets.

@idiom
Created June 30, 2017 21:39
Show Gist options
  • Save idiom/399d53f9ae233c819065377fb6170cb7 to your computer and use it in GitHub Desktop.
Save idiom/399d53f9ae233c819065377fb6170cb7 to your computer and use it in GitHub Desktop.
LokiBot Mutex Generator
import argparse
import hashlib
"""
Generates a LokiBot mutex for the given Machine GUID
Usage: python lmute.py {guid}
By @seanmw
"""
def calc_mutant(guid):
_elist = '0123456789ABCDEF'
result = ''
mhash = hashlib.md5(guid).hexdigest()
for i in range(0, len(mhash), 2):
result += _elist[int(mhash[i:i+2], 16) >> 4].encode('hex')
result += _elist[int(mhash[i:i + 2], 16) & 0x0F].encode('hex')
return result.decode('hex')[0:24]
def main():
parser = argparse.ArgumentParser(description='Generate a LokiBot Mutex for the give MachineGUID')
parser.add_argument("guid", help="MachineGuid.")
args = parser.parse_args()
print 'Calculating mutex for: %s' % args.guid
print 'Loki Mutex: %s' % calc_mutant(args.guid)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment