Exploit databaseDownload repository ZIP
GH-a4c6a8fe40e2cb339842ad2b9d2f7f34
gteissier/cve-2016-6271
Sources for CVE-2016-6271
1 sourcePreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files6
gteissier/cve-2016-6271Revision 4512aa621a23
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
mitm-bzrtp/zrtp/auth.py
Python · 1,038 bytes#!/usr/bin/python3
# Project : pyzrtp
# Copyright (C) 2017 Orange
# All rights reserved.
# This software is distributed under the terms and conditions of the 'BSD 3-Clause'
# license which can be found in the file 'LICENSE' in this package distribution.
import hmac
import hashlib
from functools import partial
from binascii import hexlify
class UnsupportedAuthType(Exception): pass
class HMAC_SHA:
def __init__(self, key):
self.m = hmac.new(key, digestmod=hashlib.sha256)
def update(self, data): self.m.update(data)
def digest(self): return self.m.digest()
def hexdigest(self): return hexlify(self.digest())
AUTHS = (
# HMAC-SHA1 32 bits
(b'HS32', lambda k: HMAC_SHA(k)),
# HMAC-SHA1 80 bits
(b'HS80', lambda k: HMAC_SHA(k)),
)
def get(name):
auth = None
for (aname, constructor) in AUTHS:
if aname == name: return constructor
if auth is None: raise UnsupportedAuthType(name)
if __name__ == '__main__':
def auth(name, key, data):
m = get(name)(key)
m.update(data)
return m.hexdigest()