Hiding Data Inside of Executable Files

  Рет қаралды 23,643

Tsoding Daily

Tsoding Daily

2 ай бұрын

Previous Episodes: • Music Visualizer
References:
- Tsoding - Musializer - github.com/tsoding/musializer
- nu11 - KZfaq - / @nu11_ft
- nu11 - WIP Works 2016-2022 - / nu11-wip-works-2016-2022
- en.cppreference.com/w/c/prepr...

Пікірлер: 96
@BulletHeadPL
@BulletHeadPL 2 ай бұрын
looks like we're live hello everyone and welcome to yet another recreational programming session with mista a-zozin let's make a little bit of an announcement and officially start the stream
@christianskjerning4454
@christianskjerning4454 2 ай бұрын
most stable medium in this universe
@delibellus
@delibellus 2 ай бұрын
someone will get those words tattooed someday
@tc40390
@tc40390 2 ай бұрын
You missed the best part, "So let's do red circle, live on, uh, twitch and what are we doing today on twitch at dot, uh, television website?" :D
@simonesasso8379
@simonesasso8379 2 ай бұрын
"as usual"
@cheebadigga4092
@cheebadigga4092 Ай бұрын
striem* :D
@glowiak3430
@glowiak3430 2 ай бұрын
"Can your stinky JavaScript do that!?" I love that quote
@gorenbk
@gorenbk 2 ай бұрын
JavaScript is quite fragrant if I say so myself.
@clubpenguinfan1928
@clubpenguinfan1928 2 ай бұрын
me on my 5th birthday: looks like we're five
@prosto_evrey5793
@prosto_evrey5793 2 ай бұрын
Bees be like: “Looks like we’re hive”
@azergante8268
@azergante8268 2 ай бұрын
AFAIK there are 3 advantages to the #embed directive: 1. ease of use 2. standard way to do things 3. performance: apparently the compiler does not like to parse huge-ass arrays of hex and it’s much faster to just dump the bytes from one file to another
@aredrih6723
@aredrih6723 2 ай бұрын
A huge array of bytes is at least 4 char per bytes (2 for prefix, 1 or 2 for value, 1 for comma). Tsoding generated format has 6 char/byte (+ new line and indent). Also not having to run a C parser on the embedded file and just doing a "dumb" copy on the byte can only be faster.
@Highwind_
@Highwind_ 2 ай бұрын
9:00 Gimp can export images to C and it generates a .c file that is exactly this, I never tought it could have an use XD
@azergante8268
@azergante8268 2 ай бұрын
Thanks for the content! would be curious to see you debloat android dev & explore phone sensors, cameras and all that cool stuff
@aredrih6723
@aredrih6723 2 ай бұрын
I think the reason J.Blow had to export whether the data should be freed in case of a fallback to the filesystem. For instance, say we try to load the resources from the filesystem by default but if it's not found load from the executable. (Or the opposite?) Then, you can't just rely on macro as zome resources will get freed and other not.
@TsodingDaily
@TsodingDaily 2 ай бұрын
Oh shi! That's a good idea! Maybe I should implement some sort of fallback too...
@HaMMeR33661
@HaMMeR33661 2 ай бұрын
I remember doing all this diskloading+embedding as prep for a jam game made in Go, without the embed of newer versions which then solved the usecase where, if the binary data is code, LSPs freak out and get incredibly slow really fast and slow down the compile as well. I even tried finished a hotreload whenever a png was modified on disk to reflect that in game. I also stopped using filenames directly and generated an autocomplete enum of all filepaths in the project folder, but that just made things more difficult without much payoff; for a jam where I'm the only programmer at least. It always turns out to be a bit more confusing for comfort, but seeing you breeze though it just feels so nice to watch.
@nikev
@nikev 2 ай бұрын
Always a good time watching your sessions. I laugh so hard at the JavaScript padding 😂
@StefanvanAalst
@StefanvanAalst 2 ай бұрын
The Bundle solution allows for modding as well: if folder/file use that other wise what is internally bundled
@blackhaze3856
@blackhaze3856 2 ай бұрын
Finally a secure place to hide nsfw content
@johnsonogbu8697
@johnsonogbu8697 Ай бұрын
I love you, bro. You're my inspiration.
@berndeckenfels
@berndeckenfels 2 ай бұрын
It looks like there is a callback for your loader, Raylib has you covered (I admire how quickly can Analyse api but often you miss details)
@azergante8268
@azergante8268 2 ай бұрын
You should be able to hot reload resources in bundled mode too if you regenerate the `resources` and the `bundle` arrays. Another way could be to embed the resources in the shared library.
@flewwasse
@flewwasse 2 ай бұрын
I have not watched the video yet but that LoadFromMemory probably could also be useful for loading thing made by the same program, like render and bake an image and use it as an icon or similar. I love commenting it is my hobby.
@SlinkyD
@SlinkyD 2 ай бұрын
Yes, very useful.
@berndeckenfels
@berndeckenfels 2 ай бұрын
1:31:10 the advantage of the bool flag is you can mix both nodes (but you can also do that with your free, you just check if the pointer is inside the static area and then skip the free)
@ryonagana
@ryonagana 2 ай бұрын
this was very common in DOS era a game with only one .exe with all data embed on it or a game with multiple .exe and the main .exe is just a loader of them
@lonecoder_cro
@lonecoder_cro Ай бұрын
😂 that javascript line was Awsome
@taba1950
@taba1950 2 ай бұрын
I think it would be cool to use the bundled resources as a fallback do you can have your cake and eat it too.
@apenaswellignton
@apenaswellignton 2 ай бұрын
pog
@glowiak3430
@glowiak3430 2 ай бұрын
Windows NTFS actually allows you to insert any data in an "alternative page" of a file, that does not change content of the base page, and no one knows except the one who made this.
@desertfish74
@desertfish74 2 ай бұрын
Not entirely true, you can inspect files to list the alternate streams they may have in them.
@berndeckenfels
@berndeckenfels 2 ай бұрын
That’s however not a good vehicle for distributing files, ftp client or browser download might lose the ADS. Btw: Dir can show them, so it’s not well hidden :)
@berndeckenfels
@berndeckenfels 2 ай бұрын
Would be cool if the linker can just load a raw segment data, so you don’t need the c-generation or #embed
@ElPikacupacabra
@ElPikacupacabra Ай бұрын
It's possible, both with a linker script and with objcopy. There's a stack overflow question on this
@mhamdmarch8709
@mhamdmarch8709 2 ай бұрын
Sounds exciting
@arisweedler4703
@arisweedler4703 2 ай бұрын
So many problems would be solved if you could release a filesystem instead of a file. Then you could ship something that was … containing … everything, instead of just a regular file. Or we can all go to pre-docker days and enjoy watching a nice recreational coding session 😁😁. Not sure how containers serving GUI applications work - I’m sure it wouldn’t be that complicated once you know. But sheeeesh just having some C code is nice and ezpz
@fu886
@fu886 2 ай бұрын
docker/containers/chroot bundles?
@AyariMakrem
@AyariMakrem 2 ай бұрын
Is it possible to combine the 2 mode in one? I mean if you don't find the ressources into file system then you load it from the bundle.
@ezzobir
@ezzobir 2 ай бұрын
Thank you so much very usefull video. Do you use evil mode in your emacs?
@chomik3873
@chomik3873 2 ай бұрын
no he doesn't
@Momoyon
@Momoyon 2 ай бұрын
What does it do?
@blackbeard3449
@blackbeard3449 2 ай бұрын
​@@Momoyonit enables vim like keybinding in enacs
@EnLopXf
@EnLopXf 2 ай бұрын
Hiding malware inside executable
@anon_y_mousse
@anon_y_mousse 2 ай бұрын
The flexibility that it will provide in embedding data files is why I'm so excited for #embed, but unfortunately I still can't update to a C23 compiler that supports it. As it stands now I have a program that I wrote to generate a header for any data files I want to include in the binary. I took some inspiration from Microsoft in that regard, but like your solution, mine is also cross platform. However, there is one tiny quibble with your method of alternating between hot reloading and not. I include the files internally regardless of build type, but I also provide the files externally so that they can be swapped by the user as an extra customization. If they delete the resource folder, my program can just regenerate it in a standard user folder location, ~/.cache/ for instance. That's probably the reason that Jonathan Blow uses a boolean flag, although in my case the resource data is all within a specific location and I can just check if the pointer to the resource comes from the binary or from the heap and no need for a flag.
@aadishm4793
@aadishm4793 2 ай бұрын
Maybe rewriting the project in rust and baking the resources will reduce the binary size. SIGNIFICANTLY
@GeorgeSukFuk
@GeorgeSukFuk 2 ай бұрын
Are you being serious
@eeriemyxi
@eeriemyxi 2 ай бұрын
why are these rustlings everywhere these days
@homepunks9040
@homepunks9040 2 ай бұрын
is there any way i can join your discord?
@sholesy
@sholesy 2 ай бұрын
I feel like I gained 10^10000 brain cells watching each of your videos 😅. Thanks tsoding ❤
@hubstrangers3450
@hubstrangers3450 2 ай бұрын
Thank you, ~ wanted to know, the binary data that most scientific communities generate(LHC etc), could easily converted to C code......take that assumption is correct
@user-ji6ip7ou8d
@user-ji6ip7ou8d 2 ай бұрын
I wonder why he's mostly not freeing the memory he allocates. I haven't really seen him calling the "free" function. Why? Is it because the OS you use does it when the program stops?
@Person1873
@Person1873 2 ай бұрын
You don't need free unless you malloc. Also IIRC he uses an arena allocator which means he just free's the arena at the end of the program.
@berndeckenfels
@berndeckenfels 2 ай бұрын
He does when needed 1:20:53
@jimshtepa5423
@jimshtepa5423 2 ай бұрын
around 4:35 - In C language, does the outcome of the build process depend on the specific file you designate as the target in the build command, or does it also depend on the location from which the build command is executed?
@anon_y_mousse
@anon_y_mousse 2 ай бұрын
Depends on a few factors. If you're using a makefile, then that'll generally dictate where files get placed, either explicitly or implicitly if you have multiple arranged in multiple folders. If you're just issuing the command to gcc, then it's where you're issuing it from plus any extra pathing you include. Such as: `gcc -o bin/foo.o foo.c` would place foo.o in the ./bin/ folder.
@jimshtepa5423
@jimshtepa5423 2 ай бұрын
I see. I just noticed he navigated to the empty folder and ran the build command although the folder he was running the command from was empty @@anon_y_mousse
@StefanvanAalst
@StefanvanAalst 2 ай бұрын
The bundler seems overcomplicated (I'm a noob). Why not use a counter and a mod to print end line after 20 prints? Only one for loop needed
@blackbeard3449
@blackbeard3449 2 ай бұрын
I believe both is functionally equivalent. I think he did it because it was the first thing that came to his mind.
@Roconx
@Roconx 2 ай бұрын
That would work fine, but it would also make it a bit slower by checking whether it is multiple of 20 in every iteration of the loop.
@berndeckenfels
@berndeckenfels 2 ай бұрын
@@Roconxmight still be faster since it’s only a single loop with one terminating condition. And surely faster to type
@NyanCoder
@NyanCoder 2 ай бұрын
Indentation size 5. You evil
@digitaltrolling
@digitaltrolling 2 ай бұрын
А что у тебя за операционная система? Или дистрибутив, если это Линукс.
@softgodez
@softgodez 2 ай бұрын
Это дебиан с i3wm как я помню
@leastexpected3115
@leastexpected3115 2 ай бұрын
У него debian. Насчёт настольного окружения я не знаю
@kala-telo
@kala-telo 2 ай бұрын
Debian Linux with i3
@softgodez
@softgodez 2 ай бұрын
@@leastexpected3115i3wm
@digitaltrolling
@digitaltrolling 2 ай бұрын
Спасибо
@glowiak3430
@glowiak3430 2 ай бұрын
There actually exists a raylib binding for javascript...
@bhavyakukkar
@bhavyakukkar 2 ай бұрын
js bindings that run on node? he is trying to implement raylib logic in js so that wasm code can directly use native js functions instead of emscripten-compiled raylib C functions
@glowiak3430
@glowiak3430 2 ай бұрын
@@bhavyakukkar For some reason there exists a "node-raylib" binding, that basically allows you to write desktop raylib applications in JS. Looking at its github page, many people use it. Absurd.
@coath
@coath 2 ай бұрын
have you ever done a sober stream bro?!
@Klemens102
@Klemens102 2 ай бұрын
Is he not sober?
@marcsfeh
@marcsfeh 2 ай бұрын
what's sad about #embed is that you can literally implement this feature with 20 lines of python to pre process the file ISO committee is where all good ideas go to die :(
@danielsan901998
@danielsan901998 2 ай бұрын
what's nice about #embed is that it can directly include it without having to use the lexer and parser to process it as code, reducing the overhead and without having to depend on an external tool or an extra build step.
@TurtleKwitty
@TurtleKwitty 2 ай бұрын
@@danielsan901998 tsoding did it this way but theres no reason he couldnt have done it with the linker instead to just lump in the binary blobs; less easy to develop on stream though
@replikvltyoutube3727
@replikvltyoutube3727 2 ай бұрын
Well bundling data with executable and hiding said data are different things. I expected to see something like that but with like encrypted files or something..
@noname-gh5rs
@noname-gh5rs 2 ай бұрын
16:30 I guess start here
@rogo7330
@rogo7330 2 ай бұрын
Ah yeah, the cross-platform way to ship resources with you application: files
@amigaworkbench720
@amigaworkbench720 2 ай бұрын
Zip exe with password?
@bertacchius
@bertacchius 2 ай бұрын
First.
@mithrandirek1813
@mithrandirek1813 2 ай бұрын
I would use `ld -r -b binary -o foo.bar.o foo.bar` to convert the binary into an object file, which has symbols for data start, end and size. This cuts out the need of generating and parsing a C file
@esepecesito
@esepecesito 2 ай бұрын
I have posted that many times, but my comments keep dissapearing... anyway, a nice way to embedd data.
Zip works Better than AI
2:09:06
Tsoding Daily
Рет қаралды 57 М.
The Most Bizarre and Fascinating Project I've seen!
1:55:16
Tsoding Daily
Рет қаралды 39 М.
Mac & Cheese Donut @patrickzeinali @ChefRush
00:53
albert_cancook
Рет қаралды 235 МЛН
АВДА КЕДАВРАААААА😂
00:11
Romanov BY
Рет қаралды 8 МЛН
Самый большой бутер в столовке! @krus-kos
00:42
Кушать Хочу
Рет қаралды 6 МЛН
How I Stopped Caring and Just Improved My Project (Nob Ep.01)
1:48:36
Tsoding Daily
Рет қаралды 39 М.
Hash Table in C
2:11:31
Tsoding Daily
Рет қаралды 53 М.
My Own 3b1b Animation Engine but in C
2:06:44
Tsoding Daily
Рет қаралды 17 М.
So You Think You Know Git - FOSDEM 2024
47:00
GitButler
Рет қаралды 886 М.
My Viewers DDoSed my Go App
2:36:31
Tsoding Daily
Рет қаралды 49 М.
Reverse Engineering Data Files
1:59:16
Tsoding Daily
Рет қаралды 37 М.
Just Buy More Cores (1min to 1sec no optimization)
1:39:27
Tsoding Daily
Рет қаралды 28 М.
Why AI is Doomed to Fail the Musical Turing Test
26:50
Adam Neely
Рет қаралды 220 М.
AI Leader Reveals The Future of AI AGENTS (LangChain CEO)
16:22
Matthew Berman
Рет қаралды 42 М.
This Release is Insane!
1:25:56
Tsoding Daily
Рет қаралды 48 М.
All New Atlas | Boston Dynamics
0:40
Boston Dynamics
Рет қаралды 5 МЛН
Секретная функция ютуба 😱🐍 #shorts
0:14
Владислав Шудейко
Рет қаралды 2,1 МЛН
Компьютер подписчику
0:40
Miracle
Рет қаралды 201 М.