Skip to content

Instantly share code, notes, and snippets.

View pythoninthegrass's full-sized avatar

pythoninthegrass

View GitHub Profile
anonymous
anonymous / NoPixScal125Pct.cpp
Created August 4, 2015 22:57
//#define WITH_DEBUG_CONSOLE
#ifndef UNICODE
# define UNICODE
#endif
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
@rickychilcott
rickychilcott / gist:6104913
Last active May 5, 2017 00:15
Remove outdated users
#!/bin/bash
# List of users to keep
KEEP=$( cat <<EOL
/Users/admin
/Users/administrator
/Users/sccadmin
/Users/scclab
/Users/Shared
/Users/Search
@mbbx6spp
mbbx6spp / create_system_user.sh
Created December 7, 2011 06:19
Removing the crazy amount of hoops you need to jump through to create system users on OS X. I can't believe how painful this is. These thirteen commands are just two on Linux and real BSDs. WTF?
# These are bash functions. You can just source them on startup based on uname
# if you use the same dotfiles for all systems.
function listUsers() {
dscl . -list /Users UniqueID;
}
function listGroups() {
dscl . -list /Groups PrimaryGroupID;
}
@dotps1
dotps1 / WannaCryVulnerbilityTesting.ps1
Last active May 31, 2017 13:31
Test for WannaCry Vulns using PSJobs
#requires -module ActiveDirectory
# Input computers.
$threshold = (Get-Date).AddDays(-180)
$computers = Get-ADComputer -Filter { OperatingSystem -notlike "*server*" -and OperatingSystem -like "*windows*" -and PasswordLastSet -gt $threshold } |
Select-Object -ExpandProperty Name |
Sort-Object -Property Name
# Make sure there are not existing jobs.
Get-Job |
@ploegert
ploegert / Enable-PSRemoting.ps1
Created June 9, 2015 14:30
Install PowershelL remoting Enables PowerShell remoting
#
# Enables PowerShell remoting
#
function Enable-Remoting
{
[CmdletBinding()]
param()
Write-Log 'Enabling PowerShell Remoting...'
$Port = "8530"
$Name = "WSUS"
$LogFile = "C:\WSUS_server_cleanup_log.txt"
Get-Date | Tee-Object -file $LogFile
Get-WsusServer -PortNumber $Port -Name $Name | Invoke-WsusServerCleanup -CleanupObsoleteComputers | Tee-Object -file $LogFile -append
Get-WsusServer -PortNumber $Port -Name $Name | Invoke-WsusServerCleanup -CleanupUnneededContentFiles | Tee-Object -file $LogFile -append
Get-WsusServer -PortNumber $Port -Name $Name | Invoke-WsusServerCleanup -CleanupObsoleteUpdates | Tee-Object -file $LogFile -append
Get-WsusServer -PortNumber $Port -Name $Name | Invoke-WsusServerCleanup -DeclineExpiredUpdates | Tee-Object -file $LogFile -append
minimal:~# cat /etc/sysctl.conf
#
# /etc/sysctl.conf - Configuration file for setting system variables
# See /etc/sysctl.d/ for additonal system variables
# See sysctl.conf (5) for information.
#
#kernel.domainname = example.com
# Uncomment the following to stop low-level messages on console
@kkirsche
kkirsche / nmapxml_to_csv.py
Last active July 25, 2017 18:57
Nmap XML to CSV File
import os
import glob
import csv
from libnmap.parser import NmapParser
dir_path = os.path.dirname(os.path.realpath(__file__))
with open('nmap_results.csv', 'wb') as output_file:
writer = csv.writer(output_file)
# BoxStarter script
#START http://boxstarter.org/package/nr/url?<raw url>
Set-ExplorerOptions -showHiddenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Enable-RemoteDesktop
Move-LibraryDirectory "Personal" "$env:UserProfile\OneDrive\documents"
cinst 7zip
cinst chrome
@arubdesu
arubdesu / killUnauthorizedAdminUsers.py
Last active October 3, 2017 03:19
dscl+python for common tasks
#!/usr/bin/python
import subprocess
import sys
from SystemConfiguration import *
# grab who our logging in user is
cur_console_user = SCDynamicStoreCopyConsoleUser(None, None, None)[0]
# check admin group
cmd = '/usr/bin/dscl', '.', 'list', '/Groups/admin'
out = subprocess.check_output(cmd)
# split output into list of strings for the usernames