Skip to content

Instantly share code, notes, and snippets.

View GabrielNagy's full-sized avatar
🥴

Gabriel Nagy GabrielNagy

🥴
View GitHub Profile
#include <windows.h>
#include <stdio.h>
// Inject a DLL into a process
void Inject(HANDLE hProcess, const char* dllname, const char* funcname);
// Program entry point
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
// Structures for creating the process
#include <windows.h>
#include <fcntl.h>
#include <stdio.h>
#include <io.h>
//-----------------------------------------------------------------------------
// Codecave function
VOID Codecave(DWORD destAddress, VOID (*func)(VOID), BYTE nopCount);
@GabrielNagy
GabrielNagy / displayversion.ps1
Created October 11, 2021 11:39
displayversion.ps1
$NTVerKeyPath = "Registry::HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
$WindowsDisplayVersionObj = Get-ItemProperty -ErrorAction SilentlyContinue -Path "$NTVerKeyPath" -Name DisplayVersion
$WindowsDisplayVersionObj
$WindowsDisplayVersionObj.DisplayVersion
@GabrielNagy
GabrielNagy / bitvise_allow_everyone.ps1
Created September 28, 2020 13:28
bitvise_allow_everyone
$cfg = new-object -com "BssCfg815.BssCfg815"
$cfg.settings.SetDefaults()
$cfg.settings.access.SetDefaults()
$cfg.settings.access.winGroups.Clear()
$cfg.settings.access.winGroups.new.SetDefaults()
$cfg.settings.access.winGroups.new.loginAllowed = $true
$cfg.settings.access.winGroups.NewCommit()
$cfg.settings.Save()
test_name "puppetserver jruby does not retain Catalog objects in memory after requests finish" do
tag 'audit:high',
'server'
require 'puppet/acceptance/common_utils'
extend Puppet::Acceptance::PackageUtils
extend Puppet::Acceptance::ManifestUtils
skip_test 'jruby is only available on server nodes' unless master
// Close all open file descriptors above stderr
#if defined(HAS_CLOSEFROM)
closefrom(STDERR_FILENO + 1);
#elif defined(HAVE_PROC_PID)
uint64_t fd;
const char* fdpath = "/proc/self/fd";
std::list<uint64_t> fd_list;
if (is_directory(fdpath)) {
for (const directory_entry& dent : directory_iterator(fdpath)) {
include(FindDependency)
find_dependency(UDEV DISPLAY "udev" HEADERS "libudev.h" LIBRARIES "udev")
include(FeatureSummary)
set_package_properties(UDEV PROPERTIES DESCRIPTION "A device manager for the Linux kernel" URL "http://www.freedesktop.org/wiki/Software/systemd")
set_package_properties(UDEV PROPERTIES PURPOSE "Reports disks serial numbers.")
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@GabrielNagy
GabrielNagy / wrapper.py
Created December 4, 2017 21:08
input/output tester
#!/usr/bin/env python
import shutil
import os
import glob
import filecmp
from timeit import timeit
def number_of_tests(problem):
return len([name for name in os.listdir('tests/%s' % problem) if os.path.isfile(os.path.join('tests', problem, name))]) / 2