Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pysftp;
- #import ftplib;
- import zipfile;
- #import pickle;
- import sys;
- import paramiko;
- import os;
- import subprocess
- import shlex
- # Used to convert MFT files to CSV format
- import analyzeMFT
- srv=pysftp.Connection(’10.0.01’,username=‘ftp’,private_key_pass=‘password’,private_key=‘/home/ace/id_rsa')
- #List the files in the current directory
- #print os.getcwd();
- #Get the readme file
- srv.chdir(‘/home/download’)
- remote_file = sys.argv[0]
- remote_file = raw_input("Enter LR zip file name: ")
- response = srv.get(remote_file)
- print(remote_file)
- dir_name = ‘/home/download’
- extension = ".zip"
- os.chdir(dir_name) # change directory from working dir to dir with files
- for item in os.listdir(dir_name): # loop through items in dir
- if item.endswith(extension): # check for ".zip" extension
- file_name = os.path.abspath(item) # get full path of files
- zip_ref = zipfile.ZipFile(file_name) # create zipfile object
- zip_ref.extractall(dir_name) # extract file to dir
- zip_ref.close() # close file
- os.remove(file_name) # delete zipped file
- # Convert LR from MFT to CSV File format
- subprocess.call(shlex.split('./analyzeMFT.py -f filename.mft'] -o ['filename.csv']'))
- srv.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement