Port-scanning with two IPs
Your naming convention doesnt aid legability. e.g, rename p to port.

Don't do carte blanche exception handling. Be more specific, e.g.:

try:
    ...
except (ValueError, KeyError)
    ...


You are also a miser with your spaces. White space is important for legibility.

explicit is better than implicit so replace ipscan('.'.join(map(str,start)),p) with ipscan(start2='.'.join(map(str,start)), port=p)

Consider replacing while end&gt;start with while end &gt;= start as it allows scanning of a single IP address..

I cans see how the ordering of 3,2,1,0 is important so replace

for i in (3,2,1,0):
     if start[i]==255:
         start[i-1]+=1 #what if 
         start[i]=0


with

for i, val in enumerate(start):
    if val == 255:
        start[i] = 0
        start[i-1] += 1


Also, what if item at index 0 == 255? that will cause start[i-1] += 1 to raise an Index Error.

Also, it is not clear why that transformation is being done, so some documentation will be great. Future you will thank present you for it too. Just simply #this does x because of y can suffice.

replace

of=open('Output.txt','w')
for ip in ok:
    of.writelines(ip+'\n')
of.close()


with context and join

with open('Output.txt','w') as of:
    of.write('\n'.join(ok))