How to Create Advanced Folder Lock with Setup Your Own Password Using Python


Python Blog #Author: ManishHacker1

Hello guys, I am back. Today we will be create advanced Folder Lock. In this folder lock, you can setup your password and create Locker folder where you want in your Hard-Drive.

In my last article, We learned about "How to create Folder Lock with Password Protected using Python". Now we will be make a Advanced Folder Lock using Python.

How to create folder lock using Python

Compatibility:

Compatible with any Microsoft Windows Operating system.

Pre-Reuisites:

  • You will need pyhton installed in your operating system.
  • win32api: For windows purpose
  • if you want to distribute your Folder Lock then you will be also need pyinstaller using to convert our python file to .exe file.

First open your python IDE or Notepad, where you want to write code. If you use to notepad please remember indentation using to write code. Or copy the following code and paste in your python IDE or Notepad and save as anyname.py. Where ".py" is our file extension.

Step For Coding

Full code:


#Aythor : ManishHacker1
#Follow on FB: https://www.facebook.com/ManishHacker1
#Follow on Insta: https://www.instagram.com/manishhacker19889/
#Follow on Insta: https://www.instagram.com/krypsec
#Follow on Insta: https://www.instagram.com/kryptora
import base64
import os
import time
import sys
import win32api


def goto(linenum):
    global line
    line = linenum

def set_Password():    
    obj = open("c:\SecretPasswordFile.txt","w")
    obj.write(base64.b64encode(raw_input("Set Your Password: ")))
    obj.close()   
    drive = str(raw_input("Which drive You want to create Locker Folder: "))
    os.chdir(drive)
    if not os.path.exists("Locker"):
            if not os.path.exists("Locker.{645ff040-5081-101b-9f08-00aa002f954e}"):
                os.mkdir("Locker")
                sys.exit()
            else:
                sys.exit()
    else:
        sys.exit()
                
if not os.path.exists("c:\SecretPasswordFile.txt"):
    set_Password()

passwordFile = open('c:\SecretPasswordFile.txt','r')
pw = passwordFile.read()
passwordFile.close()

encode = base64.b64decode(pw)


def reset_password():
    password = str(raw_input("Enter your current password: "))
    if password == encode:
        obj = open("c:\SecretPasswordFile.txt","w")
        obj.write(base64.b64encode(raw_input("Set Your Password: ")))
        obj.close()
        win32api.MessageBox(0, 'Your password Successfully Reset', 'Password')
        sys.exit()
    else:
        win32api.MessageBox(0, 'Your current password does not match', 'Password')
        os.system('cls')
        reset_password()
        

line = 1
while True:
    pw = str(raw_input("Enter your password for Lock or Unlock your folder: "))
    if pw == "12345":
            reset_password()
    

    if pw == encode:
    # Change Dir Path where you have Locker Folder
        drive = str(raw_input("Which drive You want to access Locker Folder: "))
        os.chdir(drive)
    # If Locker folder or Recycle bin does not exist then we will be create Locker Folder
        if not os.path.exists("Locker"):
            if not os.path.exists("Locker.{645ff040-5081-101b-9f08-00aa002f954e}"):
                os.mkdir("Locker")
                sys.exit()
            else:
                os.popen('attrib -h Locker.{645ff040-5081-101b-9f08-00aa002f954e}')
                os.rename("Locker.{645ff040-5081-101b-9f08-00aa002f954e}","Locker")
                sys.exit()
        else:
            os.rename("Locker","Locker.{645ff040-5081-101b-9f08-00aa002f954e}")
            os.popen('attrib +h Locker.{645ff040-5081-101b-9f08-00aa002f954e}')
            sys.exit()
        
    else:
        win32api.MessageBox(0, 'Wrong password!, Please Enter right password', 'Password')
        os.system('cls')
        goto(1)

How to use:

After that run your code. You will seen a prompt for set your password. You can put your own password which you want. This password save as "SecretPasswordFile.txt" in your "C:\" drive. Password are also save as in encrypted form.If someone open your SecretPasswordFile.txt then he/she will see only some strange character.

After that give your path or location where you want to create a locker Folder. For example: C:\ or D:\ or E:\ManishHacker1\Akan\...

Now you have successfuly create a Locker folder and set the password.

In my case, i created a Locker folder in "C:\" drive. When you open your desired location where you created a Locker folder then you will see a Locker folder. After that put your secret file and folder in your Locker Folder and again run your code.

Again you will see a prompt where you will put your secret password for doing "Lock/Unlock" of your Locker folder.
Voilaaa!!!

This code will be create password protected folder and also become convert in recyle bin. After that certainly automatically will hide in your hard-drive.If you want unlock your Locker Folder. Again run your code and enter your desired password and after that put your desired location where your Locker folder is located.
If password is correct then you can access your secret files and folder.

Reset your password:

If you want to reset your password then run your script and put "12345" in your prompt and hit enter.

After that put your current password and reset your password.
If you want to make a new Locker folder then put your new location, or put your current path where your Locker Folder is located.

Your default reset password pin: 12345

Now the Deploy

Well, we have done all work for Folder Lock. Now we are going to use pyinstaller to convert it to an exe file so we can easily run it on their computer.

Now, We will be download pyinstaller using pip. Open your command prompt and type:


c:\Users\Administrator>cd\      and hit enter
c:\>cd Python27      and hit enter
c:\Python27>cd Scripts     and hit enter
c:\Python27\Scripts>pip install pyinstaller         and hit enter

After installation pyinstaller, Go to your program’s directory and run:

pyinstaller Locker.py --onefile --noconsole --ico=anyimage.ico

  • --onefile -> to make it just a single executable
  • --noconsole -> to prevent a console window from popping up
  • --ico -> .ico image to make it more convincing

Note:

Important think is that, you can run your script from any location in your computer where you want.

Download Full Locker Folder Setup: Download

Thank You for reading this article.I hope you enjoyed it. If any query please comment. And also like my FB page givin below link and share it.

Kryptora Digital Security Provided Python Training and Ethical Hacking Training
  • Best Python Training in Noida
  • Best Python Training in Delhi
  • Best Python Training in Meerut
  • Best Python Training in India
  • Best Ethical Hacking Training in Noida
  • Best Ethical Hacking Training in Delhi
  • Best Ethical Hacking Training in Meerut
  • Best Ethical Hacking Training in India

Follow ManishHacker1

Comments

Post a Comment

Popular posts from this blog

How to create Folder Lock with Password Protected using Python

TOP 10 ANIMATED BATCH FILE PROGRAM

How to Connect Window Machine to Linux Machine Using Python via SSH