├── README.md └── dump_dyld_shared_cache ├── README.md └── main.c /README.md: -------------------------------------------------------------------------------- 1 | iOS hacking stuff -------------------------------------------------------------------------------- /dump_dyld_shared_cache/README.md: -------------------------------------------------------------------------------- 1 | dump dyld_shared_cache files to /tmp/ 2 | -------------------------------------------------------------------------------- /dump_dyld_shared_cache/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #ifndef BUF_SIZE 9 | #define BUF_SIZE 1024 10 | #endif 11 | 12 | int copy_file( char * from, char * to ) 13 | { 14 | printf( "Copy from\n%s\nto\n%s\n", from, to ); 15 | 16 | int inputFd, outputFd, openFlags; 17 | mode_t filePerms; 18 | ssize_t numRead; 19 | char buf[BUF_SIZE]; 20 | 21 | inputFd = open( from, O_RDONLY ); 22 | fcntl( inputFd, F_GLOBAL_NOCACHE, 1 ); 23 | 24 | if ( inputFd == -1 ) 25 | printf( "opening file" ); 26 | 27 | openFlags = O_CREAT | O_WRONLY | O_TRUNC; 28 | filePerms = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; 29 | 30 | outputFd = open( to, openFlags, filePerms ); 31 | 32 | if ( outputFd == -1 ) 33 | printf( "opening file" ); 34 | 35 | while ( ( numRead = read(inputFd, buf, BUF_SIZE ) ) > 0 ) 36 | if ( write( outputFd, buf, numRead ) != numRead ) 37 | printf( "couldn't write whole buffer" ); 38 | 39 | if (numRead == -1) 40 | printf( "read"); 41 | 42 | if (close(inputFd) == -1) 43 | printf( "close input" ); 44 | 45 | if (close(outputFd) == -1) 46 | printf( "close output" ); 47 | 48 | return 1; 49 | } 50 | 51 | int main( ) 52 | { 53 | char * home; 54 | home = getenv( "HOME" ); 55 | 56 | strcat( home, "/tmp/" ); 57 | 58 | DIR *d; 59 | struct dirent *dir; 60 | char path[] = "/System/Library/Caches/com.apple.dyld/"; 61 | d = opendir( path ); 62 | 63 | char file_path[256]; 64 | char new_path[256]; 65 | 66 | if (d) 67 | { 68 | while (( dir = readdir(d) ) != NULL ) 69 | { 70 | if ( dir->d_type == DT_REG ) 71 | { 72 | strcpy( file_path, path ); 73 | strcat( file_path, dir->d_name ); 74 | 75 | strcpy( new_path, home ); 76 | strcat( new_path, dir->d_name ); 77 | 78 | copy_file( file_path, new_path ); 79 | } 80 | } 81 | closedir(d); 82 | } 83 | } 84 | --------------------------------------------------------------------------------