libpandory/libpandory.c
2023-12-20 11:20:30 +01:00

68 lines
1.6 KiB
C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/statvfs.h>
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;
}
int isReadonly(char const *path)
{
struct statvfs info;
statvfs(path, &info);
return ((info.f_flag & ST_RDONLY) > 0);
}
void libpandory_lefcheck(void) {
printf("TeamPandory - Pandory500 - by emuchicken and dajoho\n");
if (!isReadonly("/")) {
printf("[WARNING]: Your system currently has a writeable NAND storage. This may have been caused by another modification. Pandory will now exit.\n");
exit(1);
}
char fname[80];
strcpy(fname, libpandory_rot13("/zag/Cnaqbel/.sf/cnaqbel.fdkm"));
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);
}
}