» »

[Tekmovanje] Narediti najkrajši exe alla "Pozdravljeni" v winxp sistemih

[Tekmovanje] Narediti najkrajši exe alla "Pozdravljeni" v winxp sistemih

StratOS ::

Evo končno nekaj pametnega :

Tekmovanje narediti najkrajši exe skompiliran program, ki izpiše "Pozdravljeni" v winxp sistemih v različnih programskih jezikih (VB,C,asm,TP ...)

Mislim, da nekaj takega še ni bilo, na Vas pa je, da to tudi naredite.

Zraven še prosim pripišite s čim in kako ste omenjen program naredili/skompilirali




Veliko veselja

StratOS
"Multitasking - ability to f##k up several things at once."
"It works better if you plug it in."
"The one who is digging the hole for the other to fall in is allready in it."

OwcA ::

Konzola ali grafično?
Otroška radovednost - gonilo napredka.

StratOS ::

Ni važno, glavno, da je najkrajši :D
"Multitasking - ability to f##k up several things at once."
"It works better if you plug it in."
"The one who is digging the hole for the other to fall in is allready in it."

sverde21 ::

če vela PHP:
<?="Pozdravljeni"?>

Samo ne vem, če je tole primern, ker ni standalone...

EDIT: Aja exe :) podčrtaj tist, sm spregledu :P

P.S.: Grafični je logično daljši...
<?php echo `w`; ?>

Zgodovina sprememb…

  • spremenil: sverde21 ()

kihc ::

"... exe skompiliran program ..."
x

StratOS ::

Evo npr. enega na hitro v VB6, dodatno skompresiran z upx.

Evo, 4.608 bytes
"Multitasking - ability to f##k up several things at once."
"It works better if you plug it in."
"The one who is digging the hole for the other to fall in is allready in it."

64202 ::

Predvidevam, da se bo našel kak asm tzar, in sklal skupaj program, ki bo imel več bajtov za string kot pa za kodo :D
I am NaN, I am a free man!

StratOS ::

lahko naredimo tekmovanje za vsak programski jezik
"Multitasking - ability to f##k up several things at once."
"It works better if you plug it in."
"The one who is digging the hole for the other to fall in is allready in it."

smetko ::

ena od možnosti.
Skreiraš bat datoteko v katero vneseš "ECHO Pozdravljeni".
Iz mesta http://www.computerhope.com/dutil.htm vzameš program bat2exe in s tem programom pretvoriš bat program v .exe (sicer dobiš .com vendarga lahko preimenuješ v .exe).
Jaz sem tako dobil program velikosti 109 Baytov.
No comment

krho ::

StratOS, ti za seboj povlečeš še cel kup runtime datotek.. Tako da tehle tvojih 4608B.. potegene za seboj tam ene 3M
Tako, da si za 1x zgubil.:\

No jaz v delphiju dobim 7.128
si.Mail odprto-kodni odjemalec elektronske pošte. - http://www.simail.si
Uredite si svojo zbirko filmov, serij in iger - http://xcollect.sf.net

veteran ::

C, v windows konzoli: 2048 bytov. ;)
#include <windows.h>
#include <stdio.h>
int main(void) 
{
    printf ("Pozdravljeni!\n");
    return 0;
}

prevedeno z eno starejšo verzijo gcc (mingw):

$ gcc -Wall -Os -DDEBUG=0 -c hello.c
$ gcc -o hello.exe hello.o -mconsole -s -Wl,--stack,1048576 -nostdlib -nostartfiles -lctiny -lkernel32 -luser32 -lshell32 -ladvapi32
$ strip hello.exe

še preverim, da res nima kakšnih čudnih odvisnosti (msvcrt, msys, cygwin). Evo, tale exe dela na vseh win9x, winnt sistemih:

$ depends hello.exe
hello.exe: GDI32.dll
hello.exe: USER32.dll
hello.exe: ntdll.dll
hello.exe: KERNEL32.dll
hello.exe: hello.exe

