Skip to content

Instantly share code, notes, and snippets.

View ILightThings's full-sized avatar
🏠
Working from home

iLightThings ILightThings

🏠
Working from home
View GitHub Profile
@ILightThings
ILightThings / Round.py
Last active January 23, 2024 13:32
Get the next biggest rounded number
# Useful for padding buffers
# Useful in C
Size_Of_Target = 189
Round_Number = 12
target = Size_Of_Target + Round_Number - (Size_Of_Target % Round_Number)
print(target)
#189 + 12 = 201
import xmltodict
import json
import re
import sys
def FindShares(filename):
with open(filename ,encoding="utf8") as fd:
doc = xmltodict.parse(fd.read())
for host in doc['NessusClientData_v2']['Report']['ReportHost']:
import xmltodict
import json
import re
import sys
SHARESEXTRACT = r"""- (.+) - (\(readable\)|\(readable,writable\))"""
def formatShareName(host,item):
permission = ""
if "readable" in item[1]:
@ILightThings
ILightThings / localadmin.neo4j.txt
Created June 30, 2022 12:47
Neo4j Find users who are localadmins
MATCH p=(m:User)-[r:AdminTo]->(n:Computer) RETURN m.name AS User, collect (n.name) as AdminTo
@ILightThings
ILightThings / neo4j find all HV members (Default Groups)
Created June 30, 2022 12:45
Neo4j query to find all members of "Administrators, Domain Admins, Enterprise Admins"
#http://127.0.0.1:7474/browser/ - NEO4J Browser
MATCH p=(n:Group)<-[:MemberOf*1..]-(m) WHERE n.objectid =~ "(?i).*S-1-5-32-544" RETURN n.name,collect(m.name) UNION MATCH p=(n:Group)<-[:MemberOf*1..]-(m) WHERE n.objectid =~ "(?i)S-1-5-.*-512" RETURN n.name,collect(m.name) UNION MATCH p=(n:Group)<-[:MemberOf*1..]-(m) WHERE n.objectid =~ "(?i)S-1-5-.*-519" RETURN n.name,collect(m.name)
@ILightThings
ILightThings / catch inturpute
Created February 22, 2022 17:05
Golang Catch CTRL+C inturpute
signalChan := make(chan os.Signal, 1)
signal.Notify(signalChan, os.Interrupt)
defer func() {
signal.Stop(signalChan)
cancel()
}()
go func() {
select {
case <-signalChan:
// caught CTRL+C
@ILightThings
ILightThings / xor_encoding.nim
Last active July 9, 2023 17:16
Nim Xor Encoding
proc xorEncode(key,data: string): seq[uint8] =
# Requires a string key and string data. Returns a seq of xor encoded data.
var finalkey: string = ""
var result: seq[uint8]
#Keep repeating the key until it is equal or greater then the data
while finalkey.len < data.len :
finalkey.add(key)
#If key is bigger then the data, delete excess key values. Do I really need to do this? no.
@ILightThings
ILightThings / quick_threading.py
Created March 16, 2021 14:13
very quick function to do multithreading in python
import concurrent.futures
list_variable=[]
with open('list.txt','r') as f: #Import a file into a list
for line in f:
list_variable.append(line.strip())
def function_name(paramerter1): #Function with a single parameter
print(paramerter1)
@ILightThings
ILightThings / Input_edit.py
Created March 15, 2021 20:06
Useful for sending variants of the same data over again but needing to edit it slightly.
import readline
def rlinput(prefill):
readline.set_startup_hook(lambda: readline.insert_text(prefill))
try:
return input() # or raw_input in Python 2
finally:
readline.set_startup_hook()
query = ""
@ILightThings
ILightThings / ine_vpn_fix.sh
Created March 3, 2021 19:40
A quick script to auto add the username and password to the openvpn file provided by ine.
#!/bin/bash
if [ ! $# == 3 ]; then
echo "Usage: vpnfix.sh /full/path/to/vpn.ovpn username password"
exit
fi
file_path=$(dirname $1)
echo $file_path