Category:
Sec+ Domain 1
80. Steve discovers the following code on a system. What language is it written in, and what does it do? 1.import socket as skt,2.for port in range (1,9999): try: sc=skt.socket(askt.AF_INET,skt.SOCK_STREAM) sc.settimeout(900) sc.connect(('127.0.0.1,port))3.print '%d:OPEN' % (port) sc.close, except: continue
80. B. The Security+ exam expects practitioners to be able to analyze scripts and code to deter- mine roughly what function they perform and to be able to identify multiple programming languages. Python relies on formatting like indenting to indicate blocks of code and does not use line end indicators as you would find in some languages. This code is a basic Python port scanner that will scan every port from 1 to 9999, checking to see if it allows a connection.