veteran ::

In da bo v duhu starih časov, je rezultat seveda v uuencode (ga boste že odpakirali) :D

begin 0666 hello.exe
M35J0``,````$````__\``+@`````````0```````````````````````````
M````````````````````@`````X?N@X`M`G-(;@!3,TA5&AI<R!P<F]G<F%M
M(&-A;FYO="!B92!R=6X@:6X@1$]3(&UO9&4N#0T*)`````````!010``3`$#
M`$3/F40``````````.``#P$+`0(W``0````"````!```+!`````0````````
M``!````0`````@``!`````$````$``````````!``````@````````,`````
M`!```!``````$```$````````!`````````````````P``!L`0``````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````"YT97AT````(`(````0````!`````(`````````
M`````````"```&`N8G-S`````!`"````(```````````````````````````
M``"```#`+FED871A``!L`0```#`````"````!@``````````````````0```
MP`````````````````````!0;WID<F%V;&IE;FDA"@"058GE@^P(Z#4```"#
MQ/1H`!!``.@P````,<#)PU6)Y8/L".AQ````@\3\:@!H`"!``%#HR?___X/$
M]%#H>`$``%6)Y<G#````58GE@>P@!```5E.-10R#Q/Q0_W4(C9T`_/__4^B/
M`0``B<:#Q/AJ`(V%_/O__U!64X/$^&KUZ#T!``"#Q`A0Z#P!``")\(VEV/O_
M_UM>R<-5B>6#[!!64\<%`"!```````#H(0$``(G&@\3T5N@>`0``@\3X0%!J
M`(/$_.@7`0``@\0$4.@6`0``B<.#Q!2%VW4-,<#IQP```(VV`````(/$^%93
MZ/X```"`.R)U(4.)'0`@0`#K`4.*`X3`=-0\(G7U@#L`=23KR8VV`````(D=
M`"!``.L!0XH#A,!T$3P@=`0\"77Q@#L`=`3&`P!#N@$```#K`4.*`SP@=/D\
M"73UB@.$P'17/")U)$.X`"!``(D<D$+'!)``````ZP*00XH#A,!T.#PB=?7K
M)(UV`+@`($``B1R00L<$D`````#K`4.*`X3`=!8\('0$/`EU\8`[`'0)Q@,`
M0X/Z?WZ9B="-9>A;7LG#``````````#_)70P0`"0D/\E@#!``)"0_R6(,$``
MD)#_)7@P0`"0D/\ED#!``)"0_R5\,$``D)#_)80P0`"0D/\EC#!``)"0_R6<
M,$``D)#_____`````/____\`````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````0#``````````````3#$``'0P``!H,`````````````!@,0``G#``
M`````````````````````````````````*0P``"T,```R#```-PP``#L,```
M^#````0Q```0,0`````````````<,0````````````"D,```M#```,@P``#<
M,```[#```/@P```$,0``$#$`````````````'#$```````![`$5X:710<F]C
M97-S````R`!'971#;VUM86YD3&EN94$````\`4=E=%!R;V-E<W-(96%P````
M`$\!1V5T4W1D2&%N9&QE``"6`4AE87!!;&QO8P#)`E=R:71E1FEL90#L`FQS
M=')C<'E!``#R`FQS=')L96Y!```M`G=V<W!R:6YT9D$``````#`````P````
M,````#`````P````,````#`````P``!+15).14PS,BYD;&P`````%#```%53
M15(S,BYD;&P`````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
7````````````````````````````````
`
end

MaCoFaCo ::

Moj rezultat: programček zavzame 31 B, od tega zavzame 12 B beseda "Pozdravljeni", ki se izpiše.

Kam submitam programček? ;)

EDIT: zadeva je COM programček narejen z NASM

Zgodovina sprememb…

  • spremenilo: MaCoFaCo ()

StratOS ::

veteran pozabil si pripisat s čim ?
Velikost je pa 2.048 bytes
"Multitasking - ability to f##k up several things at once."
"It works better if you plug it in."
"The one who is digging the hole for the other to fall in is allready in it."

veteran ::

Ej, saj piše, mal višje. ;) BTW, z gcc lahko narediš tudi win program iste velikosti (2048). Manj pa kvečjemu z M$ linkerjem (ker zna združit sekcije v PE).
#include <windows.h>

