Created
September 2, 2013 11:35
-
-
Save diabloneo/6411942 to your computer and use it in GitHub Desktop.
Calculate RADIUS packet authenticator. Input packet's hex string, output authenticator in hex form.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import hashlib | |
import base64 | |
import binascii | |
def main(): | |
pktstr = raw_input() | |
m = hashlib.md5() | |
m.update(base64.b16decode(pktstr.replace(' ', '').upper())) | |
authenticator = binascii.b2a_hex(m.digest()) | |
print "authenticator:" | |
print "%s" % (authenticator) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example:
~/programming/python$ ./rds_authenticator.py
28 00 00 35 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 0d 31 38 36 31 30 34 37 36 33 30 30 1f 0e 38 34 37 61 38 38 65 37 37 33 30 64 04 06 c0 a8 01 fa 74 65 73 74 69 6e 67 31 32 33
authenticator:
ba2d9d976315f1054c8f9a8d18ef55f1