コード例 #1
0
def main():
    try:
        addr = get_valid_url(sys.argv[1])
    except:
        addr='www.google.com'
    if addr:
        print 'Scanning: ', addr
        chk_spoof(find_gateway() ,nextaddr(addr))
    else:
        sys.exit()
コード例 #2
0
def main():
    try:
        addr = get_valid_url(sys.argv[1])
    except:
        addr='www.google.com'
    print "Scanning SSL certificate from address: %s" % (addr)
    res, ca = has_valid_cert(addr)
    if res:
        print "Authority: %s trusted by host" % ca
        print "SSL Certificate = PASS"
    else:
        print "SSL Certificate = NOT PASS"
        print "Reason:\t- An untrusted CA has signed this certificate"
        print "\t- Is an auto-signed certificate and thats why is dangerous"
        print "\t- This certificate has expired"
        print "ADVICE: use this website under your responsability"
コード例 #3
0
 def handle(self, tag):
     if tag.get('src') is not None and tag.get('src') != '':
         # csdn image
         self.__class__.img_counter += 1
         alt = tag.get('alt') if tag.get('alt') is not None else ''
         src = tag.get('src')
         file_name = self.writer.download_image(src, self.__class__.img_counter)
         self.writer.write("![{}_pic{}]({})".format(alt, self.__class__.img_counter, file_name))
         # 这里感觉很奇怪,为啥<img>标签也会有嵌套?
         if len(tag.contents) > 0:
             self.start_process(tag)
     elif tag.get('data-original-src') is not None and tag.get('data-original-src') != '':
         # jianshu image
         self.__class__.img_counter += 1
         src = utils.get_valid_url(tag.get('data-original-src'))
         file_name = self.writer.download_image(src, self.__class__.img_counter)
         self.writer.write("![pic{}]({})".format(self.__class__.img_counter, file_name))