Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
open-source
MetaGer
Commits
3bbf7192
Commit
3bbf7192
authored
Nov 02, 2016
by
Dominik Hebeler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Eine einfach Botprotection über JavaScript eingefügt
parent
8e9e37e7
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
4 deletions
+54
-4
app/Http/Controllers/MetaGerSearch.php
app/Http/Controllers/MetaGerSearch.php
+15
-3
app/MetaGer.php
app/MetaGer.php
+19
-0
public/js/all.js
public/js/all.js
+9
-0
public/js/all.js.map
public/js/all.js.map
+1
-1
resources/assets/js/scriptResultPage.js
resources/assets/js/scriptResultPage.js
+9
-0
routes/web.php
routes/web.php
+1
-0
No files found.
app/Http/Controllers/MetaGerSearch.php
View file @
3bbf7192
...
...
@@ -15,11 +15,15 @@ class MetaGerSearch extends Controller
$time
=
microtime
();
# Mit gelieferte Formulardaten parsen und abspeichern:
$metager
->
parseFormData
(
$request
);
#if($metager->getFokus() !== "bilder" )
#{
# Ein Schutz gegen bestimmte Bot-Angriffe, die uns passiert sind.
if
(
$metager
->
doBotProtection
(
$request
->
input
(
'bot'
,
""
)))
{
return
redirect
(
LaravelLocalization
::
getLocalizedURL
(
LaravelLocalization
::
getCurrentLocale
(),
url
(
"/noaccess"
,
[
'redirect'
=>
base64_encode
(
url
()
->
full
())])));
}
# Nach Spezialsuchen überprüfen:
$metager
->
checkSpecialSearches
(
$request
);
#}
# Alle Suchmaschinen erstellen
$metager
->
createSearchEngines
(
$request
);
...
...
@@ -33,6 +37,14 @@ class MetaGerSearch extends Controller
return
$metager
->
createView
();
}
public
function
botProtection
(
$redirect
)
{
$hash
=
md5
(
date
(
'YmdHi'
));
return
view
(
'botProtection'
)
->
with
(
'hash'
,
$hash
)
->
with
(
'r'
,
$redirect
);
}
public
function
quicktips
(
Request
$request
)
{
$q
=
$request
->
input
(
'q'
,
''
);
...
...
app/MetaGer.php
View file @
3bbf7192
...
...
@@ -310,6 +310,25 @@ class MetaGer
}
}
/**
* Diese Funktion überprüft, ob wir einen erweiterten Check auf Bots machen müssen.
* Z.B.: Wurden wir von einem Bot (dessen Anfragen aus dem Tor-Netzwerk kamen) mit tausenden
* Anfragen zu Telefonnummern überschwemmt. Bei diesen werden wir nun eine erweiterte Überprüfung
* durchführen.
* Für den Anfang werden wir alle Anfragen, die unter diese Kriterien fallen, nur noch beantworten, wenn
* JavaScript ausgeführt wird. (Mal schauen ob und wie lange dies ausreicht)
*/
public
function
doBotProtection
(
$bot
)
{
$hash
=
md5
(
date
(
'YmdHi'
));
if
(
preg_match
(
"/^\d+$/s"
,
$this
->
getEingabe
())
&&
$bot
!==
$hash
)
{
return
true
;
}
else
{
return
false
;
}
}
public
function
combineResults
(
$engines
)
{
foreach
(
$engines
as
$engine
)
{
...
...
public/js/all.js
View file @
3bbf7192
...
...
@@ -3583,6 +3583,7 @@ $(document).ready(function() {
$('iframe').iFrameResize({
'autoResize': false
});
botProtection();
});
function tabs() {
...
...
@@ -3793,6 +3794,14 @@ function fokiChanger() {
});
})(jQuery);
function botProtection() {
if ($("meta[name=pqr]").length > 0) {
var link = atob($("meta[name=pqr]").attr("content"));
var hash = $("meta[name=pq]").attr("content");
document.location.href = link + "&bot=" + hash;
}
}
function productWidget() {
var isMobile = false; //initiate as false
// device detection
...
...
public/js/all.js.map
View file @
3bbf7192
This diff is collapsed.
Click to expand it.
resources/assets/js/scriptResultPage.js
View file @
3bbf7192
...
...
@@ -3,6 +3,7 @@ $(document).ready(function() {
$
(
'
iframe
'
).
iFrameResize
({
'
autoResize
'
:
false
});
botProtection
();
});
function
tabs
()
{
...
...
@@ -213,6 +214,14 @@ function fokiChanger() {
});
})(
jQuery
);
function
botProtection
()
{
if
(
$
(
"
meta[name=pqr]
"
).
length
>
0
)
{
var
link
=
atob
(
$
(
"
meta[name=pqr]
"
).
attr
(
"
content
"
));
var
hash
=
$
(
"
meta[name=pq]
"
).
attr
(
"
content
"
);
document
.
location
.
href
=
link
+
"
&bot=
"
+
hash
;
}
}
function
productWidget
()
{
var
isMobile
=
false
;
//initiate as false
// device detection
...
...
routes/web.php
View file @
3bbf7192
...
...
@@ -135,6 +135,7 @@ Route::group(
Route
::
get
(
'settings'
,
'StartpageController@loadSettings'
);
Route
::
match
([
'get'
,
'post'
],
'meta/meta.ger3'
,
'MetaGerSearch@search'
);
Route
::
get
(
'noaccess/{redirect}'
,
'MetaGerSearch@botProtection'
);
Route
::
get
(
'meta/picture'
,
'Pictureproxy@get'
);
Route
::
get
(
'clickstats'
,
'LogController@clicklog'
);
Route
::
get
(
'pluginClose'
,
'LogController@pluginClose'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment