Пример #1
0
def main():
    os.system('cls' if os.name == 'nt' else 'clear')
    CheckBin()
    ShowBanner()
    global isJAVAInstalled
    isJAVAInstalled = CheckJAVA()
    print('\n')
    try:
        CustomPrint('Arguments passed : ' + str(args))
        print('\n')
    except:
        pass

    try:
        CustomPrint('System Info : ' +
                    json.dumps(GetSysInfo(), indent=2, default=str))
        print('\n')
    except:
        CustomPrint('Can\'t get system information. Continuing anyway...',
                    'yellow')
    CustomPrint('Current release date : 29/06/2021', 'cyan')
    print('\n')
    readInstruction = CustomInput(
        '\aPlease read above instructions carefully \u2191 . Continue? (default y) : ',
        'yellow') or 'y'
    if (readInstruction.upper() == 'Y'):
        print('\n')
        CustomInput(
            '\aIf you haven\'t already, it is adviced to take a WhatsApp chat backup by going to WhatsApp settings \u2192 Chat Settings \u2192 Chat Backup. Hit Enter key to continue.',
            'yellow')
        USBMode()
    else:
        Exit()
def Compress(userFolder):
    if(not os.path.isdir(extracted + userFolder)):
        CustomPrint('Could not find directory ' + extracted + userFolder)
    elif(len(os.listdir(extracted + userFolder)) == 0):
        CustomPrint('User folder is empty.')
        Exit()
    else:
        password = CustomInput('Choose a password for zip : ')
        if(password):
            password = '******' + password
        os.system(sevenZip + ' a -t7z -mhe ' + extracted +
                  userFolder + ' ' + extracted + userFolder + '/* ' + password)
        print('\n')
        CustomPrint(
            'If you see \'Everything is OK\' in above line then it is recommended to delete user folder.')
        deleteUserFolder = CustomInput(
            'Delete ' + userFolder + ' folder? (default y) : ') or 'y'
        print('\n')
        CustomPrint('\aYour \'' + userFolder + '.7z\' file is in extracted folder. Password is : ' +
                    password.replace(' -p', ''), 'yellow')
        print('\n')
        CustomInput('Hit Enter key to continue.')
        if(deleteUserFolder.upper() == 'Y'):
            DeleteUserFolder(userFolder)
        else:
            Exit()
def Uncompress(userZip):
    if(not str(userZip).endswith('7z')):
        userZip = userZip + '.7z'

    if(not os.path.isfile(extracted + userZip)):
        CustomPrint('Could not find ' + extracted + userZip)
    elif(os.path.getsize(extracted + userZip) <= 0):
        CustomPrint(extracted + userZip + ' is empty.')
        Exit()
    else:
        password = CustomInput('Enter password, leave empty for none : ')
        if(password):
            password = '******' + password
        os.system(sevenZip + ' e -aot ' + extracted + userZip +
                  ' -o' + extracted + userZip.replace('.7z', '') + password)
        print('\n')
        CustomPrint(
            'If you see \'Everything is OK\' in above line then you can delete user zip file.')
        deleteUserZip = CustomInput(
            'Delete ' + userZip + ' ? (default n) : ') or 'n'
        print('\n')
        CustomPrint('\aYour extracted \'' + userZip.replace('.7z',
                                                            '') + '\' folder is in extracted folder.', 'yellow')
        print('\n')
        CustomInput('Hit Enter key to continue.')
        if(deleteUserZip.upper() == 'Y'):
            DeleteUserZip(userZip)
        else:
            Exit()
def main():
    CustomPrint('This utility is for archiving your output folder with password to enchance it\'s security. Secure is a relative term. Choose longer password.')
    isCompressing = CustomInput('Are you (C)ompressing or (D)ecompressing? : ')
    while(True):
        if(isCompressing.upper() == 'C'):
            ListUserFolders()
            print('\n')
            userFolder = CustomInput(
                'Enter a name of folder from above (case sensitive) : ')
            Compress(userFolder)
            break
        elif(isCompressing.upper() == 'D'):
            ListUserFiles()
            print('\n')
            userZip = CustomInput(
                'Enter a name of file from above (case sensitive) : ')
            Uncompress(userZip)
            break
        else:
            isCompressing = CustomInput('Choose either \'c\' or \'d\' : ')
            continue
Пример #5
0
def main() :
    os.system('cls' if os.name == 'nt' else 'clear')
    CheckBinIfWindows()
    ShowBanner()
    global isJAVAInstalled
    isJAVAInstalled = CheckJAVA()
    # TODO : use -y flag to assume readinstruction read automatically.
    readInstruction = CustomInput('Please read above instructions carefully. Continue? (default y) : ') or 'y'
    if(readInstruction.upper() == 'Y') : 
        USBMode()
    else : 
        Exit()
