Bill,

I don't have IMDC python compiler. Should I use this script with another python 
compiler?

Regards

PKM
On Mar 11, 2010, at 11:19 PM, William Fisher wrote:

> On 3/11/10 1:49 PM, Patrick K. Mugabeni wrote:
>> Exactly.Is there a key generator in intermapper if I provide it with device 
>> ID? 
> Here is a quick script that can be run with IMDC python. Set the
> password values, authProto value and the authEngineID value then run the
> script.
> 
> #!/usr/local/imdc/core/python/bin/imdc -OO
> #
> # snmpv3key.py
> 
> authPassword = 'maplesyrup'
> privPassword = 'maplesyrup'
> authProto = 'sha1'
> #authProto = 'md5'
> authEngineID = '000000000000000000000002'
> 
> 
> def snmpv3PasswordToLocalizedKey(password, engineID, authProto):
>    import hashlib
>    passwordLen = len(password)
>    m = hashlib.new(authProto)
>    for i in xrange(1048576 // passwordLen):
>        m.update(authPassword)
>    m.update(authPassword[0:1048576 % passwordLen])
>    blockKey = m.digest()
> 
>    m = hashlib.new(authProto)
>    m.update(blockKey)
>    m.update(engineID.decode('hex'))
>    m.update(blockKey)
>    return m.hexdigest()
> 
> 
> if __name__ == '__main__':
>    print 'Localized Auth Key: %s' % \
>            snmpv3PasswordToLocalizedKey(authPassword, authEngineID,
> authProto)
>    print 'Localized Priv Key: %s' % \
>            snmpv3PasswordToLocalizedKey(privPassword, authEngineID,
> authProto)
> 
> 
> 
> -- 
> Bill Fisher
> Dartware, LLC
> ____________________________________________________________________
> List archives: 
> http://www.mail-archive.com/intermapper-talk%40list.dartware.com/
> To unsubscribe: send email to: [email protected]
> 

____________________________________________________________________
List archives:
http://www.mail-archive.com/intermapper-talk%40list.dartware.com/
To unsubscribe: send email to: [email protected]

Reply via email to