Question: Instructions: Each line of code is to be explained in a comment. I have provided an example for the first line of code. I want

Instructions: Each line of code is to be explained in a comment. I have provided an example for the first line of code. I want to know what the statement is doing, i.e. creating a function, using module, assigning a value and specifically what is the variable, function, parameters etc Answer, What will be printed and What is the output in a comment The use of Python Library 2.7 may necessary to complete the assignment. 1. # port variable is being assigned an integer value of 21 port = 21 #banner is being assigned the string FreeFloat FTP Server banner = FreeFloat FTP Server #combines banner and port while adding Checking for and on print [+] Checking for +banner+ on port +str(port) #prints out: [+]Checking for FreeFloat FTP Server on port 21 What will be printed banner = FreeFloat FTP Server Type(banner) port = 21 portList= [21,22,80,110] type(portList) portOpen = True type(portOpen) 2. banner = FreeFloat FTP Server print banner.upper( ) What will be printed print banner.lower( ) What will be printed print banner.replace (FreeFloat , Ability) What will be printed print banner.find(FTP) 3. portList = [ ] portList.append(21) portList.append(80) portList.append(443) portList.append(25) print portList What will be printed portList.sort( ) print portList What will be printed pos = portList.index(80) print [+] There are +str(pos)+ ports to scan before 80. What will be printed portList.remove(443) print portList What will be printed cnt = len(portList) print [+] Scanning +str(cnt)+ Total Ports. What will be printed 4. services = {ftp:21, ssh:22, smtp:25, http:80} services.keys( ) What will be the output service.item( ) What will be output services.has_key(ftp) What will be output services[ftp] What will be output print [+] found vuln with FTP on port +str(servies[ftp]) What will be printed 5. import socket def retBanner(ip, port): try: socket.setdefaulttimeout(2) s = socket.socket( ) s.connect( ( ip, port)) banner = s.recv(1024) return banner except: return def main( ): ip1 = 192.168.95.148 ip2 = 192.168.95.149 port = 21 banner1 = retBanner(ip1, port) if banner1: print [+] + ip1 + : + banner1 if banner2: print [+] + ip1 + : + banner1 if __name__ == __main__: main( )

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!