我如何取回我的东西?

我如何取回我的东西?

好的,大约 10 分钟前,我将这个 .py 文件放在我的桌面上,对其进行 chmod 使其可执行,当我双击它时,它打开了,桌面上的所有文件都消失了,并创建了一个名为“key-database”的文件夹。有人知道如何找回我的东西吗?谢谢


#!/usr/bin/env python

import os
import sys
import time
import shutil
import commands
from PyQt4 import QtGui,QtCore

def initialize():
    'Set Working directory'
    if 'core' in os.listdir(os.getcwd()):
        create_directory()
    else:
        variable = sys.argv[0]
        direc = variable.replace('execute.py',"")
        if direc:
            os.chdir(direc)
        create_directory()

def restore_files():
    '''Fern 1.2 update algorithm fails to update the new version files
        therefore this piece of code corrects that defect when running
        the program after an update from 1.2'''

    update_directory = '/tmp/Fern-Wifi-Cracker/'

    for old_file in os.listdir(os.getcwd()):
        if os.path.isfile(os.getcwd() + os.sep + old_file) and old_file != '.font_settings.dat':
            os.remove(os.getcwd() + os.sep + old_file)
                                                                    # Delete all old directories except the "key-database" directory
    for old_directory in os.listdir(os.getcwd()):
        if os.path.isdir(os.getcwd() + os.sep + old_directory) and old_directory != 'key-database':
            shutil.rmtree(os.getcwd() + os.sep + old_directory)

    for update_file in os.listdir('/tmp/Fern-Wifi-Cracker'):        # Copy New update files to working directory
        if os.path.isfile(update_directory + update_file):
            shutil.copyfile(update_directory + update_file,os.getcwd() + os.sep + update_file)
        else:
            shutil.copytree(update_directory + update_file,os.getcwd() + os.sep + update_file)

def create_directory():
    'Create directories and database'

    if not os.path.exists('fern-settings'):
        os.mkdir('fern-settings')                               # Create permanent settings directory
    if not os.path.exists('key-database'):                      # Create Database directory if it does not exist
        os.mkdir('key-database')

def cleanup():
    'Kill all running processes'
    commands.getstatusoutput('killall airodump-ng')
    commands.getstatusoutput('killall aircrack-ng')
    commands.getstatusoutput('killall airmon-ng')
    commands.getstatusoutput('killall aireplay-ng')

initialize()

if 'core' not in os.listdir(os.getcwd()):
    restore_files()

from core import *
functions.database_create()
from gui import *

if __name__ == '__main__':
    app = QtGui.QApplication(sys.argv)
    run = fern.mainwindow()

    pixmap = QtGui.QPixmap("%s/resources/screen_splash.png" % (os.getcwd()))
    screen_splash = QtGui.QSplashScreen(pixmap,QtCore.Qt.WindowStaysOnTopHint)
    screen_splash.setMask(pixmap.mask())
    screen_splash.show()
    app.processEvents()

    time.sleep(3)

    screen_splash.finish(run)
    run.show()
    app.exec_()

    cleanup()
    sys.exit()

答案1

for old_directory in os.listdir(os.getcwd()):
if os.path.isdir(os.getcwd() + os.sep + old_directory) and old_directory != 'key-database':
    shutil.rmtree(os.getcwd() + os.sep + old_directory)

这就是罪魁祸首,我的朋友。

相关内容