#!/bin/bash
[重點文章] 重點文章 [重點文章] 重點文章
#!/bin/bash X=3 Y=4 empty_string="" if [ $X -lt $Y ] # is $X less than $Y ? then echo "\$X=${X}, which is smaller than \$Y=${Y}" fi if [ -n "$empty_string" ]; then echo "empty string is non_empty" fi if [ -e "${HOME}/.fvwmrc" ]; then # test to see if ~/.fvwmrc exists echo "you have a .fvwmrc file" if [ -L "${HOME}/.fvwmrc" ]; then # is it a symlink ? echo "it's a symbolic link" elif [ -f "${HOME}/.fvwmrc" ]; then # is it a regular file ? echo "it's a regular file" fi else echo "you have no .fvwmrc file" fi
when RULE_INIT {
set static::mseconds 10000
set static::maxdupreq 10
}
when CLIENT_ACCEPTED {
set dup_req 0
set last_req “”
}
when HTTP_REQUEST {
if { $last_req equals “” } {
set last_req [HTTP::uri] set dup_req 0
}
elseif { $last_req == [HTTP::uri] } {
incr dup_req
after $static::mseconds { if {$dup_req > 0} {incr dup_req -1} }
if { $dup_req > $static::maxdupreq } {
log “Killing suspected Mirai at [IP::client_addr]”
TCP::respond “HTTP/1.0\r\n200 OK\r\nLocation: http\r\n\r\n”
TCP::close
}
}
else {
set dup_req 0
}
}