Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
def dummyFunc(data):
""" This function is a placeholder """
import base64
out=""
for i in data:
v=ord(i)
v=((v&1)<<6) | (v>>1)
out+=chr(v)
return base64.b64encode(str.encode("".join(out))).decode()
def unDummyFunc(data):
""" This function is a placeholder """
import base64
out=""
for i in base64.b64decode(str.encode(data)).decode("utf-8"):
v=ord(i)
v=((v&64)>>6) | ((v<<1)&127)
out+=chr(v)
return "".join(out)
if __name__=="__main__":
'''process will give the time that takes to complete scanning'''
print("Your code goes here")
import nmap
nmap_scan = nmap.PortScanner()# scanning the ports
print(nmap_scan.scan("127.0.0.1", "1-1024"))#printing the nmap scan
import os
import platform
from datetime import datetime
network = input("enter your network address")#give the network you want
network1 = network.split('.')#split the networks
net_point = '.'
network2 = network1[0] + net_point + network1[1] + net_point + network1[2]
start_port = int(input("enter starting port number"))#start port where you $
ending_port = int(input("enter ending port number"))#end port where you wou$
ending_port = ending_port + 1
oper_system = platform.system()
if (oper_system == "Windows"):
ping = "ping -n 1"
else:
ping = "ping -c 1"
time1 = datetime.now()# provide the start scanning time
print("start scanning")#begin to scan the time
for ip in range(start_port,ending_port):
ip_address = network2 + str(ip)
comm = ping +ip_address
response = os.popen(comm)
for line in response.readlines():
if(line.count("TTL")):
break
if(line.count("TTL")):
print(addr, "===> live")
time2 = datetime.now()# provide the finishing time
results = time2 - time1# time taking to complete the process
print("finish scanning : ",results)#give the output