Commit 63cd7ca5 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

each spam entry gets its own verification id

parent fd9fa01b
...@@ -233,13 +233,13 @@ class HumanVerification extends Controller ...@@ -233,13 +233,13 @@ class HumanVerification extends Controller
# Check for recent Spams # Check for recent Spams
$eingabe = \Request::input('eingabe'); $eingabe = \Request::input('eingabe');
$spams = Redis::lrange("spam", 0, -1); $spams = Redis::lrange("spam", 0, -1);
foreach ($spams as $spam) { foreach ($spams as $index => $spam) {
if (\preg_match($spam, $eingabe)) { if (\preg_match($spam, $eingabe)) {
return true; return "999.999.999.999" . $index;
} }
} }
return false; return null;
} }
public function botOverview(Request $request) public function botOverview(Request $request)
......
...@@ -31,9 +31,11 @@ class HumanVerification ...@@ -31,9 +31,11 @@ class HumanVerification
$ip = $request->ip(); $ip = $request->ip();
$id = ""; $id = "";
$uid = ""; $uid = "";
if (\App\Http\Controllers\HumanVerification::couldBeSpammer($ip)) {
$id = hash("sha1", "999.999.999.999"); $spamID = \App\Http\Controllers\HumanVerification::couldBeSpammer($ip);
$uid = hash("sha1", "999.999.999.999uid"); if (!empty($spamID)) {
$id = hash("sha1", $spamID);
$uid = hash("sha1", $spamID . "uid");
} else { } else {
$id = hash("sha1", $ip); $id = hash("sha1", $ip);
$uid = hash("sha1", $ip . $_SERVER["AGENT"] . "uid"); $uid = hash("sha1", $ip . $_SERVER["AGENT"] . "uid");
...@@ -96,7 +98,6 @@ class HumanVerification ...@@ -96,7 +98,6 @@ class HumanVerification
if (preg_match("/http[s]{0,1}:\/\/metager\.de\/meta\/meta.ger3\?.*?eingabe=([\w\d]+\.){1,2}[\w\d]+/si", $referer) === 1) { if (preg_match("/http[s]{0,1}:\/\/metager\.de\/meta\/meta.ger3\?.*?eingabe=([\w\d]+\.){1,2}[\w\d]+/si", $referer) === 1) {
$refererLock = true; $refererLock = true;
} }
} }
if ((!$alone && $sum >= 50 && !$user["whitelist"]) || $refererLock) { if ((!$alone && $sum >= 50 && !$user["whitelist"]) || $refererLock) {
...@@ -143,7 +144,6 @@ class HumanVerification ...@@ -143,7 +144,6 @@ class HumanVerification
$request->request->add(['verification_id' => $user["uid"], 'verification_count' => $user["unusedResultPages"]]); $request->request->add(['verification_id' => $user["uid"], 'verification_count' => $user["unusedResultPages"]]);
return $next($request); return $next($request);
} }
public function setUser($prefix, $user) public function setUser($prefix, $user)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment