Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You have been assigned to modify the FTP client (active mode) to send files to a working FTP Server designed for digital forensics evidence. This

You have been assigned to modify the FTP client (active mode) to send files to a working FTP Server designed for digital forensics evidence. This means that the FTP server will required to send a file and file containing the hash of the file, for verification purposes. Given that multiple files can be send, you will implement mput. This command, mput can take multiple files separated by commas (for simplicity, we will not used wildcards * ?). For example, mput file1.jpeg file2.jpeg. To obtain the hashcode, you will called a function created for you: getHashedFile(filename). This function creates a text file with a few lines: #1 filename, #2 date, #3 hashcode and returns the filename and path in fileName. You must create:

You are given the following global variables.

mindc = 50000

maxdc = 60000

nport = 0

tList = []

Assume cmd_socket is an active socket for the command channel

getDataChannel() : This function returns a tuple with the correct string for each PORT command (since you are doing active mode). This function does not do anything with sockets. You have to take into account that you always sends two ports because you will send a file and the hashfile.

mput(mstrings,cmdSocket): This function sends multiple files. For each file, mput also sends the hashfile created with getHashedFile. mput threads each file sent with its hashfile (meaning that a thread will send two files). Remember to call getDataChannel inside of mput. Dont worry about joins. Assume that is taking care. However, store your threads in tList

handleFilePut(filename1, hashfilename,strPort1, strPort2, cmdSocket). This function sends two files. This is a function that was threaded. Remember to create the data channels here. Assume that you can pass sendFile(filename,datasocket) to send a file (that way you dont have to open the file)

*NOTE: You may assume getIPandPortFromPortStr(portstr). This returns ip, port when you pass strPort1 or strPort2.

Assume functions if needed. For example, *NOTE.

Use python.

def mput(mstrings,cmdSocket):

#

tokens =

for file in tokens:

#one thread, two files.

def getDataChannel():

#function returns strport1, strport2

global mindc #min. data channel

global maxdc #max. data channel

global nport # next port

host = gethostname()

haddr = gethostbyname(host) nport = nport + 1

#assign port to use below

dport =

dport_high =

dport_low =

#split haddr and prepare port command

hsplit =

#(finish strport1 and then do strport2)

def handleFilePut(filename1, hashfilename,strPort1, strPort2, cmdSocket):

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Bioinformatics Databases And Systems

Authors: Stanley I. Letovsky

1st Edition

1475784058, 978-1475784053

More Books

Students also viewed these Databases questions