Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DInvoke Conversion #21

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3a57d2d
Migrating to D/Invoke
0xbadjuju Aug 23, 2021
1f85a40
Updated to use SysCalls and handle Corrupted State Exceptions
0xbadjuju Aug 25, 2021
d936ecf
Converted ImpersonateUser to Syscalls
0xbadjuju Aug 25, 2021
cce0207
Converted OpenThreadToken to Syscalls
0xbadjuju Aug 25, 2021
cd037b0
Migrated List Threads to D/Invoke GetPebLdrModuleEntry/GetExportAddress
0xbadjuju Aug 25, 2021
9ead92a
Converting TokenInformation to D\Invoke
0xbadjuju Aug 26, 2021
fab0288
Condensed redundant methods and removed static
0xbadjuju Aug 26, 2021
84ccfd5
GetSystem Named Pipe Bug Fix + Finished TokenInformation Conversion
0xbadjuju Aug 26, 2021
c2c1a2d
Set GetTrustedInstaller default to use LogonUserExExW and code cleanup
0xbadjuju Aug 27, 2021
8cefb32
Converting TokenManipulation to D/Invoke + Bug Fixes
0xbadjuju Aug 28, 2021
d38ad19
Removing DisableAndRemoveAllTokenPrivileges and Privileges Lists
0xbadjuju Aug 30, 2021
f64e07e
Partially converted CreateTokens + TokenManipulation BugFix
0xbadjuju Sep 1, 2021
957f9f4
Janky fix for NetUserGetGroups GetExportAddress failures
0xbadjuju Sep 1, 2021
620bba2
Implementing the fix for NetUserGetGroups
0xbadjuju Sep 1, 2021
566c740
Converted TokenDriver, Removed Inline DesktopACL P/Invokes, Deprecate…
0xbadjuju Sep 1, 2021
04e7b5e
Moved Logon_User to CreateTokens + CheckTokenPrivilege rework
0xbadjuju Sep 3, 2021
c1099af
Converted UserSessions and DesktopACL to D/Invoke
0xbadjuju Sep 10, 2021
21ba28a
Converted CreateProcess to DInvoke
0xbadjuju Sep 10, 2021
84c49c9
Fixed Warnings and converted PSExec to DInvoke
0xbadjuju Sep 11, 2021
1440c60
Removed services.cs , replaced with psexec. Converting Filters & Filt…
0xbadjuju Sep 13, 2021
3cc39fe
Filters Commenting and updating plugin calls
0xbadjuju Sep 13, 2021
0faa4be
Removed all remaining P/Invokes
0xbadjuju Sep 15, 2021
0e9558b
Fixed CreateProcessWithLogonW and Add PPID Spoofing
0xbadjuju Apr 7, 2022
fd44873
Updating Monkeyworks
0xbadjuju Apr 7, 2022
bbc44ac
Adding DInvoke Dev
0xbadjuju Apr 7, 2022
4a7514f
Updating DInvoke to latest
0xbadjuju Apr 7, 2022
2ad3ac0
Fixing DInvoke Submodule
0xbadjuju Apr 7, 2022
5892fea
Need to fork DInvoke for C# 5 compatibility
0xbadjuju Apr 7, 2022
d81529a
Updating for compatible version of DInvoke
0xbadjuju Apr 7, 2022
e90cb64
Update DInvoke again
0xbadjuju Apr 7, 2022
c168cd8
Add PPID Tab Complete and Check for Admin Priv
0xbadjuju Apr 7, 2022
61bf1dc
Update README.md
0xbadjuju Apr 7, 2022
041017f
Update README.md
0xbadjuju Apr 7, 2022
0c1efc0
List_All_Tokens
0xbadjuju Apr 12, 2022
209337f
Adding msbuild option
0xbadjuju Jun 2, 2022
48228c9
Add Legacy option to GetSystem
0xbadjuju Feb 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@

# IDE1006: Naming Styles
dotnet_diagnostic.IDE1006.severity = none

# CS0414: The field 'NamedPipes.tokenType' is assigned but its value is never used
dotnet_diagnostic.CS0414.severity = none
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
path = Tokenvator/Resources/MonkeyWorks
url = https://github.com/0xbadjuju/MonkeyWorks.git
branch = master
[submodule "Tokenvator/DInvoke"]
path = Tokenvator/Resources/DInvoke
url = https://github.com/0xbadjuju/DInvoke.git
branch = dev
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ https://github.com/0xbadjuju/Tokenvator/wiki
Building instructions can be found here:<br>
https://github.com/0xbadjuju/Tokenvator/wiki/Building-Tokenvator

This project now utilizes [MonkeyWorks](https://github.com/NetSPI/MonkeyWorks), to clone issue the following command:<br>
This project now utilizes [MonkeyWorks](https://github.com/NetSPI/MonkeyWorks) and a modified verson of [DInvoke](https://github.com/0xbadjuju/DInvoke) ([Original](https://github.com/TheWover/DInvoke)) via SubModules. To clone issue the following command:<br>
**git clone _--recursive_ https://github.com/0xbadjuju/Tokenvator.git**

### Author, Contributors, and License
Expand Down
4 changes: 2 additions & 2 deletions Tokenvator.sln
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ Global
Release-Net45|x86 = Release-Net45|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0A1ADFEC-C824-4B97-9241-41C00CC2B982}.Debug|Any CPU.ActiveCfg = Release|Any CPU
{0A1ADFEC-C824-4B97-9241-41C00CC2B982}.Debug|Any CPU.Build.0 = Release|Any CPU
{0A1ADFEC-C824-4B97-9241-41C00CC2B982}.Debug|Any CPU.ActiveCfg = Release|x64
{0A1ADFEC-C824-4B97-9241-41C00CC2B982}.Debug|Any CPU.Build.0 = Release|x64
{0A1ADFEC-C824-4B97-9241-41C00CC2B982}.Debug|ARM.ActiveCfg = Debug|Any CPU
{0A1ADFEC-C824-4B97-9241-41C00CC2B982}.Debug|ARM.Build.0 = Debug|Any CPU
{0A1ADFEC-C824-4B97-9241-41C00CC2B982}.Debug|ARM64.ActiveCfg = Debug|Any CPU
Expand Down
41 changes: 41 additions & 0 deletions Tokenvator/MainLoop.Extentions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System.Diagnostics;

namespace Tokenvator
{
/// <summary>
/// Taken from stack overflow (probably)
/// Forgot to record the link
/// </summary>
public static class ProcessExtensions
{
private static string FindIndexedProcessName(int pid)
{
var processName = Process.GetProcessById(pid).ProcessName;
var processesByName = Process.GetProcessesByName(processName);
string processIndexdName = null;

for (var index = 0; index < processesByName.Length; index++)
{
processIndexdName = index == 0 ? processName : processName + "#" + index;
var processId = new PerformanceCounter("Process", "ID Process", processIndexdName);
if ((int)processId.NextValue() == pid)
{
return processIndexdName;
}
}

return processIndexdName;
}

private static Process FindPidFromIndexedProcessName(string indexedProcessName)
{
var parentId = new PerformanceCounter("Process", "Creating Process ID", indexedProcessName);
return Process.GetProcessById((int)parentId.NextValue());
}

public static Process Parent(this Process process)
{
return FindPidFromIndexedProcessName(FindIndexedProcessName(process.Id));
}
}
}
Loading