Mobilepass

From miki
Jump to navigation Jump to search

MobilePASS is an one-time-password solution used to connect to VPN.

Tips

Transfer / restore MobilePASS token from one VM to another

  • The MobilePASS token is updated at each login.
  • When doing a backup / restore, one must recover the token from the old machine to the new one.
  • Copy the file at %appdata%\SafeNet\MobilePASS.

Generate OTP code in Python (example)

import pyotp
import base64
import hashlib
import os

key = 'as retrieved from the memory dump'

if __name__ == '__main__':
        path = os.path.join(os.getenv('HOME'), '.mpass.ctr')
        try:
                f = open(path, 'r')
                counter = int(f.read())
        except IOError:
                counter = 0
        finally:
                f = open(path, 'w')

        otp = pyotp.HOTP(base64.b32encode(key), digest=hashlib.sha256)
        print 'OTP ===> %s' % otp.at(counter)
        f.write('%s' % (counter+1))
        f.close()