Skip to content

Instantly share code, notes, and snippets.

Avatar

Liam Haworth LiamHaworth

View GitHub Profile
View README.md

Reproduction code for golang/go#35314

This gist contains example code to reproduce golang/go#35314, due to the privilege requirements of DuplicateTokenEx the code is designed to run as a service which then spawns a child process and logs the output of the child process to the Windows event log.

Written for go 1.13.4

Running the code

View README.md

GUID Converter

When MSIs are installed on a Windows system, the GUID of a UpgradeCode or ProductCode are "formated" and then stored in the registry, this makes it difficult to locate related registry keys.

This gist provides a simple Golang script (with provided play link) to convert a GUID into a formated version that can be searched.

For the record, to convert a guid to the format used in the registry

@LiamHaworth
LiamHaworth / callback.go
Created Mar 26, 2018
Network change detection on macOS
View callback.go
package main
/*
#cgo CFLAGS: -mmacosx-version-min=10.6 -D__MAC_OS_X_VERSION_MAX_ALLOWED=1080
#cgo LDFLAGS: -framework CoreFoundation -framework SystemConfiguration
#include <SystemConfiguration/SystemConfiguration.h>
*/
import "C"
import "unsafe"
@LiamHaworth
LiamHaworth / main.go
Last active Aug 18, 2021
Example of run an interactive process on the current user from system service on windows (Golang)
View main.go
package main
import (
"github.com/kardianos/service"
"log"
"flag"
)
type Service struct {}
@LiamHaworth
LiamHaworth / notifyAddrChange.go
Created Jun 22, 2017
A simple go program leveraging the Window API to listen for IPv4 network address change events
View notifyAddrChange.go
package main
import (
"log"
"syscall"
"unsafe"
"golang.org/x/sys/windows"
)
@LiamHaworth
LiamHaworth / whoOwnsThisIP.sh
Last active Sep 9, 2016
A simple bash tool to lookup the own of an IP address. TL;DR a straight to the point whois
View whoOwnsThisIP.sh
#!/bin/bash
#
# A simple bash script to look up
# who owns an IP Address based on
# the IP address's whois data
#
# Author: Liam Haworth <liam@haworth.id.au>
#
IPADDR=$1
@LiamHaworth
LiamHaworth / getModelFromServiceTag
Created May 25, 2016
A simple little tool for the CLI to lookup the model for a Dell system based on its service tag
View getModelFromServiceTag
#!/bin/bash
#
# A simple command line tool to
# look the system model for a Dell
# service tag
#
# Usage:
# getModelFromServiceTag SERVICE_TAG
#
# Author: Liam Haworth <liam.haworth@tesserent.com>
@LiamHaworth
LiamHaworth / findBlob.sh
Created May 5, 2016
Simple little bash function to search file for a section of text when you only now the start and end of the sections (Used to search postgresql database dumps)
View findBlob.sh
#// Searchs a file for a blob (section)
#// and returns what it finds in a array
#//
#// PARAMS:
#// $1 String - The name of the file to search
#// $2 String - The upper bound (start) of the blob
#// $3 String - The lower bound (end) of the blob
#// $4 Boolean - Defines if the contense of the bounds should be included in the results
findBlobInFile() {
mapfile -t lines < <(cat $1)
@LiamHaworth
LiamHaworth / CrateObject.scala
Last active Aug 29, 2015
A simple yet powerful helper class to provide the most simplistic way to create & drop tables and insert & select data based on scala case classes in Crate DB (https://crate.io) | Requires the Crate Java Client (https://bintray.com/crate/crate/crate-client/view)
View CrateObject.scala
import java.io.IOException
import io.crate.client.CrateClient
/**
* CrateObject supplies methods
* for objects to store them in
* a Crate Database
*
* @author Liam Haworth
* @version 1.0