Initial commit
This commit is contained in:
+30
@@ -0,0 +1,30 @@
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace IPClab2;
|
||||
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var secretBytes = Encoding.UTF8.GetBytes("Super secret data\0");
|
||||
GCHandle handle = GCHandle.Alloc(secretBytes, GCHandleType.Pinned);
|
||||
|
||||
try
|
||||
{
|
||||
IntPtr memAddress = handle.AddrOfPinnedObject();
|
||||
int currentPid = Process.GetCurrentProcess().Id;
|
||||
Console.WriteLine("oh yep hi");
|
||||
Console.WriteLine(currentPid);
|
||||
Console.WriteLine($"0x{memAddress.ToInt64():X}");
|
||||
Console.ReadLine();
|
||||
Console.WriteLine(Encoding.UTF8.GetString(secretBytes));
|
||||
Console.ReadLine();
|
||||
}
|
||||
finally
|
||||
{
|
||||
handle.Free();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user