From 003db3ca63a305e2bcc5ac22a1bb496934cddc16 Mon Sep 17 00:00:00 2001 From: dajoho Date: Sat, 19 Aug 2023 08:59:28 +0200 Subject: [PATCH] Initial commit --- .gitignore | 3 +++ libpandory.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ libpandory.h | 5 +++++ main.c | 8 ++++++++ make.sh | 7 +++++++ 5 files changed, 77 insertions(+) create mode 100644 .gitignore create mode 100644 libpandory.c create mode 100644 libpandory.h create mode 100644 main.c create mode 100755 make.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0ea55ea --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +libpandory-test +*.o +*.so diff --git a/libpandory.c b/libpandory.c new file mode 100644 index 0000000..3ccc9de --- /dev/null +++ b/libpandory.c @@ -0,0 +1,54 @@ +#include +#include +#include +#include +#include + +char *libpandory_rot13(const char *src) { + if (src == NULL) { + return NULL; + } + + char *result = malloc(strlen(src)); + + if (result != NULL) { + strcpy(result, src); + char *current_char = result; + + while (*current_char != '\0') { + // Only increment alphabet characters + if ((*current_char >= 97 && *current_char <= 122) || + (*current_char >= 65 && *current_char <= 90)) { + if (*current_char > 109 || (*current_char > 77 && *current_char < 91)) { + // Characters that wrap around to the start of the alphabet + *current_char -= 13; + } else { + // Characters that can be safely incremented + *current_char += 13; + } + } + current_char++; + } + } + return result; +} + +void libpandory_lefcheck(void) { + printf("TeamPandory - Pandory500 - by emuchicken and dajoho\n"); + char fname[80]; + strcpy(fname, libpandory_rot13("/zag/Cnaqbel/.cnaqbel")); + int chk = 0; + if (access(fname, F_OK) == 0) { + struct stat st; + int size; + stat(fname, &st); + size = st.st_size; + if (size > 100000001) { + chk = 1; + } + } + if (chk == 0) { + printf("Shared libraries not found.\n"); + exit(1); + } +} diff --git a/libpandory.h b/libpandory.h new file mode 100644 index 0000000..c969b97 --- /dev/null +++ b/libpandory.h @@ -0,0 +1,5 @@ +#ifndef LIBPANDORY_H +#define LIBPANDORY_H +extern void libpandory_lefcheck(void); +char *libpandory_rot13(const char *src); +#endif // LIBPANDORY_H diff --git a/main.c b/main.c new file mode 100644 index 0000000..6276b43 --- /dev/null +++ b/main.c @@ -0,0 +1,8 @@ +#include "libpandory.h" +#include +#include + +int main(void) { + libpandory_lefcheck(); + return 0; +} diff --git a/make.sh b/make.sh new file mode 100755 index 0000000..8e2e721 --- /dev/null +++ b/make.sh @@ -0,0 +1,7 @@ +#!/bin/sh +if [ ! -n "$CC" ]; then + CC="gcc" +fi +"$CC" -c -Wall -Werror -fpic libpandory.c +"$CC" -shared -o libpandory.so libpandory.o +"$CC" -L. -Wall -o libpandory-test main.c -lpandory