Tag Archives: linux
Linux Shared Object Tutorial
Shared object files contain a library of functions that can be used by an executable. When functions are copied from a library into an executable at compile time, source object is called a “static” library. When functions from a library … Continue reading
Make your Caps Lock key another Control key in Linux
You aren’t even using your Caps Lock key, and if you are, you shouldn’t be. If you’re like me and you write a lot of code, especially in Emacs, you probably hit your Control key much more than Caps Lock. … Continue reading
Roll your own 64-bit Linux reverse TCP shellcode
Reverse TCP or “connect-back” shellcode connects to a predetermined host and presents a shell from the system where the code is running. If you didn’t already know that, or you don’t understand what that means, you’re in the wrong place. … Continue reading
64-bit Linux Shellcode
Writing shellcode isn’t fundamentally different from writing ordinary assembly. If you can get an assembly routine to run on a given architecture, it’s usually not difficult to convert it to runnable shellcode. In fact, before going through the motions presented … Continue reading
Compile assembly directly to shellcode
For some reason, there’s no really easy way to compile assembly directly to shellcode. The closest thing I’ve found to convert binary to shellcode is this bash one-liner from commandlinefu that parses the output from objdump:
|
1 2 3 |
objdump -d ./PROGRAM|grep '[0-9a-f]:'|grep -v 'file'|cut -f2 -d:|cut -f1-6 -d' '|tr -s ' '|tr 't' ' '|sed 's/ $//g'|sed 's/ /\x/g'|paste -d '' -s |sed 's/^/"/'|sed 's/$/"/g' |
nasm2shell, as2shell and … Continue reading
Converting a text file to a C string with sed
I recently needed to convert a multi-line string into a C string. Multi-line C strings can be a pain to deal with, but thanks to this post on stackoverflow, I was able to quickly convert several multi-line text files into … Continue reading
How to make rad ASCII banners from the command line
ASCII art isn’t dead. Figlet and TOIlet are two programs that automate the process of making big letters out of smaller ones. They add a memorable touch to SSH login banners and source code comments. Here’s the banner from my dev server: … Continue reading
“Hello World” in 64-bit Linux Assembly
I wrote my first Linux assembly program a long time ago, for 32-bit x86 architecture. Although that exact same program (described here) will still compile and run on a 64-bit Intel processor without modification, it can only do so because … Continue reading
“Hello World” in 32-bit Linux Assembly (NASM)
Writing a 32 bit “Hello World” program in NASM is a good first step for anyone that wants to learn Linux assembly. Whether you’re a programmer who wants to try some assembly optimization or an aspiring shellcoder, there’s no avoiding … Continue reading
“Hello World” Loadable Kernel Module
A Loadable Kernel Module (LKM) allows modification or extension of a Unix-like operating system’s kernel without the need to recompile or reboot the machine. LKM functionality has been available to Linux users since 2.6, and similar functionality is available in … Continue reading