Skip to content

Instantly share code, notes, and snippets.

@calum-github
calum-github / gist:f19699aef289ceb7d9bcedc84191c7fa
Last active June 27, 2018 00:41
Installing Pip on Mac OS 10.12+
## Download the get pip script
$ curl -o get_pip.py https://bootstrap.pypa.io/get-pip.py
## Switch to root user
$ sudo su
## Run the script as root
# ./get_pip.py
## Switch back to regular user and install modules with pip
@calum-github
calum-github / ad_check.sh
Created May 9, 2018 07:08
checks to see if its bound to AD or not.
#!/bin/bash
#################################################################################
# #
# Author: Calum Hunter #
# Date: 22-08-2016 #
# Version: 1.0 #
# Purpose: Install check script for the AD Bind Package. #
# This script checks to see if we are bound to AD and if our binding #
# is working. If we are not bound, or our binding is broken. #
#!/usr/bin/expect
expect "connecting"
send "yes\r"
exit 0
@calum-github
calum-github / fixUserShell.py
Last active April 16, 2018 03:43
Fix user's default shell in their user record in /Local/Default
#!/usr/bin/python
'''
Author: Calum Hunter
Date: April 16 2018
Version: 1.0
This script will get the current UserShell
value set in the users record in /Local/Default
# Option 1
# Get the data from the ManagedClient section of the System Profiler
system_profiler SPManagedClientDataType
# Additional - you can also provide the -xml flag to get the output in xml
system_profiler -xml SPManagedClientDataType
# Option 2
# use mcxquery
mcxquery
@calum-github
calum-github / com.org.logstash.plist
Created February 22, 2017 02:23
com.org.logstash.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.org.logstash</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/logstash-5.2.1/bin/logstash</string>
<string>-f</string>
@calum-github
calum-github / log stash.conf
Last active April 10, 2017 07:03
Log stash config file for influxdb - pull data out of sqlite db, add some fields/tags and send to influx
input {
jdbc {
jdbc_driver_library => "/usr/local/logstash-5.2.1/plugins/sqlite-jdbc-3.16.1.jar"
jdbc_driver_class => "org.sqlite.jdbc"
jdbc_connection_string => "jdbc:sqlite:/Library/Server/Caching/Logs/Metrics.sqlite"
jdbc_user => ""
schedule => "* * * * *"
statement => 'SELECT * FROM statsData WHERE metricname LIKE "bytes.%.toclients" OR metricname LIKE "bytes.%.topeers"'
tracking_column => "entryindex"
use_column_value => true
@calum-github
calum-github / mount_shares.py
Created December 24, 2016 00:46
mount shares in python
#!/usr/bin/python
############################################################
# #
# Author: Calum Hunter #
# Date: 10-10-2016 #
# Version: 2.30 #
# Purpose: Mount shares using NetFS #
# Credit: Big shout outs to Frogor and Mosen for this #
# This is all pretty much their code #
@calum-github
calum-github / ad.sh
Last active December 1, 2016 02:49
iterate over ad users to determine uid
#!/bin/bash
#
# Author: Calum Hunter
# Date: 28/11/2016
# Version: 1.0
# Purpose: To generate a Mac UID from the objectGUID attribute
# (GeneratedUID) in AD.
# This uses the same method that the Apple
# AD Plugin uses
@calum-github
calum-github / convert.sh
Last active July 23, 2020 23:35
AD Plugin UID calculation from ObjectGUID
#!/bin/bash
#
# Author: Calum Hunter
# Date: 28/11/2016
# Version: 1.0
# Purpose: To generate a Mac UID from the objectGUID attribute
# (GeneratedUID) in AD.
# This uses the same method that the Apple
# AD Plugin uses