For this assessment, you will create a simple Python port scanner using Python's built-in functions. You can use Python's default editor IDLE (Integrated Development and Learning Environment) or a Python editor of your choice to complete this assessment.
Here is the code someone sent me however I get an error in my shell console when running.
import socket
def port_scanner():
# inclusive range 1 to 1024
for port in range(1, 1024 + 1):
socket_obj =
socket.socket(socket.AF_INET, socket.SOCK_STREAM)
result =
socket_obj.connect_ex(("localhost", port))
# checking for open
port
if result is None:
print("Port ", port, "open")
socket_obj.close()
port_scanner()
CODE:
import socket
import sys
# Ask for hostname
host = raw_input("Enter a remote host to scan: ")
host_IP = socket.gethostbyname(remoteServer)
print "Please wait, scanning host", remoteServerIP
# Scan all the ports from 1 t0 1024
try:
for port_no in range(1,1025):
s= socket.socket(socket.AF_INET, socket.SOCK_STREAM)
r = sock.connect_ex((remoteServerIP, port_no))
if r == 0:
print "Port {}: Open".format(port_no)
s.close()
except socket.gaierror:
print 'Hostname can't be found.'
sys.exit()
except socket.error:
print "Couldn't connect to server"
sys.exit()
NOTE : When it asks for input,input the desired host address and it will show you the port numbers open in your system.Please run it on LINUX based system.
For this assessment, you will create a simple Python port scanner using Python's built-in functions. You...
The instructions for my assignment are below; however I came across this code but when I try to run it, I get nothing but either bugging issues or error in the python shell. Write a simple port scanner program using the built-in Socket module. Test your port scanner by targeting your own computer or you can reference https://www.hackthissite.org Test your code and document testing by taking screenshots.
I need help with an assignment, it invovles techniques such as web scraping to retrieve data from the Internet using both Python built-in functions as well as third-party libraries. You can use Python's default editor IDLE (Integrated Development and Learning Environment) or a Python editor of your choice to complete this assignment. I need to do the following: Write a program to test if a given page is found or not on the server. Write a Python program to download and...
" In the workshop exercises you have used Python's Tkinter module to create simple Graphical User Interfaces. The following code is an incomplete Python program relying on Tkinter (with deliberately unhelpful variable and function names) which you must complete by filling in the blanks. When complete the program should create a window with two buttons, labelled and!!', respectively. When the button la belled'???' is pushed nothing happens. When the button labelled'!!"is pushed both buttons' labels are set to'!!!' from tkinter...
In this lab you will write a simple chat application in Python using TCP sockets. The chat application consists of a chat server and a chat client. At any one time, the chat server is communicating with just one chat client. When the client and the server are done chatting, they exchange end messages which ends the session. The client and server read and write Unicode strings using the readUTF() and writeUTF() methods of DataInputStream and DataOutputStream respectively. After compilation,...
Create a simple Air Quality Assessment Tool using the technology of your choice ( java, python) that utilizes Open AQ Platform API. It will have the ability to compare the Air Quality of two cities. The tool must: Allow the user to input two cities Display the air quality of the corresponding cities, allowing the user to compare the two Gracefully handle any API or user errors Tool should be easily used by the general public
Objectives Work with functions Assignment Write each of the following functions using Python. The function header MUST be written as specified. In your main code test all of the specified functions. Each function must have a comment block explaining what it does, what the parameters are and what the return value is. Please remember the following two guidelines: unless the purpose of the function is to generate output DO NOT write to the screen within the function unless the purpose...
Using Python, if you could help me with the code # Create a modified version of the search linear function defined # above to return all # occurrences of the search word in the text # An occurrence is the index of a word in the text that matches your given # search string. # e.g. if "hatter" occurs at positions 0, 6, 12 then return [ 0, 6, 12] def search_linear_occurrences(xs, target): """ Find and return a list of...
This CSIS 9 Python. Java Python Warmup-2 > string_times prev next | chance Given a string and a non-negative int n, return a larger string that is n copies of the original string. string_times('Hi', 2) – 'HiHi' string_times('Hi', 3) - 'HiHiHi' string_times('Hi', 1) – 'Hi' Solution: Go Save, Compile, Run (ctrl-enter) Show Solution def string_times (str, n): def string_times(str, n): result = "" for i in range(n): # range(n) is [0, 1, 2, .... n-1] result = result + str...
Using Python, if you could help me with the code # Create a modified version of the search linear function defined # above to return all # occurrences of the search word in the text # An occurrence is the index of a word in the text that matches your given # search string. # e.g. if "hatter" occurs at positions 0, 6, 12 then return [ 0, 6, 12] def search_linear_occurrences(xs, target): """ Find and return a list of...
(For Python program) Write a program that fulfills the functionalities of a mathematical quiz with the four basic arithmetic operations, i.e., addition, subtraction, multiplication and integer division. A sample partial output of the math quiz program is shown below. The user can select the type of math operations that he/she would like to proceed with. Once a choice (i.e., menu option index) is entered, the program generates a question and asks the user for an answer. A sample partial output...