Breaking Code

November 29, 2008

Ouroboros.py

Filed under: Just for fun — Tags: , , , — Mario Vilas @ 2:41 am

This is a little nonsense I just wrote after reading the Wikipedia entry for Ouroboros. Turns out this kind of programs already have a name too, Quine.

In this case it’s a Python script that uses InlineEgg to generate an ELF32 binary that generates a Python script that uses InlineEgg to generate an ELF32 binary that generates a Python script that uses InlineEgg to… well, you get the point. 🙂

Yeah, I know this is not really about computer security, but what the hell. It’s got Python and shellcode somewhere anyway.

A real Ouroboros!

A real Ouroboros!

Ouroboros.py

#!/usr/bin/python

from sys import argv, stdout
from inlineegg.inlineegg import InlineEgg, Linuxx86Syscall
from inlineegg.exelib import Elf32Program

script = open(argv[0], 'r').read()
egg = InlineEgg(Linuxx86Syscall)
egg.write(1, script, len(script))
egg.exit(0)
prg = Elf32Program()
prg.arch = prg.ARCH_I386
prg.addCode(str(egg))
stdout.write(prg.bytes())

November 28, 2008

Hello world!

Filed under: Just for fun — Tags: , , , , — Mario Vilas @ 2:01 am

Hello there, welcome to my blog. I’ll begin with some useless welcome post, like most blogs do 🙂 and make it worse with an incredibly nerdy thing to do:

31 db 43 68 21 0a 00 00
68 6f 72 6c 64 68 6f 2c
20 77 68 48 65 6c 6c 89
e1 6a 0e 5a 6a 04 58 cd
80 31 db 31 c0 40 cd 80

Nope, it’s not a Cthulhu chant in some strange and ancient Unicode encoding. I admit it might have been though – we all know Unicode is evil.

No… It’s nothing but a… green-and-black Matrix themed “Hello World” Linux shellcode! 😀

Blog at WordPress.com.