def TakingOutMainFiles(userName, protectPass):
    os.mkdir(extracted +
             userName) if not (os.path.isdir(extracted + userName)
                               ) else CustomPrint('Folder already exists.')
    CustomPrint('Taking out main files in ' + tmp + ' folder temporaily.')
    try:
        bin = '' if (isLinux) else 'bin\\'
        os.system(bin + tar + ' xvf ' + tmp + 'whatsapp.tar -C ' + tmp +
                  ' apps/com.whatsapp/f/key')
        os.replace('tmp/apps/com.whatsapp/f/key',
                   extracted + userName + '/key')
        os.system(bin + tar + ' xvf ' + tmp + 'whatsapp.tar -C ' + tmp +
                  ' apps/com.whatsapp/db/msgstore.db')
        os.replace('tmp/apps/com.whatsapp/db/msgstore.db',
                   extracted + userName + '/msgstore.db')
        os.system(bin + tar + ' xvf ' + tmp + 'whatsapp.tar -C ' + tmp +
                  ' apps/com.whatsapp/db/wa.db')
        os.replace('tmp/apps/com.whatsapp/db/wa.db',
                   extracted + userName + '/wa.db')
        os.system(bin + tar + ' xvf ' + tmp + 'whatsapp.tar -C ' + tmp +
                  ' apps/com.whatsapp/db/axolotl.db')
        os.replace('tmp/apps/com.whatsapp/db/axolotl.db',
                   extracted + userName + '/axolotl.db')
        os.system(bin + tar + ' xvf ' + tmp + 'whatsapp.tar -C ' + tmp +
                  ' apps/com.whatsapp/db/chatsettings.db')
        os.replace('tmp/apps/com.whatsapp/db/chatsettings.db',
                   extracted + userName + '/chatsettings.db')

        # TODO : use -y flag to cleantmp automatically.
        CustomPrint(
            '\nIf you do not see any errors in above lines in extracting/fluffing whatsapp.ab you SHOULD choose to clean temporary folder. It contains your chats in UN-ENCRYPTED format.',
            'yellow')
        _cleanTemp = CustomInput(
            'Would you like to clean tmp folder? (default y) : ') or 'y'
        if (_cleanTemp.upper() == 'y'.upper()):
            CleanTmp()

        if (protectPass):
            CustomPrint(
                'Now an archive will be created in extracted folder with password \''
                + protectPass +
                '\' and original files will be deleted. To later \'un-archive\' and access these files you need to run \'python protect.py\' from root directory of this project.',
                'yellow')
            protect.Compress(userName, protectPass)

    except Exception as e:
        CustomPrint(e)
        CleanTmp()
Пример #7
0
def CheckJAVA():
    JAVAVersion = re.search('(?<=version ")(.*)(?=")', str(subprocess.check_output(
        'java -version'.split(), stderr=subprocess.STDOUT))).group(1)
    isJAVAInstalled = True if(JAVAVersion) else False
    if (isJAVAInstalled):
        CustomPrint('Found Java installed on system. Continuing...')
        return isJAVAInstalled
    else:
        noJAVAContinue = CustomInput(
            'It looks like you don\'t have JAVA installed on your system. Would you like to (C)ontinue with the process and \'view extract\' later? or (S)top? : ', 'red') or 'c'
        if(noJAVAContinue.upper() == 'C'):
            CustomPrint(
                'Continuing without JAVA, once JAVA is installed on system run \'view_extract.py\'', 'yellow')
            return isJAVAInstalled
        else:
            Exit()
def Compress(userFolder, protectPass):
    if (not os.path.isdir(extracted + userFolder)):
        CustomPrint('Could not find directory ' + extracted + userFolder)
    elif (len(os.listdir(extracted + userFolder)) == 0):
        CustomPrint('User folder is empty.')
        Exit()
    else:
        protectPass = '******' + protectPass
        os.system(sevenZip + ' a -t7z -mhe ' + extracted + userFolder + ' ' +
                  extracted + userFolder + '/* ' + protectPass)
        CustomPrint(
            '\nIf you see \'Everything is OK\' in above line then it is recommended to delete user folder.'
        )
        deleteUserFolder = CustomInput('Delete ' + userFolder +
                                       ' folder? (default y) : ') or 'y'
        # TODO : use -y flag to deleteuserfolder automatically.
        if (deleteUserFolder.upper() == 'Y'):
            DeleteUserFolder(userFolder)
        else:
            Exit()
