Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: cp1252 -*-
- ##==============================================================================
- ##
- ## Copyright 2012 Félix Brezo (febrezo @ www.felixbrezo.com)
- ##
- ## This program is free software: you can redistribute it and/or modify
- ## it under the terms of the GNU General Public License as published by
- ## the Free Software Foundation, either version 3 of the License, or
- ## (at your option) any later version.
- ##
- ## Sira is distributed in the hope that it will be useful,
- ## but WITHOUT ANY WARRANTY; without even the implied warranty of
- ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ## GNU General Public License for more details.
- ##
- ## You should have received a copy of the GNU General Public License
- ## along with yasbeck.py. If not, see <http://www.gnu.org/licenses/>.
- ##
- ## Additional comments by the author:
- ## ----------------------------------
- ## En.: This script was coded for educational purpouses only.
- ## The use or missuse of this script is responsible of the final
- ## user.
- ## The author condemns any illegal use of this script and
- ## encourages its users to pursue and inform the corresponding
- ## authorities about any illegal use of it.
- ## Es.: Este script ha sido codificado solamente con fines educativos.
- ## El uso o mal uso de este script es responsabilidad única de
- ## su usuario final.
- ## El autor condena cualquier uso ilegal de este script e insta
- ## a sus usuarios a poner en mano de la justicia cualquier uso
- ## ilegal del mismo.
- ##
- ##==============================================================================
- ## USO
- ## ---
- ## usage: yasbeck.py [-h] -d <DEFACEMENT_FILE> -s <SITES_FILE> [-q] [--version]
- ##
- ## Yasbeck - App. para verificaci?n de defacements.
- ## optional arguments:
- ## -h, --help show this help message and exit
- ## -d <DEFACEMENT_FILE>, --defacement <DEFACEMENT_FILE>
- ## URI del fichero de defacement.
- ## -p <IP>:<PORT>, --proxy <IP>:<PORT>
- ## para usar la configuración de un proxy dado en el
- ## formato <IP>:<PORT>.
- ## -q, --quiet para no mostrar ninguna salida en la consola.
- ## -s <SITES_FILE>, --sites <SITES_FILE>
- ## para determinar el fichero donde se encuentran las
- ## URIS a comprobar.
- ## -t, --tor para usar la configuración del proxy de Tor. Tor
- ## tiene que haber sido lanzado previamente.
- ## --version show program's version number and exit
- ##
- ##==============================================================================
- ## Limitaciones
- ## ------------
- ## Probado sobre Python 2.7.2.
- ## Verifica si las URL del fichero .txt contienen el mismo que ha sido pasado
- ## por parámetro empleando calculando su Hash MD5. Esto garantiza que los
- ## sites que contengan un fichero con dicho Hash siguen siendo vulnerables
- ## pero no garantiza que existan otros sites que no lo tengan que lo sigan
- ## siendo (por ejemplo, porque tengan un fichero similar, pero no
- ## exactamente igual. De esta manera, los no etiquetados como [HACKEADOS]
- ## manifiestan alguno de los siguientes comportamientos: o muestran una
- ## página de error o no responden a las peticiones.
- ## Este script no está libre de errores y es sólo una muestra de la gran
- ## cantidad de sitios que no han dado respuesta a los ataques del día 30.
- ## Se usa MD5 por meras cuestiones de reutilización de código.
- ## Huelga decir que el autor condena cualquier ataque que viole las libertades
- ## de la red. El robo de credenciales y el acceso ilegítimo a servidores
- ## ajenos conforman una de estas activiades.
- ##==============================================================================
- ## Notas adicionales:
- ## ------------------
- ## A las 19:35 GMT del día 3 de diciembre 278/319 sitios seguían mostrando la web
- ## inyectada por xPerf3cti0n.html
- ## El script tiene de nombre yasbeck.py en honor de la actirz protagonista de
- ## la Máscara (The Mask, 1994)
- ##==============================================================================
- import sys
- import argparse
- import random
- import getpass
- import hashlib
- import os
- from datetime import datetime
- # definimos el argparser
- parser = argparse.ArgumentParser(description='Yasbeck - App. para verificación de defacements.', prog='yasbeck.py')
- # definimos el método de entrada como grupo exclusivo
- #entradas = parser.add_mutually_exclusive_group(required=True)
- # añadimos las funciones posibles
- #funciones.add_argument('-c', '--cifrar', required=False, action='store_true', default=False, help='para indicar operaciones de cifrado.')
- #funciones.add_argument('-d', '--descifrar', required=False, action='store_true', default=False, help='para indicar operacioens de descifrado.')
- parser.add_argument('-d', '--defacement', metavar='<DEFACEMENT_FILE>', required=True, action='store', help = 'URI del fichero de defacement.')
- parser.add_argument('-p', '--proxy', metavar='<IP>:<PORT>',required=False, action='store', help='para usar la configuración de un proxy dado en el formato <IP>:<PORT>.')
- parser.add_argument('-q', '--quiet', required=False, action='store_true', default=False, help = 'para no mostrar ninguna salida en la consola.')
- parser.add_argument('-s', '--sites', metavar='<SITES_FILE>', required=True, action='store', help='para determinar el fichero donde se encuentran las URIS a comprobar.')
- parser.add_argument('-t', '--tor', required=False, action='store_true',default=False, help='para usar la configuración del proxy de Tor.')
- parser.add_argument('--version', action='version', version='%(prog)s 1.0')
- args = parser.parse_args()
- from cStringIO import StringIO
- import urllib2
- def md5Checksum(filePath):
- fh = open(filePath, 'rb')
- m = hashlib.md5()
- while True:
- data = fh.read(8192)
- if not data:
- break
- m.update(data)
- return m.hexdigest()
- if __name__ == "__main__":
- if not args.quiet:
- print "Iniciando yasbeck.py..."
- ## Generamos el hash del fichero original
- if not args.quiet:
- print "Intentando generar hash de la password pasada por parámetro..."
- md5_orig=md5Checksum(args.defacement)
- print 'The MD5 checksum of the file is', md5_orig
- ## configurando proxy de tor
- if args.tor:
- print "Tor"
- proxy= urllib2.ProxyHandler({'http':'127.0.0.1:8118'})
- opener = urllib2.build_opener(proxy)
- urllib2.install_opener(opener)
- ## configurando proxy
- elif args.proxy:
- print "Proxy"
- proxy= urllib2.ProxyHandler({'http':args.proxy})
- opener = urllib2.build_opener(proxy)
- urllib2.install_opener(opener)
- ## Contador
- hackedSites=0
- if not args.quiet:
- print "Buscando todas las URIS supuestamente defaceadas..."
- f = open(args.sites,"r")
- listaSites=f.readlines()
- f.close
- current =0
- for url in listaSites:
- print "Procesando:\t", url.split("\n")[0]
- current+=1
- try:
- resource = urllib2.urlopen(url)
- now = datetime.now()
- filename=str(now.year)+"-"+str(now.month)+"-"+str(now.day)+"_"+str(now.hour)+"-"+str(now.minute)+"-"+str(now.second)+".png"
- filename="temp"+str(current)+".html"
- output= open(filename,"wb")
- output.write(resource.read())
- output.close()
- actual=md5Checksum(filename)
- if actual ==md5_orig:
- print "\t[HACKED]\t", actual, "\t==\t", md5_orig
- hackedSites+=1;
- else:
- print "\t[Recovered]\t", actual, "\t!=\t", md5_orig,"\n"
- print "Siguen (al menos) hackeados:\t"+str(hackedSites)+"/"+str(current)+"\n"
- except IOError as e:
- print "\t[IOError]","\n"
- print "Siguen (al menos) hackeados:\t"+str(hackedSites)+"/"+str(current)+"\n"
- print "En total siguen (al menos) hackeados:\t"+str(hackedSites)+"/"+str(len(listaSites))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement