MikroTik Tutorial: How to recover RouterOS passwords from a backup file

MikroTik Tutorial: How to recover RouterOS passwords from a backup file

These steps will help you recover a forgotten password from an unencrypted RouterOS backup file. To complete these step we will use a python tool called RouterOS-Backup-Tools written by Lorenzo Santina (BigNerd95). I have included steps specific to Windows and Linux which vary slightly.

Jump to Steps for… Windows | Linux

Windows MikroTik Password Recovery

Install Python 3 and git from Windows

Open a git bash console and create a new directory

mkdir rostest
cd rostest

Clone the RouterOS-Backup-Tools repo

git clone https://github.com/BigNerd95/RouterOS-Backup-Tools.git

Create a virtualenv and install the dependency library

virtualenv ./venv
./venv/Scripts/activate.bat
pip install pycryptodome

Now we are ready to extract our .backup file and decode the passwords. Before beginning this step, copy your backup file into the rostest folder.

python RouterOS-Backup-Tools/ROSbackup.py unpack myrouter.backup -d myrouter

python RouterOS-Backup-Tools/extract_user.py myrouter/user.dat
************** Output ***************
User: admin
Pass:

User: admin
Pass:

User: admin
Pass: mysecretpassword

*************************************

Jump to Conclusion


Linux MikroTik Password Recovery

Make sure you have Python 3 installed.

python3 -V

Create a new folder and clone the RouterOS-Backup-Tools repo

mkdir rostest
cd rostest
git clone https://github.com/BigNerd95/RouterOS-Backup-Tools.git

Create a virtualenv and install the dependency library

virtualenv ./venv
source ./venv/Scripts/activate
pip install pycryptodome

Now we are ready to extract our .backup file and decode the passwords. Before beginning this step, copy your backup file into the rostest folder.

python RouterOS-Backup-Tools/ROSbackup.py unpack myrouter.backup -d myrouter

python RouterOS-Backup-Tools/extract_user.py myrouter/user.dat
************** Output ***************
User: admin
Pass:

User: admin
Pass:

User: admin
Pass: mysecretpassword

*************************************

Conclusion

That’s It! You have successfully recovered your forgotten password from a routeros backup file. If you are faced with needing to get a password from an encrypted backup you will need to unencrypted the backup using a bruteforce method. The software package RouterOS-Backup-Tools includes tools for bruteforcing and unencrypting RouterOS backup files but that is beyond the scope of this article.

Let me know what you think, leave a comment below. Did these steps work for you?

8 Replies to “MikroTik Tutorial: How to recover RouterOS passwords from a backup file”

  1. virtualenv ./venv unknown even if starting python -m . I have added environment variable to path of Python.exe and scripts folder but this still doesn’t help. No such command exists.

    1. DESKTOP@DESKTOP-KMEGR1L MINGW64 ~/rostest
      $ virtualenv ./venv
      ./venv/Scripts/activate.bat
      pip install pycryptodome
      bash: virtualenv: command not found
      bash: ./venv/Scripts/activate.bat: No such file or directory
      bash: pip: command not found

  2. soporte@SM16 MINGW64 ~/rostest
    $ virtualenv ./venv
    bash: virtualenv: command not found

    No funciona, algo falta y no se que es… Gracias

  3. DESKTOP@DESKTOP-KMEGR1L MINGW64 ~/rostest
    $ virtualenv ./venv
    ./venv/Scripts/activate.bat
    pip install pycryptodome
    bash: virtualenv: command not found
    bash: ./venv/Scripts/activate.bat: No such file or directory
    bash: pip: command not found

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.