Welcome Guest ( Log In | Register )

3 Pages  1 2 3 >Bottom

Outline · [ Standard ] · Linear+

 BGGP 4 (2023), Result has been announced on 31th Oct

views
     
TSMatQuasar
post Jun 23 2023, 10:57 PM, updated 3y ago

Casual
***
Validating
329 posts

Joined: Jun 2023
user posted image

BGGP 4 starts tomorrow!

I am excited, it is an annual small file competition (organized by security researchers specializing in malware analysis, reverse engineering and exploit) since 2020!

Will update here tomorrow!

RESULT: https://github.com/binarygolf/BGGP/tree/main/2023

This post has been edited by MatQuasar: Oct 31 2023, 01:03 PM
TSMatQuasar
post Jun 24 2023, 05:38 AM

Casual
***
Validating
329 posts

Joined: Jun 2023
The organizer has announced it a few hours ago.

The theme is : "Create the smallest self-replicating file",

A valid submission will:
- Produce exactly 1 copy of itself
- Name the copy "4"
- Not execute the copied file
- Print, return, or display the number 4


Please go to their website for more info: https :// binary.golf


TSMatQuasar
post Jun 24 2023, 01:10 PM

Casual
***
Validating
329 posts

Joined: Jun 2023
Below is my example in VBScript, 97 bytes (if you use CR/LF as new line):

CODE
Dim f
Set f=CreateObject("Scripting.FileSystemObject")
f.CopyFile "04.vbs","4"
MsgBox "4",0,""    


It copies itself (must be named as 04.vbs) to a new file "4", then display "4" in message box.

According to organizer, other file types that can be fun are:

Smallest self-replicating shell script
Smallest self-replicating COM
Smallest self-replicating Kernel Module
Smallest self-replicating core dump
Smallest self-replicating VxD
Smallest self-replicating Makefile
Smallest self-replicating UEFI App
Smallest self-replicating .pyc
Smallest self-replicating APK
Smallest self-replicating Gameboy ROM
Smallest self-replicating GIF
Smallest self-replicating MP4
Smallest self-replicating Postgres query
Smallest self-replicating .tar.gz
Smallest self-replicating Word Document


But a self-replicating GIF? The organizer also just demonstrate (through diagram) how a GIF can copies itself (through some protocol).

Who wants to join? rclxms.gif thumbup.gif

It involves coding this time, Python/Lua/Perl scripts are also accepted, according to organizer on Twitter.


TSMatQuasar
post Jun 24 2023, 05:05 PM

Casual
***
Validating
329 posts

Joined: Jun 2023
QUOTE(MatQuasar @ Jun 24 2023, 01:10 PM)
Smallest self-replicating COM
*
For the smallest COM, which one you think will be smaller using Assembly language?

1. Use DOS Interrupt to open existing file, create new file, read and write as usual

2. Execute an external program (in this case, run internal "copy" command)

From what I found on the Internet
CODE
Int 21h Function 4B00h (AX) to execute an external program,


Is there third option to replicate itself to a new file "4"?


flashang
post Jun 24 2023, 09:16 PM

Casual
***
Junior Member
355 posts

Joined: Aug 2021


QUOTE(MatQuasar @ Jun 24 2023, 05:05 PM)
For the smallest COM, which one you think will be smaller using Assembly language?

1. Use DOS Interrupt to open existing file, create new file, read and write as usual

2. Execute an external program (in this case, run internal "copy" command)

From what I found on the Internet
CODE
Int 21h Function 4B00h (AX) to execute an external program,


Is there third option to replicate itself to a new file "4"?
*
IMHO, using Windows API or linux syscall should be preferred.

Obsolete DOS INT may only applicable on emulator,
which may difficult for justified the "usability",
and not accessible by most of the people.

If someone create an environment with shortcut of command,
and use script to create shorter code,
should this result accepted by others who was using standard shell ?

hmm.gif


TSMatQuasar
post Jun 24 2023, 09:45 PM

Casual
***
Validating
329 posts

Joined: Jun 2023
QUOTE(flashang @ Jun 24 2023, 09:16 PM)
IMHO, using Windows API or linux syscall should be preferred.

Obsolete DOS INT may only applicable on emulator,
which may difficult for justified the "usability",
and not accessible by most of the people.

If someone create an environment with shortcut of command,
and use script to create shorter code,
should this result accepted by others who was using standard shell ?

hmm.gif
*
Thanks for your feedback. Yes, I already submitted a Windows EXE as my first entry for this competition, thinking to either submit another program, maybe ELF (Linux) or DOS COM. But there is not much challenge, because it is open file, create file, read /write, close file, not much improvement can be done to make them shorter. Maybe I don't know how, I am not expert in reverse-engineering.

