Skip to content

Instantly share code, notes, and snippets.

View GeekMasher's full-sized avatar
🦀
Rusting...

Mathew Payne GeekMasher

🦀
Rusting...
View GitHub Profile
@GeekMasher
GeekMasher / PrintStatement.ql
Created July 14, 2023 10:17
Python Print Statement used query
/**
* @name Using Print Statement in Production Code
* @description Using Print Statement in Production Code
* @kind problem
* @problem.severity recommendation
* @id py/print-statement
* @precision very-high
* @tags correctness
*/
@GeekMasher
GeekMasher / licensing.py
Last active June 6, 2023 09:21
Get Dependency Graph as CSV
import os
import csv
import argparse
# pip install ghastoolkit
from ghastoolkit import GitHub, DependencyGraph
parser = argparse.ArgumentParser("licensing")
parser.add_argument(
"-r", "--repository",
default=os.environ.get("GITHUB_REPOSITORY"),
@GeekMasher
GeekMasher / Q1_FindSource.ql
Last active May 1, 2023 19:19
DC44131 2023 Talk - Introduction to CodeQL
/**
* @name SQL Injection - Find Source
* @description SQL Injection - Find Source
* @kind problem
* @id py/workshop
* @problem.severity error
* @security-severity 10.0
* @sub-severity high
* @precision high
* @tags security
@GeekMasher
GeekMasher / unauth.ql
Last active December 10, 2022 18:40
LiverOverflow CodeQL
/**
* @name test
* @kind problem
* @id js/unauthorized
* @tags security
*/
import javascript
// https://github.com/cisagov/RedEye
@GeekMasher
GeekMasher / install.sh
Last active July 19, 2021 15:01
Install Nvidia Cuda (ubuntu/debian)
#!/bin/bash
# Install one-liner:
# ```
# curl -o install.sh https://gist.githubusercontent.com/GeekMasher/29999096c764675bcb6cc89c65e687b5/raw/install.sh && chmod +x install.sh && bash -c ./install.sh
# ```
# References:
#  - https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#ubuntu-installation
distro=$(cat /etc/os-release | grep -m 1 NAME | cut -d \" -f2)
version=$(cat /etc/os-release | grep -m 1 VERSION_ID | cut -d \" -f2 | sed 's/\.//g')
@GeekMasher
GeekMasher / codeql-config.yml
Last active May 26, 2021 12:58
Learning Journey - Configurations
name: "Custom CodeQL Configuration"
# Disabling the default queries is critical part of this.
# Nothing will be disabled if the default queries still run.
# - https://docs.github.com/en/code-security/secure-coding/configuring-code-scanning#disabling-the-default-queries
disable-default-queries: true
queries:
# Point to the custom query suite that needs to be used
- uses: ./.github/codeql/custom-javascript.qls
USERNAME=$1
mkdir -p ~/.ssh
if ! [[ -f ~/.ssh/authorized_keys ]]; then
echo "Creating new ~/.ssh/authorized_keys"
touch ~/.ssh/authorized_keys
fi
keys=`curl https://api.github.com/users/$USERNAME/keys | grep -o -E "ssh-\w+\s+[^\"]+"`
<HTML>
<HEAD>
<TITLE>Hello World</TITLE>
</HEAD>
<BODY>
<H1>Hello World</H1>
Today is: <%= new java.util.Date().toString() %>
</BODY>
</HTML>