This repository has been archived by the owner on Sep 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
auto_anonymize.php
156 lines (149 loc) · 3.29 KB
/
auto_anonymize.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
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
<?php
/*
Script to anonymize all external links on page
Author: NewEraCracker
License: Public Domain
You have to upload this file to your website and place the code below at the end
of the body area (if possible, directly before the </body> tag) of your template.
<script src="script-location/auto_anonymize.php" type="text/javascript"></script>
*/
function getHeaders() {
$headers = array();
foreach($_SERVER as $k => $v) {
if(substr($k, 0, 5) == "HTTP_") {
$k = str_replace('_', ' ', substr($k, 5));
$k = str_replace(' ', '-', ucwords(strtolower($k)));
$headers[$k] = $v;
}
}
return $headers;
}
$headers = getHeaders();
$file_time = filemtime(__FILE__);
header('Cache-Control: must-revalidate');
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $file_time).' GMT');
if(isset($headers['If-Modified-Since']) && (@strtotime($headers['If-Modified-Since']) == $file_time)) {
header('HTTP/1.1 304 Not Modified');
exit();
} else {
header('HTTP/1.1 200 OK');
header('Content-Type: text/javascript; charset=UTF-8');
}
?>
var protected_links = "anonymz.com";
var a_va = 0;
var a_vb = 0;
var a_vc = "";
function auto_anonymize_href()
{
var a_vd = window.location.hostname;
if(protected_links != "" && !protected_links.match(a_vd))
{
protected_links += ", " + a_vd;
}
else if(protected_links == "")
{
protected_links = a_vd;
}
var a_ve = "";
var a_vf = new Array();
var a_vg = 0;
a_ve = document.getElementsByTagName("a");
a_va = a_ve.length;
a_vf = a_fa();
a_vg = a_vf.length;
var a_vh = false;
var j = 0;
var a_vi = "";
for(var i = 0; i < a_va; i++)
{
a_vh = false;
j = 0;
while(a_vh == false && j < a_vg)
{
a_vi = a_ve[i].href;
if(a_vi.match(a_vf[j]) || !a_vi || !(a_vi.match("http://") || a_vi.match("https://")))
{
a_vh = true;
}
j++;
}
if(a_vh == false)
{
a_ve[i].href = "http://anonymz.com/?" + a_vi;
a_vb++;
a_vc += i + ":::" + a_ve[i].href + "\n" ;
}
}
var a_vj = document.getElementById("anonyminized");
var a_vk = document.getElementById("found_links");
if(a_vj)
{
a_vj.innerHTML += a_vb;
}
if(a_vk)
{
a_vk.innerHTML += a_va;
}
}
function auto_anonymize_iframe()
{
var a_vd = window.location.hostname;
if(protected_links != "" && !protected_links.match(a_vd))
{
protected_links += ", " + a_vd;
}
else if(protected_links == "")
{
protected_links = a_vd;
}
var a_ve = "";
var a_vf = new Array();
var a_vg = 0;
a_ve = document.getElementsByTagName("iframe");
a_va = a_ve.length;
a_vf = a_fa();
a_vg = a_vf.length;
var a_vh = false;
var j = 0;
var a_vi = "";
for(var i = 0; i < a_va; i++)
{
a_vh = false;
j = 0;
while(a_vh == false && j < a_vg)
{
a_vi = a_ve[i].src;
if(a_vi.match(a_vf[j]) || !a_vi || !(a_vi.match("http://") || a_vi.match("https://")))
{
a_vh = true;
}
j++;
}
if(a_vh == false)
{
a_ve[i].src = "http://anonymz.com/?" + a_vi;
a_vb++;
a_vc += i + ":::" + a_ve[i].src + "\n" ;
}
}
var a_vj = document.getElementById("anonyminized");
var a_vk = document.getElementById("found_links");
if(a_vj)
{
a_vj.innerHTML += a_vb;
}
if(a_vk)
{
a_vk.innerHTML += a_va;
}
}
function a_fa()
{
var a_vf = new Array();
protected_links = protected_links.replace(" ", "");
a_vf = protected_links.split(",");
return a_vf;
}
auto_anonymize_href();
auto_anonymize_iframe();