-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathTweak.xm
157 lines (134 loc) · 3.15 KB
/
Tweak.xm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
//不要なものが混じってます
#import <stdio.h>
#import <substrate.h>
#import <Foundation/Foundation.h>
#import <mach-o/dyld.h>
#import <UIKit/UIKit.h>
#import <fstream>
#import <string.h>
#import <dirent.h>
#import <sys/types.h>
#import <sys/stat.h>
#import <fcntl.h>
#import <sys/syscall.h>
//using namespace std;
int nest = 0;
%hook UIApplication
-(BOOL)canOpenURL:(id)arg1
{
NSLog(@"canOpenURL");
return NO;
}
%end
//---------------------------------------------//
struct dirent* readdir(DIR* dir);
%hookf(struct dirent*,readdir,DIR* dir)
{
struct dirent* dire;
while((dire = %orig(dir)) != NULL)
{
if (strcasecmp(dire->d_name,"User") == 0)
{
strcpy(dire->d_name,"System");
}
if (strcasecmp(dire->d_name,"pguntether") == 0)
{
strcpy(dire->d_name,"System");
}
if (strcasecmp(dire->d_name,"boot") == 0)
{
strcpy(dire->d_name,"System");
}
if (strcasecmp(dire->d_name,"lib") == 0)
{
strcpy(dire->d_name,"System");
}
if (strcasecmp(dire->d_name,"mnt") == 0)
{
strcpy(dire->d_name,"System");
}
if (strcasecmp(dire->d_name,"var") == 0)
{
strcpy(dire->d_name,"System");
}
return dire;
}
return %orig;
}
//---------------------------------------------//
DIR* __opendir2(const char *path, int buf);
%hookf(DIR *,__opendir2,const char *path,int buf)
{
char* newpath = const_cast<char*>(path);
if (strcasecmp(path,"/User") == 0)
{
newpath[0] = 'a';
return NULL;
}
if (strcasecmp(path,"/boot") == 0)
{
newpath[0] = 'a';
return NULL;
}
if (strcasecmp(path,"/lib") == 0)
{
newpath[0] = 'a';
return NULL;
}
if (strcasecmp(path,"/mnt") == 0)
{
newpath[0] = 'a';
return NULL;
}
if (strcasecmp(path,"/Applications/Cydia.app") == 0)
{
newpath[0] = 'a';
return NULL;
}
if (strcasecmp(path,"/private/var/lib") == 0)
{
newpath[0] = 'a';
return NULL;
}
if (strcasecmp(path,"/private/var/stash") == 0)
{
newpath[0] = 'a';
return NULL;
}
if (strcasecmp(path,"/private/var/mobile/Library/SBSettings/Themes") == 0)
{
newpath[0] = 'a';
return NULL;
}
if (strcasecmp(path,"/System/Library/LaunchDaemons/com.saurik.Cydia.Startup.plist") == 0)
{
newpath[0] = 'a';
return NULL;
}
DIR* dia = %orig(path,buf);
return dia;
}
//---------------------------------------------//
int strcasecmp(const char *s1, const char *s2);
%hookf(int,strcasecmp,const char *s1, const char *s2)
{
char* newcp = const_cast<char*>(s1);
if (nest == 0)
{
nest += 1;
}else{
nest = 0;
return %orig(s1,s2);
}
if (strcasecmp(".",s2) == 0)
{
strcpy(newcp,"AppStore.app");
}
return %orig(newcp,s2);
}
//---------------------------------------//
int system(const char *s1);
%hookf(int,system,const char *s1)
{
return 0;
}