As for your last question, that will be classified as another file type. And binary.golf website says:
QUOTE
The smallest entry of each file type wins.


So each file type is different category, standard shell script file is different category than custom shell script file, so I think it is still acceptable.

Will you join, flashang? icon_idea.gif
flashang
post Jun 24 2023, 10:24 PM

Casual
***
Junior Member
355 posts

Joined: Aug 2021


QUOTE(MatQuasar @ Jun 24 2023, 09:45 PM)
Thanks for your feedback. Yes, I already submitted a Windows EXE as my first entry for this competition, thinking to either submit another program, maybe ELF (Linux) or DOS COM.  But there is not much challenge, because it is open file, create file, read /write, close file, not much improvement can be done to make them shorter. Maybe I don't know how, I am not expert in reverse-engineering.

As for your last question, that will be classified as another file type. And binary.golf website says:
So each file type is different category, standard shell script file is different category than custom shell script file, so I think it is still acceptable.

Will you join, flashang?  icon_idea.gif
*
already submitted lua file.

may be do other language when free.

smile.gif



TSMatQuasar
post Jun 25 2023, 06:15 PM

Casual
***
Validating
329 posts

Joined: Jun 2023
Good news for me! It is definitely an honour to be followed by the organizer of BGGP (Binary Golf Association)!

I am one of the 37 users whom they are following on Twitter.

user posted image

This post has been edited by MatQuasar: Jul 31 2023, 03:25 AM
TSMatQuasar
post Jun 26 2023, 11:20 PM

Casual
***
Validating
329 posts

Joined: Jun 2023
For those who have visited the binary.golf website would know, the submission format requires the SHA256 and BASE64 of the entry.

On the other forum, an expert (he submitted a lot of entries for BGGP4) suggested this is the command in Windows to generate that automatically.
CODE
copy entry.txt %1.entry
CertUtil -hashfile %1 SHA256 >>%1.entry
powershell -Command "[convert]::ToBase64String([IO.File]::ReadAllBytes('%1'))" >> %1.entry  


I haven't tried it myself, but you may want to use it next time if you plan to participate BGGP4 and your script/program is residing in Windows.
TSMatQuasar
post Jun 27 2023, 03:14 PM

Casual
***
Validating
329 posts

Joined: Jun 2023
Someone almost beat me with its small EXE! Fortunately I still win after comparing the final size:

His/Her: 1548 bytes .NET PE

Mine: 1024 bytes PE (standalone)

user posted image


You can read up about his/her write-up here:
https :// knifecoat.com/Posts/Writing+Small+.NET+PE's


TSMatQuasar
post Jun 28 2023, 06:41 PM

Casual
***
Validating
329 posts

Joined: Jun 2023
I submitted another Linux program, 290 bytes for self-replicating file, using syscall 0 (sys_read), 1 (sys_write), 2 (sys_open), 3 (sys_close), 60 (sys_exit) and 85 (sys_creat for creating file).
I don't think conventional programming can do smallest program, but anyhow I have participated with two entries, 1KB PE and 290-byte ELF64.

EDIT: @flashang, nice to see you on Twitter!

This post has been edited by MatQuasar: Sep 23 2023, 08:48 PM
TSMatQuasar
post Jun 28 2023, 06:43 PM

Casual
***
Validating
329 posts

Joined: Jun 2023
Sorry, I mean @flashang..... not angch who is already on Twitter long time ago.
TSMatQuasar
post Jun 29 2023, 06:30 PM

Casual
***
Validating
329 posts

Joined: Jun 2023
Below is some code posted by another guy on another forum.

Please don't copy and send this to BGGP4, because that guy already submitted it.
It is pasted here as an example for all.

Lua. @flashang drool.gif
CODE
io.open("4", "wb"):write(io.open(arg[0], "rb"):read("*a"))
print(4)


Makefile
CODE
4:
       cp Makefile 4
       echo 4    


BAT/CMD:
CODE
@copy %0 4 >NUL
@echo 4    


He also has entries for DOS COM, Python and refined VBScript, but I am not going to post them all on here.

If you have participated BGGP this year, I hope you have had fun! rclxms.gif



TSMatQuasar
post Jun 30 2023, 06:55 PM

Casual
***
Validating
329 posts

Joined: Jun 2023
For those not following Binary Golf Association, here's the latest update about this BGGP4 event.

Someone posted a DOS COM solution at just 22 bytes! Terrific!

user posted image

