Skip to content

Instantly share code, notes, and snippets.

View DarkCoderSc's full-sized avatar

Jean-Pierre LESUEUR (Microsoft MVP) DarkCoderSc

View GitHub Profile
@DarkCoderSc
DarkCoderSc / SharpRunAsAttached.cs
Created December 3, 2021 10:07
A ported version of PowerRunAsAttached to C#
/*-------------------------------------------------------------------------------
.Developer
Jean - Pierre LESUEUR(@DarkCoderSc)
https://www.twitter.com/darkcodersc
https://github.com/DarkCoderSc
www.phrozen.io
[email protected]
PHROZEN
.License
Apache License
@DarkCoderSc
DarkCoderSc / CursorStateMonitorPoC.ps1
Created January 15, 2022 18:45
Proof of Concept I made to monitor the state of global Windows mouse cursor. I will implement this code in PowerRemoteDesktop_Server to synchronize mouse state with Viewer.
<#-------------------------------------------------------------------------------
.Developer
Jean-Pierre LESUEUR (@DarkCoderSc)
https://www.twitter.com/darkcodersc
https://github.com/DarkCoderSc
www.phrozen.io
[email protected]
PHROZEN
using System.Net.NetworkInformation;
/*
String[] vmMacAddresses =
{
"08:00:27",
"00:0C:29",
"00:1C:14",
"00:50:56",
"00:05:69",
{
32Bit Example of File Melting
}
program Melt;
{$APPTYPE CONSOLE}
{$R *.res}
program NtQueryProcessInformation;
{$APPTYPE CONSOLE}
{$R *.res}
uses
Winapi.Windows,
System.SysUtils;
using System;
using System.Runtime.InteropServices;
[DllImport("ntdll.dll", SetLastError = true)]
static extern int NtQueryInformationProcess(
IntPtr processHandle,
int processInformationClass,
ref IntPtr processInformation,
uint processInformationLength,
ref IntPtr returnLength
(*
Example of DLL Code to test DLL Injection:
------------------------------------------
BOF>>
library UnprotectTestDLL;
uses
WinApi.Windows,
(*
Example of DLL Code to test DLL Injection:
------------------------------------------
BOF>>
library UnprotectTestDLL;
uses
WinApi.Windows,
// Support both x86-32 and x86-64
program Unprotect_RunPE;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.Classes,
using System;
using System.IO;
void timeStomp(String targetFile)
{
targetFile = Path.GetFullPath(targetFile);
if (!File.Exists(targetFile))
{
throw new FileNotFoundException(String.Format("File \"{0}\" does not exists.", targetFile));