Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MetaGer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open-source
MetaGer
Commits
ea0eb011
Commit
ea0eb011
authored
5 years ago
by
Dominik Hebeler
Browse files
Options
Downloads
Patches
Plain Diff
modified hv
parent
ae0773a5
No related branches found
Branches containing commit
No related tags found
1 merge request
!1438
modified hv
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/Http/Middleware/HumanVerification.php
+15
-4
15 additions, 4 deletions
app/Http/Middleware/HumanVerification.php
with
15 additions
and
4 deletions
app/Http/Middleware/HumanVerification.php
+
15
−
4
View file @
ea0eb011
...
@@ -29,7 +29,7 @@ class HumanVerification
...
@@ -29,7 +29,7 @@ class HumanVerification
$ip
=
$request
->
ip
();
$ip
=
$request
->
ip
();
$id
=
""
;
$id
=
""
;
$uid
=
""
;
$uid
=
""
;
if
(
$this
->
isTo
r
(
$ip
))
{
if
(
$this
->
couldBeSpamme
r
(
$ip
))
{
$id
=
hash
(
"sha512"
,
"999.999.999.999"
);
$id
=
hash
(
"sha512"
,
"999.999.999.999"
);
$uid
=
hash
(
"sha512"
,
"999.999.999.999"
.
$ip
.
$_SERVER
[
"AGENT"
]
.
"uid"
);
$uid
=
hash
(
"sha512"
,
"999.999.999.999"
.
$ip
.
$_SERVER
[
"AGENT"
]
.
"uid"
);
}
else
{
}
else
{
...
@@ -189,7 +189,7 @@ class HumanVerification
...
@@ -189,7 +189,7 @@ class HumanVerification
}
}
private
function
isTo
r
(
$ip
)
private
function
couldBeSpamme
r
(
$ip
)
{
{
$serverAddress
=
empty
(
$_SERVER
[
'SERVER_ADDR'
])
?
"144.76.88.77"
:
$_SERVER
[
'SERVER_ADDR'
];
$serverAddress
=
empty
(
$_SERVER
[
'SERVER_ADDR'
])
?
"144.76.88.77"
:
$_SERVER
[
'SERVER_ADDR'
];
$queryUrl
=
"https://tor.metager.org?password="
.
urlencode
(
env
(
"TOR_PASSWORD"
))
.
"&ra="
.
urlencode
(
$ip
)
.
"&sa="
.
urlencode
(
$serverAddress
)
.
"&sp=443"
;
$queryUrl
=
"https://tor.metager.org?password="
.
urlencode
(
env
(
"TOR_PASSWORD"
))
.
"&ra="
.
urlencode
(
$ip
)
.
"&sa="
.
urlencode
(
$serverAddress
)
.
"&sp=443"
;
...
@@ -201,10 +201,21 @@ class HumanVerification
...
@@ -201,10 +201,21 @@ class HumanVerification
$httpcode
=
curl_getinfo
(
$ch
,
CURLINFO_HTTP_CODE
);
$httpcode
=
curl_getinfo
(
$ch
,
CURLINFO_HTTP_CODE
);
curl_close
(
$ch
);
curl_close
(
$ch
);
$possibleSpammer
=
false
;
if
(
$httpcode
===
200
)
{
if
(
$httpcode
===
200
)
{
return
true
;
return
true
;
}
else
{
return
false
;
}
}
# Check for recent Spams
$eingabe
=
\Request
::
input
(
'eingabe'
);
if
(
\preg_match
(
"/^[
\\
d]
{
3
}
\s*chan.*$/si"
,
$eingabe
))
{
return
true
;
}
if
(
\preg_match
(
"/^susimail\s+-site:[^\s]+\s-site:/si"
,
$eingabe
))
{
return
true
;
}
return
$possibleSpammer
;
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment