diff --git a/blog/2019-03-10_new-site.md b/blog/2019-03-10_new-site.md new file mode 100644 index 0000000..9570f20 --- /dev/null +++ b/blog/2019-03-10_new-site.md @@ -0,0 +1,4 @@ +# New Blog + +This is a new blog that will serve as my central hub for sharing ideas, +tutorials, and thoughts. diff --git a/blog/2019-03-11_introduction-to-qemu.md b/blog/2019-03-11_introduction-to-qemu.md new file mode 100644 index 0000000..ec8e2dc --- /dev/null +++ b/blog/2019-03-11_introduction-to-qemu.md @@ -0,0 +1,108 @@ +# Introduction to QEMU for Hackers + +One of the things that I've noticed in the infosec community is the tendency to +stick to the proprietary virtualization tools that are familiar. +People often are quick discount tools that they don't already know, so I have +written this blog post in an attempt to foster an interest in exploring other +virtualization options. My hope is that, even if you don't come away wanting to +use QEMU in your CTF lab or malware analysis playpen, you will at least be more +open to looking into other forms of emulation and virtualization. + +## The Case for QEMU +Many hacking event organizers spend ample time pointing and clicking through +their VirtualBox and VMware configuration wizards to setup their hacking labs. +What if I told you there was a better way that works on Linux, macOS, Windows, +and Xen? + +### Enter QEMU +With [QEMU](https://www.qemu.org/) your VMs are defined as the arguments passed +to QEMU on its invocation at the command line. For example, you might invoke a +VM as such (note that **`>`** is a +[**$PS2** prompt](http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x157.html)): +``` +$ qemu-system-x86_64 -machine type=q35 --enable-kvm -cpu host -smp cpus=8 \ +> -m 512M -netdev user,id=net0 -device e1000,netdev=net0 -hda dsk/vm-hdd.qcow +``` + +### Shell Scripts as VM Templates + +Obviously this isn't a good long-term way to run your VM, but fear not, as there +is a better way! All you have to do is save your VM arguments to an executable +shell script like the following: +``` +#!/usr/bin/env bash + +# image creation command: +# qemu-img create -f qcow2 -o preallocation=metadata dsk/vm-hdd.qcow 20G + +qemu-system-x86_64 \ + -machine type=q35 \ + --enable-kvm \ + -cpu host \ + -smp cpus=8 \ + -m 512M + -netdev user,id=net0 \ + -device e1000,netdev=net0 \ + -hda dsk/vm-hdd.qcow \ +; +``` + +Don't forget to make your script executable! +``` +$ chmod +x vm-foo +``` + +The nice thing about these scripts is that you can freely copy and edit them +with the standard UNIX command-line tools that you are used to, meaning that +you can use one VM script as a template for another virtual machine. Making a +VM based on a template then becomes as simple as copying a bash script: +``` +$ cp vm-foo vm-bar +``` + +For more information on creating QEMU disk images, see the +[qemu-img(1)](https://linux.die.net/man/1/qemu-img) man page. + +### QEMU's Advanced Features +QEMU is a capable of emulating foreign CPU architectures, as well as working in +conjunction with a hypervisor to perform fully-accelerated, near +native-performance virtualization. Some of the supported architectures for +full-system emulation are: + +- Alpha +- Altera Nios II +- ARM +- Axis ETRAX CRIS +- HP PA-RISC +- i386/x86 +- IBM System/390 +- Microblaze (big and little endian) +- MIPS (big and little) +- MIPS64 (big and little) +- Motorola 68000 +- Moxie +- OpenRISC 1k (IP core for FPGAs) +- PowerPC +- PowerPC 64 (big and little) +- RISC V +- RISC V 64 +- SuperH SH-4 +- SPARC and SPARC32 Plus +- SPARC64 +- TILE-Gx +- Xtensa + +Some of its other features include: + +- Support for the Intel HAXM, Linux KVM, and Xen hypervisors +- PCIe passthrough +- attaching physical disks to VMs +- USB passthrough +- network block devices +- importing and converting disks from other formats +- command-line interactive monitor +- VNC support +- multiple virtual VGA adapters and video modes +- tap/tun support (bridging to actual network interfaces on the host) + +*Stay tuned for more!* diff --git a/blog/2022-02-04_inkscape-eps.md b/blog/2022-02-04_inkscape-eps.md new file mode 100644 index 0000000..b48203c --- /dev/null +++ b/blog/2022-02-04_inkscape-eps.md @@ -0,0 +1,22 @@ +# Inkscape Postscript Export in 2022 + +A lot of older guides using Inkscape to convert SVG images to PostScript +use a `-E` CLI flag that no longer exists in the Inkscape CLI: +~~`inkscape input.svg -E out.eps`~~. + +**The correct way to do this in the *current* year:** +``` +inkscape --export-type=eps -o out.eps in.svg +``` + +If you want to automatically convert all of the `.svg` files in your current +working directory to `.eps` files, you can use something like this script: +```bash +#!/usr/bin/env bash +for svg in *.svg; do + bname=$(basename "$svg" | sed 's/\.svg$//g') + echo "Converting \""$bname"\"..." + echo -e "\tinkscape --export-type=eps -o \"$bname.eps\" \"$svg\"" + inkscape --export-type=eps -o "$bname.eps" "$svg" +done +``` diff --git a/blog/2022-03-28_FFmpeg-Window-Capture.md b/blog/2022-03-28_FFmpeg-Window-Capture.md new file mode 100644 index 0000000..d2f84d8 --- /dev/null +++ b/blog/2022-03-28_FFmpeg-Window-Capture.md @@ -0,0 +1,164 @@ +# FFmpeg Window Capture + +If you've read the FFmpeg website's +[Capture/Desktop](https://trac.ffmpeg.org/wiki/Capture/Desktop) page +or another similar tutorial about screen recording, you may have learned +that the `x11grab` device can be used to capture a specific region of your +screen, but did you know that you can also record a window by it's ID just +like OBS does? + +First, you'll need to find the ID of the window that you want to capture +with `xwininfo`: + +