This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
get = datetime.datetime.now() | |
currYear = get.year | |
uname = raw_input('Please enter your name: ') | |
age = input('Please enter your age: ') | |
print'Hi ', uname,'. Your age is', age |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
num1 = input('Please enter the number') | |
num2 = input('Even the divisor') | |
if num1%2 == 0: | |
print'Number is even' | |
else: | |
print'Number is odd' | |
if num1%4 == 0: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
num1 = input('Enter a number for which you want to check the divisor') | |
dataset = range(1, num1) | |
print dataset | |
for data in dataset: | |
if num1%data == 0: | |
print data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
N,S,I,R,b,k | |
550,500,50,0.5,0.007 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IP | Port | |
---|---|---|
10.158.102.36 | 3389 | |
google.com | 8777 | |
localhost | 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IP | Port | Status | |
---|---|---|---|
10.158.102.36 | 3389 | Connection to 10.158.102.36 on port 3389 failed: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond | |
google.com | 8777 | Connection to google.com on port 8777 failed: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond | |
localhost | 80 | Connected to localhost on port 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import sys | |
import pandas as pd | |
import os |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_checklist(severportfile): | |
#port_checklist = pd.read_csv(r'C:\Users\Sudhendu-BCT\Python_Practice\PortChecker\check_port_list.csv') | |
port_checklist = pd.read_csv(input_file) | |
port_checklist.insert(loc=2,column="Status",value = '') | |
return port_checklist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def check_server(address, port): | |
# Create a TCP socket | |
timeout = 40 #timeout in seconds | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
#s.settimeout(timeout) | |
print ("Attempting to connect to %s on port %s" % (address, port)) | |
try: | |
s.connect((address, port)) | |
#print ("Connected to %s on port %s" % (address, port)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def check_create_status(severportfile): | |
print ('Reading from files: ' +severportfile) | |
get_file= get_checklist(severportfile) | |
for i in range(len(get_file)) : | |
print("Started Processing") | |
address = get_file.loc[i, "IP"] | |
port = get_file.loc[i, "Port"] | |
check = check_server(address, port) |
OlderNewer