• Shell_UPCheck 0.2 [by MixLoL]

 #402191  por MixLoL
 25 Ene 2013, 06:05
#Shell_UPCheck 0.2


- Se trata de una herramienta escrita en python que comprueba si la Shell está Online, renunciar a una o más "not found" es automáticamente eliminado del archivo .txt.

#Created by MixLoL (Amazon Underground)
#Website/Contact: http://mixlol.wordpress.com // http://twitter.com/MixLoL_ // https://twitter.com/UnderAmazon
#Greetzzz: Zack, tom
#Shell_UPCheck 0.2

print '''############Amazon Underground############
############Shell_UPCheck 0.2#############
~~~~~~~https://twitter.com/UnderAmazon~~~~~~
'''
print '''


'''

import os
import sys
import tempfile
import urllib2

good_urls = set()

with open('urls.txt') as urls: #Altere o nome do arquivo se o seu for diferente.
    for url in urls:
        try:
            r = urllib2.urlopen(url)
        except urllib2.URLError as e:
            r = e
        if r.code in (200, 401):
            sys.stdout.write('[{}]: Up!\n'.format(url))
            good_urls.add(url)
        elif r.code == 404:
            sys.stdout.write('[{}]: Not found!\n'.format(url))
        else:
            sys.stdout.write('[{}]: Unexpected response code {}\n'.format(url, r.code))

tmp = None
try:
    tmp = tempfile.NamedTemporaryFile(mode='w', suffix='.txt', dir='.', delete=False)
    for url in sorted(good_urls):
        tmp.write(url + "")
    tmp.close()
    os.rename(tmp.name, 'urls.txt')
    tmp = None
finally:
    if tmp is not None:
        os.unlink(tmp.name)



[ Debe registrarse para ver este enlace ]