forked from greatagent/ga
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclean-sha1.php
73 lines (66 loc) · 1.87 KB
/
clean-sha1.php
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
<?php
# greatagent-ga - Software suite for breakthrough GFW
# greatagent-ga - Software suite for breakthrough GFW
#
# clean-sha1.php - Cleanup sha1 table
# some files do not need to appear in hash table
/* Set Current Directory */
preg_match('/(.*?)\\\clean-sha1\.php$/',__FILE__,$currentdir);
chdir($currentdir[1]);
function cleanup($line) {
if(base64_encode($line)=="ZTc4NDhiZTgzNzBmNTg3Y2E1NTJkOGE0ZjIxNmI4NDIgIC5c5LiA6ZSu57+75aKZLmJhdA=="){
return false;
}
if (preg_match('/ \.\\\\.git\\\/',$line)) {
return false;
}
if (preg_match('/ \.\\\git\.txt$/',$line)) {
return false;
}
if (preg_match('/ \.\\\cert8\.db$/',$line)) {
return true;
}
if (preg_match('/ \.\\\wallproxy-local\\\cert\\\/',$line)) {
return false;
}
if (preg_match('/ \.\\\data\\\flag\\\/',$line)) {
return false;
}
if (preg_match('/ \.\\\goagent-local\\\certs\\\/',$line)) {
return false;
}
if (preg_match('/ \.\\\utility\\\md5deep\.exe$/',$line)) {
return false;
}
if (preg_match('/ \.\\\utility\\\md5deep64\.exe$/',$line)) {
return false;
}
if (preg_match('/ \.\\\hash\.sha1$/',$line)) {
return false;
}
if (preg_match('/ \.\\\sign\.sha1$/',$line)) {
return false;
}
if (preg_match('/ \.\\\hash\.dat$/',$line)) {
return false;
}
if (preg_match('/ \.\\\sign\.dat$/',$line)) {
return false;
}
if (preg_match('/ \.\\\data\\\last-known-good$/',$line)) {
return false;
}
return true;
}
/* Check local hash.sha1 exists or not*/
if(! file_exists("hash.sha1")){
die("Fatal Error: hash.sha1 not exists!");
}
$hashtable=file_get_contents("hash.sha1");
$hashtable=explode("\r\n",$hashtable);
$hashtable=array_filter($hashtable,"cleanup");
sort($hashtable);
$hashtable=implode("\r\n",$hashtable);
/* Output hash.sha1 */
if(! file_put_contents("hash.sha1",$hashtable)){ echo "ERROR to wrtie hash.sha1!"; }
?>