Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
MetaGer
Commits
6733e83c
Commit
6733e83c
authored
Nov 02, 2016
by
Dominik Hebeler
Browse files
Eine einfach Botprotection über JavaScript eingefügt
parent
61eff307
Changes
6
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/MetaGerSearch.php
View file @
6733e83c
...
...
@@ -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 @
6733e83c
...
...
@@ -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 @
6733e83c
...
...
@@ -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 @
6733e83c
This source diff could not be displayed because it is too large. You can
view the blob
instead.
resources/assets/js/scriptResultPage.js
View file @
6733e83c
...
...
@@ -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 @
6733e83c
...
...
@@ -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