int WinMainCRTStartup (void)
{
    MessageBox (NULL, "Pozdravljeni!", "", MB_OK);
    ExitProcess (0);
}


Ne bom smetil z uuencode še enkrat (če ima kdo posebno željo, lahko dobi v ZS;). Predlagam pa, da bi forumu že končno dodali en knof PRILEPI DATOTEKO, ker je skrajno nadležno, da moraš prav vsako slikco ali datoteko najprej nekam odložit.

MaCoFaCo ::

Še pravi exe programček:
-velikost: 127 B
-orodja: NASM in ALINK

D:\Test>build

D:\Test>nasm -fobj obj.asm

D:\Test>alink obj.obj -oEXE

D:\Test>dir
Volume in drive D is Data
Volume Serial Number is 68BA-5D24

Directory of D:\Test

<DIR> .
<DIR> ..
86.012 ALINK.EXE
39 build.bat
452.506 nasm.exe
559 obj.asm
127 obj.exe
183 obj.obj
6 File(s) 539.426 bytes
2 Dir(s) 20.321.452.032 bytes free

D:\Test>obj.exe
Pozdravljeni

D:\Test>

sverde21 ::

Dejte source zravn pisat, k jst tud lahk objavm en kao programček "Pozdravljeni", ki v resnici uporabnika pozdravi tako da mu pobriše disk ;(( .

Da ne bo kakšnih nepotrebnih žrtev ;)
<?php echo `w`; ?>

Zgodovina sprememb…

  • spremenil: sverde21 ()

amigo_no1 ::

http://www.exetools.com/forum/showthrea...

@StratOS
Visual Basic 6 pa Smallest exe (PE) :D ? Si pozabil na msvbvm60.dll :\ ?

Matako ::

MSWin XP v konzoli nekako emulirajo MSDOS ne? Torej bi šlo

;tukaj je treba namutiti asemblerske direktive

MOV AX, CS; MSDOS klic #9 uporablja DS segment, naši podatki so očitno takoj za kodo...
MOV DS,AX
MOV AH,9
MOV DX, OFFSET str
INT 21h
XOR AX,AX ; MSDOS exit klic
INT 21h
str:
DB "Pozdravljeni$"
/\/\.K.

Zgodovina sprememb…

  • spremenil: Matako ()

Nejc Pintar ::

Python:
>>>print "pozdrvaljen"
Nisem pa poskusil prevesti s py2exe:)
Lahko je biti prvi, če si edini!

BigWhale ::

BITS 32
org 0x08048000
ehdr: ; Elf32_Ehdr
db 0x7F, "ELF", 1, 1, 1 ; e_ident
times 9 db 0
dw 2 ; e_type
dw 3 ; e_machine
dd 1 ; e_version
dd _start ; e_entry
dd phdr - $$ ; e_phoff
dd 0 ; e_shoff
dd 0 ; e_flags
dw ehdrsize ; e_ehsize
dw phdrsize ; e_phentsize
dw 1 ; e_phnum
dw 0 ; e_shentsize
dw 0 ; e_shnum
dw 0 ; e_shstrndx
ehdrsize equ $ - ehdr
phdr: ; Elf32_Phdr
dd 1 ; p_type
dd 0 ; p_offset
dd $$ ; p_vaddr
dd $$ ; p_paddr
dd filesize ; p_filesz
dd filesize ; p_memsz
dd 5 ; p_flags
dd 0x1000 ; p_align
phdrsize equ $ - phdr
filesize equ $ - $$
_start:
mov     edx,15
mov     ecx,msg
mov     ebx,1
mov     eax,4
int     0x80
xor     ebx,ebx
mov     eax,1
int     0x80