And when you think it is not possible to further squeeze it, someone came up with 18-byte DOS COM code snippet!

https :// github.com/yo-yo-yo-jbo/binary_golf_com/issues

They used very sophisticated technique that if I joined one, my DOS COM would be 50~60 bytes, I think.


TSMatQuasar
post Jul 3 2023, 09:11 AM

Casual
***
Validating
329 posts

Joined: Jun 2023
I sent another entry, this time is DLL.....

user posted image
angch
post Jul 3 2023, 11:46 AM

On my way
****
Junior Member
636 posts

Joined: Jul 2006
Does sound like everyone is just writing to a new file called "4" from orig or the memory, then outputting "4".

Very "Hello World" exercise, and not as fun as it *could* be.

I *think* I can better the 22 byte .COM file, but I don't have spare cycles these days. Just need to write the memory to disk, and output "4".

Perl quine version, though copying the file version is smaller: (so not entering this one, esp since I adapted from a known Perl quine)
CODE
% md5sum 4.pl perl.pl
b21082af8283b67cb8c82a3b6f2db2d8  4.pl
b21082af8283b67cb8c82a3b6f2db2d8  perl.pl

% cat perl.pl # Note: no new line:
$_=q(open(F,'>4.pl');print F"\$_=q($_);eval;";print"4";);eval
% perl perl.pl
4


This post has been edited by angch: Jul 3 2023, 12:03 PM
TSMatQuasar
post Jul 3 2023, 02:33 PM

Casual
***
Validating
329 posts

Joined: Jun 2023
QUOTE(angch @ Jul 3 2023, 11:46 AM)
Does sound like everyone is just writing to a new file called "4" from orig or the memory, then outputting "4".

Very "Hello World" exercise, and not as fun as it *could* be.

I *think* I can better the 22 byte .COM file, but I don't have spare cycles these days. Just need to write the memory to disk, and output "4".

Perl quine version, though copying the file version is smaller: (so not entering this one, esp since I adapted from a known Perl quine)
CODE
% md5sum 4.pl perl.pl
b21082af8283b67cb8c82a3b6f2db2d8  4.pl
b21082af8283b67cb8c82a3b6f2db2d8  perl.pl

% cat perl.pl # Note: no new line:
$_=q(open(F,'>4.pl');print F"\$_=q($_);eval;";print"4";);eval
% perl perl.pl
4

*
Yes, I agree that it is "not as fun as it could be", but it does open to a wide audience for participation, since the entry level is low, almost everyone can do file copying and displaying "4" in their scripts or programs. cool2.gif

Perl script, or your Perl script, is known to be short, that one you posted is just 61 bytes. But no comparison can be done, as my end does not have any known entries that are in Perl.

Still about over one month left, take your time, angch, to try 22-byte COM file challenge. They relied on undocumented behavior, and some replies on DOSBox-X (not DOSBox) and real DOS to run properly.
TSMatQuasar
post Jul 6 2023, 08:13 PM

Casual
***
Validating
329 posts

Joined: Jun 2023
QUOTE(flashang @ Jun 24 2023, 10:24 PM)
already submitted lua file.

may be do other language when free.

smile.gif
*
That day I saw this "Uncle Lua" restaurant on the way to nearby town in Cheras. biggrin.gif

(But the photo is from Google Maps, not my own)

Sorry, just kidding.

user posted image
flashang
post Jul 6 2023, 08:56 PM

Casual
***
Junior Member
355 posts

Joined: Aug 2021


QUOTE(MatQuasar @ Jul 6 2023, 08:13 PM)
That day I saw this "Uncle Lua" restaurant on the way to nearby town in Cheras.  biggrin.gif

(But the photo is from Google Maps, not my own)

Sorry, just kidding.

user posted image
*
Just learn lua for some testing when free.
It's quite easy.

smile.gif


TSMatQuasar
post Jul 8 2023, 09:22 PM

Casual
***
Validating
329 posts

Joined: Jun 2023
QUOTE(MatQuasar @ Jun 28 2023, 06:41 PM)
I submitted another Linux program, 290 bytes for self-replicating file, using syscall 0 (sys_read), 1 (sys_write), 2 (sys_create for file open), 3 (sys_close), 60 (sys_exit) and 85 (sys_creat for creating file).
*
Whoa! A security researcher beat me with his/her 158-byte ELF! I surrender! hmm.gif

His recorded video : https :// asciinema.org/a/595560

user posted image

3 Pages  1 2 3 >Top
 

Change to:
| Lo-Fi Version
0.0209sec    0.92    5 queries    GZIP Disabled
Time is now: 23rd December 2025 - 07:06 AM