Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eterban
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
eterban
Commits
2f323861
Commit
2f323861
authored
Mar 24, 2026
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eterban.sh: add check command for exact IP lookup
Checks IPv4/IPv6 ban lists, firehol and whitelist via ipset test. Co-Authored-By:
Claude Opus 4.6 (1M context)
<
noreply@anthropic.com
>
parent
40fec33d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
eterban.sh
gateway/usr/bin/eterban.sh
+35
-0
No files found.
gateway/usr/bin/eterban.sh
View file @
2f323861
...
...
@@ -30,6 +30,40 @@ if [ "$command" = "ban" ] ; then
exit
fi
if
[
"
$command
"
=
"check"
]
;
then
ip
=
"
$1
"
if
[
-z
"
$ip
"
]
;
then
echo
"Usage: eterban check <ip>"
exit
1
fi
found
=
0
if
echo
"
$ip
"
|
grep
-q
':'
;
then
# IPv6
if
ipset
test
$setname_ipv6
"
$ip
"
2>/dev/null
;
then
echo
"
$ip
is BANNED (in
$setname_ipv6
)"
found
=
1
fi
else
# IPv4
if
ipset
test
$setname
"
$ip
"
2>/dev/null
;
then
echo
"
$ip
is BANNED (in
$setname
)"
found
=
1
fi
if
ipset
test
firehol_level1
"
$ip
"
2>/dev/null
;
then
echo
"
$ip
is in firehol_level1"
found
=
1
fi
if
ipset
test
eterban_white
"
$ip
"
2>/dev/null
;
then
echo
"
$ip
is WHITELISTED"
found
=
1
fi
fi
if
[
"
$found
"
=
"0"
]
;
then
echo
"
$ip
is NOT banned"
fi
exit
fi
if
[
"
$command
"
=
"search"
]
;
then
mask
=
"
$(
echo
"
$1
"
|
sed
-e
's|\.|\\.|g'
)
"
ipset list
$setname
|
grep
--color
"
$mask
"
...
...
@@ -70,6 +104,7 @@ Usage:
Commands:
count - print count of banned IPs
list - list all banned IPs
check <ip> - check if IP is banned (exact match)
search <ip> - search for ip in the list of banned IPs
unban <ip> - unban IP
ban <ip> - ban IP
...
...
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