Sponsored Content
Full Discussion: Obfuscated C
Top Forums Programming Obfuscated C Post 18472 by PxT on Thursday 28th of March 2002 04:53:10 PM
Old 03-28-2002
MySQL Obfuscated C

Well this year i decided to enter the International Obfuscated C Code Contest. This was my first attempt at writing obfuscated C (at least purposely), so I am sure that this is kids-stuff for the real obfuscation gurus. Anyway, the results are out, and I am not a finalist (I wasn't expecting to be), so I figured I would share my code with you all, just for fun. If anyone else made an entry this year, please share them!


Here are the remarks included with my entry:

This program grew out of a non-obfuscated utility that I threw
together a while ago. I use it as a reference from time to
time since different architectures produce different results (at
least, the output is different on my HP-UX box than it is on my
Intel box). It simply outputs a nicely formatted ascii character
table. It is run with no arguments and produces its report on
the standard out. I achieved obfuscation by using a couple of
levels of recursion, plus some confusingly named variables and
functions. I also included some additional code which does
absolutley nothing just to confuse things a little more.

I strived for "-Wall" cleanness. As a result I had to give up
a couple minor obfuscations, but I think it is still sufficiently
convoluted. This is my first attempt at obfuscated C -- it was
written over the course of several weeks as a diversion. By
the end it became very difficult to improve as I could no longer
understand how it worked without a serious amount of thought!

The code is neatly arranged in the form of my initials. Smilie



Code:
#  include  <stdio.h>
#          define d (
#          define I1 1<<
#          define b )
#          define Il(l) \
           return(l)
#          define lI \
I*((I1 3)-1)+(I*(I1\
1))-(I-\
(I1 4))
#define \
_l(l)  \
ll_l(l)
#define \
ll(l) l
#define \
l1 main(

long i,l,ll(I)=d(I1 5)-(I1 1)b;int _l(l)
{putchar d ll(l)b;Il(l);}int II(l,L){_l(
(l/L)+48);l-=((l/L)*L);d L/=10 b?II(l,L)
          :0;Il(l);}int l1 
          b{*d d l b?&I:&l
          b=I;if d l>(I1 8
          b b Il(I1 0);_l(
          32);_l(I1 5);II(
          l,25<<2);_l(58);
          _l(I1 5);_l(ll(l
          ));l%(I1 2)?0:_l
          ((I1 3)+(ll(I1 1)
          )b;l++;Il(l1 l));
}

 

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Removing obfuscated javascript from js files

ello, I am trying to remove obfuscated code in multiple files on a server, the malicious code is surronded by /*km0ae9gr6m*//*qhk6sa6g1c*/ I had success removing from some files using this command sed -i ':strt;s|/\*km0ae9gr6m\*/*/\*qhk6sa6g1c\*/||g;/\/\*km0ae9gr6m\*\//{N;b strt}'... (5 Replies)
Discussion started by: cuantica
5 Replies

2. Web Development

Random - Any help decoding obfuscated code?

I have this following file and I would quite like to get it decoded - any help / advice is appreciated. I would like to know how to decrypt it, however if someone is able to do it for me I would be equally grateful. <?php //Obfuscation provided by FOPO - Free Online PHP Obfuscator v1.2:... (6 Replies)
Discussion started by: mcclunyboy
6 Replies

3. Programming

Obfuscated "Hello World!" in Python 2.7.x...

Obfuscated Hello World! in Python 2.7.x This is seriously impressive:- Obfuscating "Hello world!" - Ben Kurtovic (2 Replies)
Discussion started by: wisecracker
2 Replies
PURITY(6)                                                          Games Manual                                                          PURITY(6)

NAME
purity - a general purpose purity test SYNOPSIS
/usr/games/purity [ flags ] [ testname ] DESCRIPTION
Purity is an interactive purity test program with a simple, user interface and datafile format. For each test, questions are printed to the your terminal, and you are prompted for an answer to the current question. At a prompt, these are your choices: y Answer "yes" to the question. n Answer "no" to the question. b Backup one question, if you answered it incorrectly, or someone is watching you take the test, and you don't (or do) want to admit a different answer. r Redraw the current question. q Quit the test, and print the current score. ? Print a help screen for the current prompt. k Kill a section of the test. This skips all the questions of the test until the next subject heading. a Toggle answer mode between real answers and obfuscated answers. Real answers print "yes" and "no", while obfuscated answers are "Maybe" and "maybe". Obfuscated answers are preferred if you are shy, and don't want people to be able to read your answers over your shoulder as you take the test. d Toggle dERanGe output. s Print your current score on the test you are taking. l Toggle score logging. At the end of the test, your score is printed out. For most purity tests, lower scores denote more "experience" of the test material. FLAGS
These are the command line flags for the test. -a Show real answers (i.e. "yes" and "no") instead of obfuscated ones (i.e. "Maybe" and "maybe") as you answer the questions. -d PrINt THe tESt in DerANgeD pRInT. -f Take the test in fast mode. Only the questions are printed, and not any other text blocks, like the introdution, subject headers, and the conclusion. -l Take the test without having your score logged. -p Print the test without prompting for answers. This is useful for making hard copies of the tests without having to edit out the prompts by hand. -r Decrypt the test using the Rot 13 algorithm. This is done as a form of "protection", such that if you read a rot13 test and it offends you, it's your own fault. -z zoom through more prompts in large text blocks. The default is to prompt the user for more when a screenful of text has been printed without any user input. DATAFILE FORMAT
The format of the datafiles is a very simple format, intended such that new tests can quickly and easily be converted to run with the test. There are four types of text in a purity test datafile. Each type is contained in a bracket type of punctuation. The definitions are as follows: the styles of text blocks are: { plain text block } [ subject header ] ( test question ) and < conclusion > Plain text blocks are printed out character for character. Subject headers are preceded by their subject numbers, starting at 1, and then printed as text blocks. Questions are preceded by their numbers, and then prompt the user to answer the question, keeping track of the user's current score. Conclusions first calculate and print the user's score for the test, then print out the conclusion as a text block. If you wish to include any of the various bracket punctuation in your text, the backslash ("") character will escape the next character. To print a question with parentheses, you would use the following format: (have you ever written a purity test (like this one)?) the output would be this: 1. have you ever written a purity test (like this one)? and then it would have asked the user for her/his answer. For a generic datafile, use the "sample" datafile for the test. FILES
/var/games/purity.scores the score logfile /usr/share/games/purity/* test data files AUTHOR
Eric Lechner, lechner@ucscb.ucsc.edu 18 December 1989 PURITY(6)
All times are GMT -4. The time now is 07:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy