Skip to content

Instantly share code, notes, and snippets.

View samuelwilliams's full-sized avatar

Sam Williams samuelwilliams

View GitHub Profile
@samuelwilliams
samuelwilliams / UpdateLocalCredentials.ps1
Created September 9, 2020 03:15
Update local credentials of remote machines.
#Small object to simplify the handling of credentials.
class CredObject {
$Name
$Ip
$Username
$Password
}
#Change to full path of the credentials file with columns: Name, Ip, Username, Password
$machines = Import-CSV -Path "\path\to\machines.csv"
@samuelwilliams
samuelwilliams / uuid.php
Last active August 4, 2021 10:32
Generates a UUID in 8-4-4-4-12 notation
<?php
function uuid() {
$s = bin2hex(random_bytes(16));
return sprintf('%s-%s-%s-%s-%s',
substr($s, 0, 8),
substr($s, 8, 4),
substr($s, 12, 4),
substr($s, 16, 4),
@samuelwilliams
samuelwilliams / ps.te
Last active August 8, 2025 02:24
ps SELinux policy
# This is a sample SELinux policy module file to confine a process executing the /bin/ps binary
# The purpose is to act as a point of reference when writing policies for apps that make use of the ps functionality
policy_module(ps, 0.1)
type ps_t;
domain_type(ps_t)
allow ps_t self:cap_userns sys_ptrace;
allow ps_t self:capability dac_read_search;