New seq for nextcloud related tasks
New step: Delete IP from bruteforce table
This commit is contained in:
28
seqs/nextcloud.sh
Executable file
28
seqs/nextcloud.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
step_100_info() { echo "Delete IP from bruteforce table <NC TABLE> <IPV4 ADDRESS>"; }
|
||||
step_100() {
|
||||
local ncdb=
|
||||
local ip=
|
||||
local ipregex='^[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}$'
|
||||
|
||||
if [ -z $2 ] ; then
|
||||
echoerr " [E] No database provided"
|
||||
return 1
|
||||
else
|
||||
ncdb="$2"
|
||||
fi
|
||||
# Check if string looks like ipv4 address
|
||||
if [[ "$3" =~ $ipregex ]] ; then
|
||||
ip="$3"
|
||||
else
|
||||
echoerr " [E] No valid IP:PORT detected: $3"
|
||||
return 1
|
||||
fi
|
||||
|
||||
exe mysql -u root -D ${ncdb} -e 'delete FROM oc_bruteforce_attempts WHERE IP="'${ip}'";'
|
||||
endReturn -o $? "Error deleting ip $ip"
|
||||
}
|
||||
|
||||
VERSION_SEQREV=9
|
||||
. /usr/local/bin/sequencer.sh
|
Reference in New Issue
Block a user