Skip to content

Instantly share code, notes, and snippets.

@infosec-intern
infosec-intern / example-profile.ps1
Created June 4, 2016 13:56
Example script to load user-specific modules into your PowerShell profile. Tested in PowerShell v5
$RootDir = 'C:\Users\user\Documents\WindowsPowerShell'
$Counter=0
ForEach ($Module in $(Get-ChildItem "$RootDir\Modules")) {
try {
Import-Module $Module\*.psd1
}
catch {
Import-Module $Module\*.psm1
}
$Counter++
@infosec-intern
infosec-intern / touch-alias.ps1
Created June 4, 2016 14:21
Adds a Unix-like "touch" command to PowerShell. Add to your profile to get this on PowerShell startup
New-Alias -Name "touch" -Value "New-Item" -Force
@infosec-intern
infosec-intern / Makefile
Created August 22, 2016 23:30
New exercise and skeleton Makefile scripts - makes creating new exercises easier for LearnCTheHardWay
CFLAGS=-Wall -g
EX=
all:
make ${EX}
ec:
gcc ${CFLAGS} -o ec extracredit.c
broken:
DOMAIN=https://analytics.northpolewonderland.com
if [ ! -f "./zpipe" ]
then
# From: https://stackoverflow.com/questions/1532405/how-to-view-git-objects-and-index-without-using-git
echo "[*] There is no zpipe binary here! Downloading and compiling..."
wget https://github.com/madler/zlib/raw/master/examples/zpipe.c
sudo apt-get install zlib1g-dev > /dev/null
gcc -o zpipe zpipe.c -lz
else
@infosec-intern
infosec-intern / vscode.desktop
Last active February 24, 2024 17:29
A simple .desktop file for Visual Studio Code
[Desktop Entry]
Name=Visual Studio Code
Comment=Programming Text Editor
Exec=/usr/local/src/VSCode-linux-x64/code
Icon=/usr/local/src/VSCode-linux-x64/resources/app/resources/linux/code.png
Terminal=false
Type=Application
Categories=Programming;
tcpdump -i wlan0 -nn -XX -S -s 0 -w /media/data/packets.pcap -vvv host 192.168.1.100
# -i wlan0 : Only capture packets coming in through interface wlan0
# -nn: Don't resolve hostnames or port numbers
# -XX: Capture packet contents in hex, ASCII, and ethernet headers
# -S: Print sequence numbers
# -s 0: Collect the entire length of a packet instead of just the first 96 bytes
# -w <file>: Write data to the specified file
# -vvv: Get really, really verbose. Show me all the info tcpdump has
# host 192.168.1.100: Filter incoming packets to only those coming to/from this host
@infosec-intern
infosec-intern / gcc_compile_flags.sh
Last active January 26, 2017 12:24
Compile a C program without using the standard entry method. For example, if you supply your own _start function
gcc -nostdlib -o test test.c # don't use the standard library when compiling (enables using _start() directly)
gcc -m32 -o test test.c # compile a 32-bit executable
gcc -m64 -o test test.c # compile a 64-bit executable
gcc -c -o obj1.o obj1.c # create an object file, but do not link the result(s) into an executable
# Can be combined with -m{32,64}
@infosec-intern
infosec-intern / for_loop.c
Last active February 1, 2017 04:36
Integrate if statements like the following directly in the for loop conditional
for(i = 0; i < GLOB_MAX && globs[i][0] != '\0'; i++) {
// if (globs[i][0] == '\0') {
// continue;
// }
printf("Glob[%d] = %s\n", i, globs[i]);
}

Keybase proof

I hereby claim:

  • I am infosec-intern on github.
  • I am thomasgardner (https://keybase.io/thomasgardner) on keybase.
  • I have a public key ASCmwjj8bTwRX-4meSA-LzkvknPLhIXsxmV-27joWnjo3go

To claim this, I am signing this object:

[Desktop Entry]
Name=FireFox Nightly
Comment=Web Browser
Exec=/usr/local/bin/firefox
Icon=/usr/local/src/firefox/browser/icons/mozicon128.png
Terminal=false
Type=Application
Categories=Internet;