Skip to content

Instantly share code, notes, and snippets.

@tomhebbron
tomhebbron / gist:1439612
Created December 6, 2011 19:39
Awesome Python libs
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
@tomhebbron
tomhebbron / get_AD_users_and_groups.ps1
Last active July 21, 2020 09:50
Useful PowerShell for extracting / reporting on AD users and groups
Import-Module ActiveDirectory
 
#users
$users = Get-ADUser -filter * -properties AccountExpirationDate, AccountLockoutTime, AccountNotDelegated, AllowReversiblePasswordEncryption, CannotChangePassword, CanonicalName, Created, Deleted, Description, DisplayName, DistinguishedName, EmailAddress, EmployeeID, EmployeeNumber, Enabled, GivenName, HomeDirectory, HomedirRequired, LastBadPasswordAttempt, LastLogonDate, LockedOut, LogonWorkstations, Modified, Name, PasswordExpired, PasswordLastSet, PasswordNeverExpires, PasswordNotRequired, PrimaryGroup, ProfilePath, SamAccountName, SID, SIDHistory, Surname, Title, TrustedForDelegation, TrustedToAuthForDelegation, UserPrincipalName
#$users | export-clixml "C:\temp\ADUsers.xml"
#Groups (with members)
$groups = Get-ADGroup -filter * -properties CanonicalName, Created, Deleted, Description, DisplayName, DistinguishedName, GroupCategory, GroupScope, ManagedBy, MemberOf, Members, Modified, Name, ObjectCategory, ObjectClass, ObjectGUID, SamAccountName, SID 
#$groups | expo
@tomhebbron
tomhebbron / unpack_users_and_groups_XML.ps1
Created July 21, 2020 09:41
PowerShell unpack AD users and groups XML
$groups = Import-Clixml c:\temp\ADGroups.xml
$users = Import-Clixml c:\temp\ADUsers.xml
$users | export-csv -NoTypeInformation c:\temp\AD-users.csv
$groups | export-csv -NoTypeInformation c:\temp\AD-groups.csv
@tomhebbron
tomhebbron / crack_the_padlock.py
Last active May 30, 2022 17:09
Crack the padlock logic challenge - python brute force!
def rightplace(a,b,len=3):
astr = str.zfill(str(a),len)
bstr = str.zfill(str(b),len)
return [1 if astr[x]==bstr[x] else 0 for x in range(len)]
def wrongplace(a,b,len=3):
astr = str.zfill(str(a),len)
bstr = str.zfill(str(b),len)
return [1 if astr[x] in bstr and astr[x] != bstr[x] else 0 for x in range(len)]