section .data
msg     db      "Hello, World!",0xa


bigwhale@lovro ~/Work/Code $ nasm -f bin -o lala3 lala3.s
bigwhale@lovro ~/Work/Code $ nasm -f bin -o lala2 lala2.s
bigwhale@lovro ~/Work/Code $ chmod 755 lala2
bigwhale@lovro ~/Work/Code $ ./lala2
Hello, World!
bigwhale@lovro ~/Work/Code $ ls -l lala2
-rwxr-xr-x 1 bigwhale users 130 Jun 24 12:00 lala2
bigwhale@lovro ~/Work/Code $


130 bytov. Malo bi se dalo se stisniti, del programa kar v ELF header stlacit, pa se kaka malenkost. :)

[ Popravil mov ebx,0 v xor ebx,ebx. Pridobil sem stiri bajte... ;) -- BigW ]

Zgodovina sprememb…

  • spremenil: BigWhale ()

bond007 ::

Mislim, da bo nasm zmagu:)

BigWhale ::

V ELF headerju je se devet nul, ki nicemur ne sluzijo. Zdaj sem tja not stlacil besedo Pozdrav\n in ukinil data segment. 115 bytov.

Linux executable.

PS: Za Hello, World! se iscem plac v headerju ;)

Zgodovina sprememb…

  • spremenil: BigWhale ()

BigWhale ::

Ok, sem se malo gruntal in _start: popravil, da uporablja nizke registre kjer se da, da za prvo nastavljanje eax na 1 ponucam kar inc namesto mov, da namesto, mov eax,4 ponucam kar add eax dword 4... nastalo je tole:

_start:
inc     eax
mov     dl,8
pusha
xchg    eax,ebx
add     eax, dword 4
mov     ecx,msg
int     0x80
popa
int     0x80



Program je sedaj dolg 104 byte... Izpise pa se vedno besedo pozdrav. :)

PS: Ce izpisem Hello World!\n potem je program dolkg 118 bytov.

Zgodovina sprememb…

  • spremenil: BigWhale ()

Gundolf ::

@BW Ampak vseen te bomo moral diskvalificirat ker pišeš progi za linux kljub izrecnim navodilom...

Ampak dobro no, kaj pa če tvoj grozni add:
xchg eax,ebx
add eax, dword 4
nadomestiš s temle
mov bx, ax
shl ax,2
? Oz. lahko še nadomestiš z osem bitnimi registri samo dvomim da bo krajše.

Drugače pa zanimivo, da so vsi registri kar na 0 na začetku8-O

BigWhale ::

Gundolf,

119 bytov, z Hello World stringom, ki je v data segmentu in ni v ELF headarju zakamufliran. Torej en byte vec, kot jaz.

Ja, nekaj stvari se da se nadomestiti z osem bitnimi registri, samo ni nic krajse.

Vsi registri na nuli? Saj ne vem, da so... ;>

PS: Ja, saj vem, da bom diskvalificiran... Tako pac je, ampak, kaj ko nimam kje drugje tega pocet... :P

Zgodovina sprememb…

  • spremenil: BigWhale ()

Gundolf ::

> Vsi registri na nuli? Saj ne vem, da so... ;>
Saj jih nikjer ne daš na 0, uporabljaš pa kot da so na 0 (inc eax).

BigWhale ::

Tega se tudi zavedam. ;) Inc eax je ceneje kot mov eax,1!

In zgleda, da kar dela. ;)

MaCoFaCo ::

Tisti moj 127 B programček sem še izboljšal z enim toolčkom, ki sem ga napisal v C#. Sedaj je dolg le še 78 B :)