def Decompress(userZip, protectPass):
    if (not str(userZip).endswith('7z')):
        userZip = userZip + '.7z'

    if (not os.path.isfile(extracted + userZip)):
        CustomPrint('Could not find ' + extracted + userZip)
    elif (os.path.getsize(extracted + userZip) <= 0):
        CustomPrint(extracted + userZip + ' is empty.')
        Exit()
    else:
        if (protectPass):
            protectPass = '******' + protectPass
        os.system(sevenZip + ' e -aot ' + extracted + userZip + ' -o' +
                  extracted + userZip.replace('.7z', '') + protectPass)
        CustomPrint(
            '\nIf you see \'Everything is OK\' in above line then you can delete user zip file.'
        )
        deleteUserZip = CustomInput('Delete ' + userZip +
                                    ' ? (default n) : ') or 'n'
        if (deleteUserZip.upper() == 'Y'):
            DeleteUserZip(userZip)
        else:
            Exit()
Пример #10
0
def TakingOutMainFiles(userName, sdPath, ADBSerialId):
    os.mkdir(extracted) if not (os.path.isdir(extracted)) else CustomPrint(
        'Folder ' + extracted + ' already exists.', 'yellow')
    os.mkdir(extracted +
             userName) if not (os.path.isdir(extracted +
                                             userName)) else CustomPrint(
                                                 'Folder ' + extracted +
                                                 userName +
                                                 ' already exists.', 'yellow')
    # If user folder already exists ask user to overwrite or skip.
    CustomPrint('Taking out main files in ' + tmp + ' folder temporaily.')
    try:
        bin = 'bin\\' if (isWindows) else ''
        os.system(bin + tar + ' xvf ' + tmp + 'whatsapp.tar -C ' + tmp +
                  ' apps/com.whatsapp/f/key')
        os.replace('tmp/apps/com.whatsapp/f/key',
                   extracted + userName + '/key')
        os.system(bin + tar + ' xvf ' + tmp + 'whatsapp.tar -C ' + tmp +
                  ' apps/com.whatsapp/db/msgstore.db')
        os.replace('tmp/apps/com.whatsapp/db/msgstore.db',
                   extracted + userName + '/msgstore.db')
        os.system(bin + tar + ' xvf ' + tmp + 'whatsapp.tar -C ' + tmp +
                  ' apps/com.whatsapp/db/wa.db')
        os.replace('tmp/apps/com.whatsapp/db/wa.db',
                   extracted + userName + '/wa.db')
        os.system(bin + tar + ' xvf ' + tmp + 'whatsapp.tar -C ' + tmp +
                  ' apps/com.whatsapp/db/axolotl.db')
        os.replace('tmp/apps/com.whatsapp/db/axolotl.db',
                   extracted + userName + '/axolotl.db')
        os.system(bin + tar + ' xvf ' + tmp + 'whatsapp.tar -C ' + tmp +
                  ' apps/com.whatsapp/db/chatsettings.db')
        os.replace('tmp/apps/com.whatsapp/db/chatsettings.db',
                   extracted + userName + '/chatsettings.db')

        CleanTmp()

        CustomPrint(
            'You should not leave these extracted database and other files hanging in folder, it is very insecure.'
        )
        createArchive = CustomInput(
            'Would you like to create a password protected archive? (default y) : '
        ) or 'y'
        if (createArchive.upper() == 'Y'):
            print('\n')
            CustomPrint(
                'Now an archive will be created in extracted folder and original files will be deleted. To later \'un-archive\' and access these files you need to run \'python protect.py\' from root directory of this project.',
                'yellow')
            protect.Compress(userName)
        else:
            print('\n')
            CustomPrint(
                '\aYour whatsapp database along with other files is in ' +
                os.path.realpath(extracted + userName) + ' folder.', 'yellow')
            print('\n')
            CustomInput('Hit Enter key to continue.')
            # TODO issue #13 : Ask user to save to sdcard.
            if (sdPath and ADBSerialId):
                copyTosdCard = CustomInput(
                    'Copy msgstore.db file to phone? (y/n) default \'n\' : '
                ) or 'n'
                if (copyTosdCard.upper() == 'Y'):
                    os.system(adb + ADBSerialId + ' push ' + extracted +
                              userName + '/msgstore.db ' + sdPath +
                              '/msgstore.db')
                    CustomPrint('Done copying msgstore.db to phone.')
            try:  # Open in explorer.
                if (isWindows):
                    os.startfile(os.path.realpath(extracted + userName))
                elif (isLinux):
                    os.system('xdg-open ' +
                              os.path.realpath(extracted + userName))
                else:
                    os.system('open ' + os.path.realpath(extracted + userName))
            except:
                pass

    except Exception as e:
        CustomPrint(e, 'red')
        CleanTmp()