You are not logged in.

#1 2010-02-17 07:09:53

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

Just Another <insert language here> Hacker,

This is fun! Here is a chance to showoff your skills. Of course you can choose whatever language you want.

Just another Perl hacker, or JAPH, typically refers to a Perl program which prints "Just another Perl hacker," (the comma is canonical  but is occasionally omitted). Short JAPH programs are often used as signatures in online forums, or as T-shirt designs. The phrase or acronym is also occasionally used (without code) for a signature.

JAPH programs are classically done using extremely obfuscated methods, in the spirit of the Obfuscated C Contest. More recently, as the phenomenon has become so well known, the phrase is sometimes used in ordinary examples (without obfuscation). Even more recently the P of JAPH can also stand for Perl 6, Parrot or Pugs.

Starting easy...
Perl:

$c='python';$_=`printf hack`;$_=~s;ck;;;;$c=~s%^(?!\x68)(.)(?2)(?1)(.)(?1)(?2)(?<!.{4}h)$%$2%;print j.substr($_,1),p,$c.','

Let's go obfuscating!

Offline

#2 2010-02-27 23:24:20

cmtptr
Member
Registered: 2008-09-01
Posts: 135

Re: Just Another <insert language here> Hacker,

Not exactly a one-liner.  I guess it could be (minus the directives), but I liked this format better...

[corey@sariss ~]$ cat asm.s
.text
.globl _start
_start:
.word 0x19ba,0x0000,0xb900,0x0098,0x0040,0x01bb,0x0000,0xb800
.word 0x0004,0x0000,0x80cd,0xdb31,0x01b8,0x0000,0xcd00,0xc380
.word 0x754a,0x7473,0x6120,0x6f6e,0x6874,0x7265,0x4120,0x4d53
.word 0x6820,0x6361,0x656b,0x2c72,0x000a
[corey@sariss ~]$ as -o asm.o asm.s
[corey@sariss ~]$ ld asm.o
[corey@sariss ~]$ ./a.out 
Just another ASM hacker,
[corey@sariss ~]$

I also could probably have gotten a little more clever with it, but that just sounded like too much work.

Last edited by cmtptr (2010-02-28 00:11:40)

Offline

#3 2010-03-07 18:33:14

linas
Member
Registered: 2010-03-06
Posts: 46

Re: Just Another <insert language here> Hacker,

It's an interesting code, cmtptr, since it seems to expose a bug in strace.

Stracing it shows:

stat(NULL, Just another ASM hacker,
NULL)                        = 25
write(0, NULL, 25 <unfinished ... exit status 0>

The string  "Just another ASM hacker,\n" is 4A 75 73 74 20 61 6E 6F 74 68 65 72 20 41 53 4D 20 68 61 63 6B 65 72 2C 0A
which takes the last to lines of words.

If we disassemble the first two lines (gdb ./a.out, disas /r _start):

0x0000000000400078 <_start+0>:     ba 19 00 00 00    mov    $0x19,%edx
0x000000000040007d <_start+5>:     b9 98 00 40 00    mov    $0x400098,%ecx
0x0000000000400082 <_start+10>:     bb 01 00 00 00    mov    $0x1,%ebx
0x0000000000400087 <_start+15>:     b8 04 00 00 00    mov    $0x4,%eax
0x000000000040008c <_start+20>:     cd 80    int    $0x80
0x000000000040008e <_start+22>:     31 db    xor    %ebx,%ebx
0x0000000000400090 <_start+24>:     b8 01 00 00 00    mov    $0x1,%eax
0x0000000000400095 <_start+29>:     cd 80    int    $0x80
0x0000000000400097 <_start+31>:     c3    retq
0x0000000000400098 <begin of the text>

That's a syscall 4 (__NR_write), with parameters  1 (write to stdout), 0x400098 (address if the text) and 25 (text length).
Finally it calls syscall 1 with parameter 0, ie. _exit(0).

That's using linux32 syscalls (<asm/unistd_32.h>), but with 64 bits syscalls (<asm/unistd_64.h>) syscall 4 is stat and syscall 1 is write. Which matches what strace tried to output.

$ file a.out
a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped

So the kernel manages to correctly run it even though it uses 32 bit syscalls (because it isn't using a x86-64 interface?) but strace doesn't notice it and shows the 64 bit functions.

Offline

#4 2010-03-07 21:08:38

gohu
Member
From: France
Registered: 2010-01-17
Posts: 36

Re: Just Another <insert language here> Hacker,

Python:

print("Just another Python hacker,")

TOOWTDI smile

Offline

#5 2010-03-07 21:12:49

theringmaster
Member
From: Air Force
Registered: 2007-07-16
Posts: 581
Website

Re: Just Another <insert language here> Hacker,

ruby

puts 'Just another Ruby Hacker'

Got to love them interpreted launguages, with there short code snippets. smile


Check me out on twitter!!! twitter.com/The_Ringmaster

Offline

#6 2010-03-07 21:22:14

SpeedVin
Member
From: Poland
Registered: 2009-04-29
Posts: 955

Re: Just Another <insert language here> Hacker,

Ada:

With Ada.Text_IO;
Use Ada.Text_IO;
the procedure hello is
Put_Line ('I'm a Ada hacker/user')
end;

Shell Scripter | C/C++/Python/Java Coder | ZSH

Offline

#7 2010-03-07 21:57:56

cmtptr
Member
Registered: 2008-09-01
Posts: 135

Re: Just Another <insert language here> Hacker,

Wow, way to completely miss the point guys...

linas wrote:

It's an interesting code, cmtptr, since it seems to expose a bug in strace.

Stracing it shows:

stat(NULL, Just another ASM hacker,
NULL)                        = 25
write(0, NULL, 25 <unfinished ... exit status 0>

The string  "Just another ASM hacker,\n" is 4A 75 73 74 20 61 6E 6F 74 68 65 72 20 41 53 4D 20 68 61 63 6B 65 72 2C 0A
which takes the last to lines of words.

If we disassemble the first two lines (gdb ./a.out, disas /r _start):

0x0000000000400078 <_start+0>:     ba 19 00 00 00    mov    $0x19,%edx
0x000000000040007d <_start+5>:     b9 98 00 40 00    mov    $0x400098,%ecx
0x0000000000400082 <_start+10>:     bb 01 00 00 00    mov    $0x1,%ebx
0x0000000000400087 <_start+15>:     b8 04 00 00 00    mov    $0x4,%eax
0x000000000040008c <_start+20>:     cd 80    int    $0x80
0x000000000040008e <_start+22>:     31 db    xor    %ebx,%ebx
0x0000000000400090 <_start+24>:     b8 01 00 00 00    mov    $0x1,%eax
0x0000000000400095 <_start+29>:     cd 80    int    $0x80
0x0000000000400097 <_start+31>:     c3    retq
0x0000000000400098 <begin of the text>

That's a syscall 4 (__NR_write), with parameters  1 (write to stdout), 0x400098 (address if the text) and 25 (text length).
Finally it calls syscall 1 with parameter 0, ie. _exit(0).

That's using linux32 syscalls (<asm/unistd_32.h>), but with 64 bits syscalls (<asm/unistd_64.h>) syscall 4 is stat and syscall 1 is write. Which matches what strace tried to output.

$ file a.out
a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped

So the kernel manages to correctly run it even though it uses 32 bit syscalls (because it isn't using a x86-64 interface?) but strace doesn't notice it and shows the 64 bit functions.

It took me a few reads and some experimenting/investigating before I understood what you were getting at, since I'm admittedly new to the 64-bit world.
The code I wrote works because I'm invoking interrupt 0x80, while the 64-bit syscalls you (and strace) wanted to see are invoked using the "syscall" instruction (I suppose this is what you meant when you said it isn't using the x86-64 interface?).  I suppose my code should have been...

[corey@sariss ~]$ cat asm.s
.text
.globl _start
_start:
.word 0xc748,0x19c2,0x0000,0x4800,0xc6c7,0x00a3,0x0040,0xc748
.word 0x01c7,0x0000,0x4800,0xc0c7,0x0001,0x0000,0x050f,0x3148
.word 0x48ff,0xc0c7,0x003c,0x0000,0x050f,0x4ac3,0x7375,0x2074
.word 0x6e61,0x746f,0x6568,0x2072,0x5341,0x204d,0x6168,0x6b63
.word 0x7265,0x0a2c
[corey@sariss ~]$ as -o asm.o asm.s && ld asm.o
[corey@sariss ~]$ ./a.out 
Just another ASM hacker,
[corey@sariss ~]$ strace ./a.out 
execve("./a.out", ["./a.out"], [/* 46 vars */]) = 0
write(1, "Just another ASM hacker,\n", 25Just another ASM hacker,
) = 25
_exit(0)                                = ?
[corey@sariss ~]$

Thanks for pointing that out.  You caused me to learn something!
And you're right, that does appear to be a bug in strace!

Last edited by cmtptr (2010-03-08 01:05:29)

Offline

#8 2010-03-08 21:09:14

ArchArael
Member
Registered: 2005-06-14
Posts: 504

Re: Just Another <insert language here> Hacker,

echo Just another bash lover

Offline

#9 2010-03-08 22:24:19

tlvb
Member
From: Sweden
Registered: 2008-10-06
Posts: 297
Website

Re: Just Another <insert language here> Hacker,

>025*     v   
>"gnufeB"v" 
">"na t"v". 
e >:#,_@  .   
  ^"Jus"<". 
"^"other"<"
^"lunatic"<

I need a sorted list of all random numbers, so that I can retrieve a suitable one later with a binary search instead of having to iterate through the generation process every time.

Offline

#10 2010-03-08 22:37:47

awkwood
Member
From: .au <=> .ca
Registered: 2009-04-23
Posts: 91

Re: Just Another <insert language here> Hacker,

Ruby:

$><<%{SnVzdCBhbm90aGVyIHJ1YnkgaGFja2VyLA==}.unpack('m')[0]

Offline

#11 2010-03-08 22:38:23

Peasantoid
Member
Registered: 2009-04-26
Posts: 928
Website

Re: Just Another <insert language here> Hacker,

** Gah. Never mind.

Last edited by Peasantoid (2010-03-08 22:39:03)

Offline

#12 2010-03-28 02:08:10

burninating__absol
Member
Registered: 2010-03-07
Posts: 45

Re: Just Another <insert language here> Hacker,

Scheme

(display "Just another Scheme hacker.")

currentproblem: none.

Offline

#13 2010-03-28 17:43:42

cmtptr
Member
Registered: 2008-09-01
Posts: 135

Re: Just Another <insert language here> Hacker,

set ___ "hack%";proc ::: {_} {upvar $_ __;set __ [regsub Tcl [regsub -all \\\\\\\\ $__ Tcl] Just]};set ::_ "\\\\_\$____\\_\\\\_\$___,";::: ::_;set ____ "anoth%";eval set ::_ $::_;set ::__ "puts_\"[split [regsub -all % $::_ er] _]\"";eval [regsub _ $::__ \ ]

Offline

#14 2010-04-10 04:11:46

coreyography
Member
Registered: 2009-06-11
Posts: 7

Re: Just Another <insert language here> Hacker,

Brainfuck:

++++++++++[>+++>+++++++<<-]>>++++.<<+++++++[>>++++++<<-]>>+.--.+.<++.<++++[>>----<<-]>>---.<<++++[>>+++<<-]>>+.+.+++++.
------------.---.<<++++[>>+++<<-]>>+.<.<++++[>>----<<-]>>.<<++++[>>++++<<-]>>.<<++++[>>----<<-]>>-.++++++++.+++++.--------.
<<+++++[>>+++<<-]>>.<<++++++[>>---<<-]>>.++++++++.<.>---.-------.++.++++++++.------.<<++++[>>+++<<-]>>+.

Offline

#15 2010-04-10 05:00:17

mikesd
Member
From: Australia
Registered: 2008-02-01
Posts: 788
Website

Re: Just Another <insert language here> Hacker,

(format t "Just another LISP hacker.")

Offline

#16 2010-04-11 22:52:43

cmtptr
Member
Registered: 2008-09-01
Posts: 135

Re: Just Another <insert language here> Hacker,

tlvb wrote:
>025*     v   
>"gnufeB"v" 
">"na t"v". 
e >:#,_@  .   
  ^"Jus"<". 
"^"other"<"
^"lunatic"<
coreyography wrote:

Brainfuck:

++++++++++[>+++>+++++++<<-]>>++++.<<+++++++[>>++++++<<-]>>+.--.+.<++.<++++[>>----<<-]>>---.<<++++[>>+++<<-]>>+.+.+++++.
------------.---.<<++++[>>+++<<-]>>+.<.<++++[>>----<<-]>>.<<++++[>>++++<<-]>>.<<++++[>>----<<-]>>-.++++++++.+++++.--------.
<<+++++[>>+++<<-]>>.<<++++++[>>---<<-]>>.++++++++.<.>---.-------.++.++++++++.------.<<++++[>>+++<<-]>>+.

Showoffs!  Esoteric languages should be disqualified.  tongue

Offline

#17 2010-04-11 23:06:21

schubs
Member
Registered: 2010-01-02
Posts: 16

Re: Just Another <insert language here> Hacker,

HLA:

Program JustAnother;

#include( "stdlib.hhf" );



begin JustAnother;

         stdout.put("Just Another HLA Hacker.", nl );

end JustAnother;

Offline

#18 2010-04-11 23:11:43

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,231
Website

Re: Just Another <insert language here> Hacker,

Is it just me, or are a lot of people missing the point?

dmz wrote:

Let's go obfuscating!

Offline

#19 2010-04-11 23:33:07

flamelab
Member
From: Athens, Hellas (Greece)
Registered: 2007-12-26
Posts: 2,160

Re: Just Another <insert language here> Hacker,

for post in
     \Index\General/ Programming/ Forum/\;do
LD_PRELOAD=/usr/lib/automerge.so.1 /usr/bin/post_reply --quotepost "Wanna use bash, huh???";

done

( waiting for the debugging replies lol)

Last edited by flamelab (2010-04-11 23:34:43)

Offline

#20 2010-04-12 16:15:48

Pitmairen
Member
Registered: 2007-08-02
Posts: 37

Re: Just Another <insert language here> Hacker,

Python:

print reduce(lambda l,x:l+chr(int(''.join(x)[1:])+int(x[0]*2)),zip('2'*27,*str((17630002262754493<<128)+(7497280228225801499<<64)+9082866329653831730).split(str(51>>3))),'')

Offline

#21 2010-04-12 16:41:34

tlvb
Member
From: Sweden
Registered: 2008-10-06
Posts: 297
Website

Re: Just Another <insert language here> Hacker,

wget bbs.archlinux.org/viewtopic.php?pid=742278 -qO-|sed -n "/<t/s/.*\(J.*\) &.*; \(.*r\).*/\1 data aquisition and formatting \2./;T;p;b"

...one of the more ineffective ways to do it?

Last edited by tlvb (2010-04-12 17:50:46)


I need a sorted list of all random numbers, so that I can retrieve a suitable one later with a binary search instead of having to iterate through the generation process every time.

Offline

#22 2010-04-13 18:11:50

AlecSchueler
Member
Registered: 2009-05-30
Posts: 22

Re: Just Another <insert language here> Hacker,

Another in python,

class _:__getattr__=lambda *_:''.join(map(lambda _:''.join(_),zip(_[1],'utaohrpto_akr')))
_=_().js_nte_yhnhce;print(_.replace('_','hello world'[5]))

Offline

#23 2010-04-13 20:04:40

tavianator
Member
From: Waterloo, ON, Canada
Registered: 2007-08-21
Posts: 859
Website

Re: Just Another <insert language here> Hacker,

C:

main(){int j,u[22]={0};while(!u[12]){while(u[j=rand()%22]++);putchar("atCorhnhteua\nsk eJcr  "[j]);}}

Offline

#24 2010-04-15 18:10:31

jhvid
Member
From: /dev/denmark
Registered: 2009-08-19
Posts: 52

Re: Just Another <insert language here> Hacker,

ruby:

[926381, 23200231779, 1299022, 1045307475].collect {|a| a.to_s(36)}.join(" ")

Each number in the array is converted to strings after 36-base.  They are then joined together to a string, with spaces as seperators.

(please forgive me for my english smile)

Last edited by jhvid (2010-04-15 18:18:23)


GCS d- s-:+ a12 C++++ U++++ L+++ P--- E--- W+++ N+ o K- w--- O? M-- V? PS PE
Y- PGP? t? 5? X? R tv b+++ DI+ D- G++ e++ h! !r !y

Please ignore me... I'm pretty weird...

Offline

#25 2010-04-15 20:07:58

AlecSchueler
Member
Registered: 2009-05-30
Posts: 22

Re: Just Another <insert language here> Hacker,

This is quite addictive. Here's another in python,

def _rehtona_tsuj (): '''rekcah nohtyp''' ;pass
_=_rehtona_tsuj;map(lambda x: __import__  ('sy'
's') .stdout. write(eval("_.%s[::- 1]"%x)),('_'
'_name__.replace("_"," ")-__doc__'.split('-')))

Offline

Board footer

Powered by FluxBB