Hex dump, če želi kdo sestavit programček :P

 0: 4D 5A 4E 00 01 00 01 00 03 00 00 00 
 1: FF FF 00 00 00 00 00 00 00 00 00 00 
 2: 20 00 00 00 00 00 00 00 01 00 00 00 
 3: 00 00 00 00 40 01 0A 00 00 10 00 00 
 4: B8 00 00 8E D8 B4 09 BA 11 00 CD 21 
 5: B8 00 4C CD 21 50 6F 7A 64 72 61 76 
 6: 6C 6A 65 6E 69 24

Total: 78 bytes

BigWhale ::

Zakaj pa source skrivas?

BigWhale ::

BTW, najkrajsi se delujoc ELF program pod Linux je dolg 45 bytov. Toliko je pa tudi dolzina ELF headerja, da se ga se da zagnati. :)

MaCoFaCo ::

ASM source?

..start:
	  mov ax,data
	  mov ds,ax
 
	  mov ah,9
	  mov dx,msg
	  int 0x21

	  mov ax,0x4c00
	  int 0x21

	  segment data
msg:	  db 'Pozdravljeni$'


Sam ko zbuildam to dobim 127B exe. To sem pol "zoptimiziral" s C# programčkom. Misliš ta source?

amigo_no1 ::

Za asm source je dobra tudi teta IDA Pro :D (copy& paste hex dumpa v winhex , shraniš ko t nekaj. exe , še prej pa seveda odstraniš presledke in 0: , 1: ... 6: ) pa imaš zelo majhen 16 bitni NE fajl 8-O

MaCoFaCo ::

Praviš da tisti dump ni veljaven exe? Lahko ti tudi exe pošljem, če ga sam ne znaš sestavit ;)

screenshot

p.s. kam uploadam exe?

sidd ::

Kak pa bi tole v fortranu zgledlo( pa kaj, malce star jezik :P)

program pozdravljeni
implicit none
print*, 'Pozdravljeni!'
end


samo ne morn v .exe spremenit, če bo komu :))

Thomas ::

Ja ... nisem porajtal tele teme tedaj. Zanimiva.
Man muss immer generalisieren - Carl Jacobi

TEDY ::

LP
Na google sem najdu napisano v asm in sem samo spremenil hello world v pozdravljeni, to sem skompajlu z nasm, rezultat je 26b

BigWhale ::

.com je bolj tako tako. To pravzaprav sploh preveden program ni. ;)

Matako ::

.com je bolj tako tako. To pravzaprav sploh preveden program ni. ;)


? .COM je star MSDOS exec format za 8086, omejen na 64 KB (podatki in koda). Recimo večina MSDOS C prevajalnikov iz časov, ko je bilo to aktualno ga je podpirala v obliki "tiny" modela - itak, da je lahko preveden! Je pa problematičen, ker je v resnici to samo binarna slika programa na disku. Ni headerja in zato tudi ni nobene možnosti, da bi se ga naložilo kam drugam kot na določen dogovorjen naslov v pomnilniku.
/\/\.K.

Zgodovina sprememb…

  • spremenil: Matako ()

BigWhale ::

Nerodno sem se izrazil. .com je pac ASM zapisan binarno.

Skoda, ker se tole ni nic vec nadaljevalo. :>

Zgodovina sprememb…

  • spremenil: BigWhale ()


Vredno ogleda ...

TemaSporočilaOglediZadnje sporočilo
TemaSporočilaOglediZadnje sporočilo
»

Uporaba py2exe, Freeze in py2app

Oddelek: Programska oprema
7750 (589) filips
»

Java vprasanje - kako spraviti v *.exe datoteko

Oddelek: Programiranje
194000 (349) killa bee
»

Kateri programski jezik?

Oddelek: Programiranje
494537 (3150) kopernik
»

BAT file - Auto zaprtje DOS okna

Oddelek: Pomoč in nasveti
92023 (1888) ender
»

[NALOGA][NASM] problem pri povezovanju s C-jevskimi funkcijami

Oddelek: Programiranje
61379 (1237) c00L3r

Več podobnih tem