Skip to content

Instantly share code, notes, and snippets.

@optionalg
optionalg / send-publickey-connect.sh
Created June 2, 2021 05:04 — forked from neilkuan/send-publickey-connect.sh
send public key to connect ec2
#!/bin/bash
instanceId=$1
pubkey="$HOME/.ssh/id_rsa.pub"
sshUser='ec2-user'
az=$(aws ec2 describe-instances --instance-id ${instanceId} --query 'Reservations[0].Instances[0].Placement.AvailabilityZone' --output text)
echo "sending public key to ${instanceId}"
aws ec2-instance-connect send-ssh-public-key --instance-id ${instanceId} --instance-os-user ${sshUser} \
@optionalg
optionalg / 01_aws_rbd_cli.md
Created June 2, 2021 05:02 — forked from thieryl/01_aws_rbd_cli.md
[AWS] Amazon Web Services #aws

AWS CLI RBD

White list office ip

aws allow-my-ip "Proxy-Cerebro" tcp 22 rbd_sys
@optionalg
optionalg / exec-remoteScript.sh
Created June 2, 2021 05:01 — forked from CalebTodd/exec-remoteScript.sh
AWS Execute Local Script on Remote Host
#!/usr/bin/env bash
file='./my_script.sh'
tagKey='Name'
remote_user='ec2-user'
# Read arguments & set variables
while [[ $# -gt 0 ]]
do
key="$1"
@optionalg
optionalg / syntax_highlighting.py
Created June 1, 2021 17:05 — forked from phillipkoebbe/syntax_highlighting.py
Syntax highlight switcher for Sublime Text 2
import sublime, sublime_plugin
import os, string, re
class DetectFileTypeCommand(sublime_plugin.EventListener):
""" Attempts to choose the correct syntax when more than one could apply. """
def __init__(self):
super(DetectFileTypeCommand, self).__init__()
self.path = None
@optionalg
optionalg / gist:20c69899923803b7176d824ca1af6508
Created May 17, 2020 14:41 — forked from tillson/gist:620e8ef87bc057f25b0a27c423433fda
Decode Base64 strings in a git repo's commit history
from pydriller import RepositoryMining
import re
import base64
foundSet = set()
for commit in RepositoryMining('./').traverse_commits():
for mod in commit.modifications:
if mod.source_code_before != None:
regex = re.findall(r"<text encoding=\"base64\">[^>]+</text>", mod.source_code_before)
for result in regex:
@optionalg
optionalg / PowerView-3.0-tricks.ps1
Created November 29, 2019 02:07 — forked from HarmJ0y/PowerView-3.0-tricks.ps1
PowerView-3.0 tips and tricks
# PowerView's last major overhaul is detailed here: http://www.harmj0y.net/blog/powershell/make-powerview-great-again/
# tricks for the 'old' PowerView are at https://gist.github.com/HarmJ0y/3328d954607d71362e3c
# the most up-to-date version of PowerView will always be in the dev branch of PowerSploit:
# https://github.com/PowerShellMafia/PowerSploit/blob/dev/Recon/PowerView.ps1
# New function naming schema:
# Verbs:
# Get : retrieve full raw data sets
# Find : ‘find’ specific data entries in a data set
@optionalg
optionalg / PowerView-2.0-tricks.ps1
Created November 29, 2019 02:06 — forked from HarmJ0y/PowerView-2.0-tricks.ps1
PowerView-2.0 tips and tricks
# NOTE: the most updated version of PowerView (http://www.harmj0y.net/blog/powershell/make-powerview-great-again/)
# has an updated tricks Gist at https://gist.github.com/HarmJ0y/184f9822b195c52dd50c379ed3117993
# get all the groups a user is effectively a member of, 'recursing up'
Get-NetGroup -UserName <USER>
# get all the effective members of a group, 'recursing down'
Get-NetGroupMember -GoupName <GROUP> -Recurse
# get the effective set of users who can administer a server
@optionalg
optionalg / Simple_Rev_Shell.cs
Created October 26, 2019 05:33
C# Simple Reverse Shell Code
using System;
using System.Text;
using System.IO;
using System.Diagnostics;
using System.ComponentModel;
using System.Linq;
using System.Net;
using System.Net.Sockets;
@optionalg
optionalg / IncompatibleAppsList.plist
Created October 11, 2019 16:14 — forked from stevemoser/IncompatibleAppsList.plist
List of 235 apps incompatible with macOS Catalina 10.15
<?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>IncompatiblePaths</key>
<array>
<dict>
<key>Application Name</key>
<string>Sxs Memory Card Driver</string>
<key>Blurb</key>
@optionalg
optionalg / aws_saml.py
Created August 27, 2019 02:43 — forked from JoeyG1973/aws_saml.py
aws saml login with session that auto refreshes.
# Took this:
# https://s3.amazonaws.com/awsiammedia/public/sample/SAMLAPICLIADFS/samlapi_formauth_adfs3.py
# converted to boto3 and smooshed it together with this:
# https://gist.github.com/kapilt/ac8e222081f63ba64e93
# which gave birth too this:
import sys
import botocore
import boto3
import requests