Mobilepass: Difference between revisions

From miki
Jump to navigation Jump to search
(Created page with "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 {{file|%appdata%\SafeNet\MobilePASS}}.")
 
No edit summary
 
Line 6: Line 6:
* When doing a backup / restore, one must recover the token from the old machine to the new one.
* When doing a backup / restore, one must recover the token from the old machine to the new one.
* Copy the file at {{file|%appdata%\SafeNet\MobilePASS}}.
* Copy the file at {{file|%appdata%\SafeNet\MobilePASS}}.

=== Generate OTP code in Python (example) ===
* [http://sbudella.altervista.org/blog/20180128-mobilepass.html Hacking Safenet MobilePass OTP Token]

<source lang="python">
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()
</source>

Latest revision as of 12:04, 14 April 2024

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()