This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

博客

This is the blog section. It has two categories: News and Releases.

Files in these directories will be listed in reverse chronological order.

News

Easy documentation with Docsy

The Docsy Hugo theme lets project maintainers and contributors focus on content, not on reinventing a website infrastructure from scratch

This is a typical blog post that includes images.

The front matter specifies the date of the blog post, its title, a short description that will be displayed on the blog landing page, and its author.

Including images

Here’s an image (featured-sunset-get.png) that includes a byline and a caption.

Fetch and scale an image in the upcoming Hugo 0.43.
Photo: Riona MacNamara / CC-BY-CA

The front matter of this post specifies properties to be assigned to all image resources:

resources:
- src: "**.{png,jpg}"
  title: "Image #:counter"
  params:
    byline: "Photo: Riona MacNamara / CC-BY-CA"

To include the image in a page, specify its details like this:

Fetch and scale an image in the upcoming Hugo 0.43.
Photo: Riona MacNamara / CC-BY-CA

The image will be rendered at the size and byline specified in the front matter.

Second blog post

A short lead description about this content page. Text here can also be bold or italic and can even be split over multiple paragraphs.

Text can be bold, italic, or strikethrough. Links should be blue with no underlines (unless hovered over).

There should be whitespace between paragraphs. There should be whitespace between paragraphs. There should be whitespace between paragraphs. There should be whitespace between paragraphs.

There should be whitespace between paragraphs. There should be whitespace between paragraphs. There should be whitespace between paragraphs. There should be whitespace between paragraphs.

There should be no margin above this first sentence.

Blockquotes should be a lighter gray with a border along the left side in the secondary color.

There should be no margin below this final sentence.

First Header

This is a normal paragraph following a header. Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong. Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong. Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.

Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.

On big screens, paragraphs and headings should not take up the full container width, but we want tables, code blocks and similar to take the full width.

Lorem markdownum tuta hospes stabat; idem saxum facit quaterque repetito occumbere, oves novem gestit haerebat frena; qui. Respicit recurvam erat: pignora hinc reppulit nos aut, aptos, ipsa.

Meae optatos passa est Epiros utiliter Talibus niveis, hoc lata, edidit. Dixi ad aestum.

Header 2

This is a blockquote following a header. Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.

Header 3

This is a code block following a header.

Header 4

  • This is an unordered list following a header.
  • This is an unordered list following a header.
  • This is an unordered list following a header.
Header 5
  1. This is an ordered list following a header.
  2. This is an ordered list following a header.
  3. This is an ordered list following a header.
Header 6
What Follows
A table A header
A table A header
A table A header

There’s a horizontal rule above and below this.


Here is an unordered list:

  • Salt-n-Pepa
  • Bel Biv DeVoe
  • Kid ‘N Play

And an ordered list:

  1. Michael Jackson
  2. Michael Bolton
  3. Michael Bublé

And an unordered task list:

  • Create a sample markdown document
  • Add task lists to it
  • Take a vacation

And a “mixed” task list:

  • Steal underpants
  • ?
  • Profit!

And a nested list:

  • Jackson 5
    • Michael
    • Tito
    • Jackie
    • Marlon
    • Jermaine
  • TMNT
    • Leonardo
    • Michelangelo
    • Donatello
    • Raphael

Definition lists can be used with Markdown syntax. Definition terms are bold.

Name
Godzilla
Born
1952
Birthplace
Japan
Color
Green

Tables should have bold headings and alternating shaded rows.

Artist Album Year
Michael Jackson Thriller 1982
Prince Purple Rain 1984
Beastie Boys License to Ill 1986

If a table is too wide, it should scroll horizontally.

Artist Album Year Label Awards Songs
Michael Jackson Thriller 1982 Epic Records Grammy Award for Album of the Year, American Music Award for Favorite Pop/Rock Album, American Music Award for Favorite Soul/R&B Album, Brit Award for Best Selling Album, Grammy Award for Best Engineered Album, Non-Classical Wanna Be Startin’ Somethin’, Baby Be Mine, The Girl Is Mine, Thriller, Beat It, Billie Jean, Human Nature, P.Y.T. (Pretty Young Thing), The Lady in My Life
Prince Purple Rain 1984 Warner Brothers Records Grammy Award for Best Score Soundtrack for Visual Media, American Music Award for Favorite Pop/Rock Album, American Music Award for Favorite Soul/R&B Album, Brit Award for Best Soundtrack/Cast Recording, Grammy Award for Best Rock Performance by a Duo or Group with Vocal Let’s Go Crazy, Take Me With U, The Beautiful Ones, Computer Blue, Darling Nikki, When Doves Cry, I Would Die 4 U, Baby I’m a Star, Purple Rain
Beastie Boys License to Ill 1986 Mercury Records noawardsbutthistablecelliswide Rhymin & Stealin, The New Style, She’s Crafty, Posse in Effect, Slow Ride, Girls, (You Gotta) Fight for Your Right, No Sleep Till Brooklyn, Paul Revere, Hold It Now, Hit It, Brass Monkey, Slow and Low, Time to Get Ill

Code snippets like var foo = "bar"; can be shown inline.

Also, this should vertically align with this and this.

Code can also be shown in a block element.

foo := "bar";
bar := "foo";

Code can also use syntax highlighting.

func main() {
  input := `var foo = "bar";`

  lexer := lexers.Get("javascript")
  iterator, _ := lexer.Tokenise(nil, input)
  style := styles.Get("github")
  formatter := html.New(html.WithLineNumbers())

  var buff bytes.Buffer
  formatter.Format(&buff, style, iterator)

  fmt.Println(buff.String())
}
Long, single-line code blocks should not wrap. They should horizontally scroll if they are too long. This line should be long enough to demonstrate this.

Inline code inside table cells should still be distinguishable.

Language Code
Javascript var foo = "bar";
Ruby foo = "bar"{

Small images should be shown at their actual size.

Large images should always scale down and fit in the content container.

Components

Alerts

Sizing

Add some sections here to see how the ToC looks like. Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.

Parameters available

Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.

Using pixels

Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.

Using rem

Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.

Memory

Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.

RAM to use

Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.

More is better

Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.

Used RAM

Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.

This is the final element on the page and there should be no margin below this.

Releases

Another Great Release

A short lead description about this content page. Text here can also be bold or italic and can even be split over multiple paragraphs.

Text can be bold, italic, or strikethrough. Links should be blue with no underlines (unless hovered over).

There should be whitespace between paragraphs. There should be whitespace between paragraphs. There should be whitespace between paragraphs. There should be whitespace between paragraphs.

There should be whitespace between paragraphs. There should be whitespace between paragraphs. There should be whitespace between paragraphs. There should be whitespace between paragraphs.

There should be no margin above this first sentence.

Blockquotes should be a lighter gray with a border along the left side in the secondary color.

There should be no margin below this final sentence.

First Header

This is a normal paragraph following a header. Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong. Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong. Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.

Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.

On big screens, paragraphs and headings should not take up the full container width, but we want tables, code blocks and similar to take the full width.

Lorem markdownum tuta hospes stabat; idem saxum facit quaterque repetito occumbere, oves novem gestit haerebat frena; qui. Respicit recurvam erat: pignora hinc reppulit nos aut, aptos, ipsa.

Meae optatos passa est Epiros utiliter Talibus niveis, hoc lata, edidit. Dixi ad aestum.

Header 2

This is a blockquote following a header. Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.

Header 3

This is a code block following a header.

Header 4

  • This is an unordered list following a header.
  • This is an unordered list following a header.
  • This is an unordered list following a header.
Header 5
  1. This is an ordered list following a header.
  2. This is an ordered list following a header.
  3. This is an ordered list following a header.
Header 6
What Follows
A table A header
A table A header
A table A header

There’s a horizontal rule above and below this.


Here is an unordered list:

  • Salt-n-Pepa
  • Bel Biv DeVoe
  • Kid ‘N Play

And an ordered list:

  1. Michael Jackson
  2. Michael Bolton
  3. Michael Bublé

And an unordered task list:

  • Create a sample markdown document
  • Add task lists to it
  • Take a vacation

And a “mixed” task list:

  • Steal underpants
  • ?
  • Profit!

And a nested list:

  • Jackson 5
    • Michael
    • Tito
    • Jackie
    • Marlon
    • Jermaine
  • TMNT
    • Leonardo
    • Michelangelo
    • Donatello
    • Raphael

Definition lists can be used with Markdown syntax. Definition terms are bold.

Name
Godzilla
Born
1952
Birthplace
Japan
Color
Green

Tables should have bold headings and alternating shaded rows.

Artist Album Year
Michael Jackson Thriller 1982
Prince Purple Rain 1984
Beastie Boys License to Ill 1986

If a table is too wide, it should scroll horizontally.

Artist Album Year Label Awards Songs
Michael Jackson Thriller 1982 Epic Records Grammy Award for Album of the Year, American Music Award for Favorite Pop/Rock Album, American Music Award for Favorite Soul/R&B Album, Brit Award for Best Selling Album, Grammy Award for Best Engineered Album, Non-Classical Wanna Be Startin’ Somethin’, Baby Be Mine, The Girl Is Mine, Thriller, Beat It, Billie Jean, Human Nature, P.Y.T. (Pretty Young Thing), The Lady in My Life
Prince Purple Rain 1984 Warner Brothers Records Grammy Award for Best Score Soundtrack for Visual Media, American Music Award for Favorite Pop/Rock Album, American Music Award for Favorite Soul/R&B Album, Brit Award for Best Soundtrack/Cast Recording, Grammy Award for Best Rock Performance by a Duo or Group with Vocal Let’s Go Crazy, Take Me With U, The Beautiful Ones, Computer Blue, Darling Nikki, When Doves Cry, I Would Die 4 U, Baby I’m a Star, Purple Rain
Beastie Boys License to Ill 1986 Mercury Records noawardsbutthistablecelliswide Rhymin & Stealin, The New Style, She’s Crafty, Posse in Effect, Slow Ride, Girls, (You Gotta) Fight for Your Right, No Sleep Till Brooklyn, Paul Revere, Hold It Now, Hit It, Brass Monkey, Slow and Low, Time to Get Ill

Code snippets like var foo = "bar"; can be shown inline.

Also, this should vertically align with this and this.

Code can also be shown in a block element.

foo := "bar";
bar := "foo";

Code can also use syntax highlighting.

func main() {
  input := `var foo = "bar";`

  lexer := lexers.Get("javascript")
  iterator, _ := lexer.Tokenise(nil, input)
  style := styles.Get("github")
  formatter := html.New(html.WithLineNumbers())

  var buff bytes.Buffer
  formatter.Format(&buff, style, iterator)

  fmt.Println(buff.String())
}
Long, single-line code blocks should not wrap. They should horizontally scroll if they are too long. This line should be long enough to demonstrate this.

Inline code inside table cells should still be distinguishable.

Language Code
Javascript var foo = "bar";
Ruby foo = "bar"{

Small images should be shown at their actual size.

Large images should always scale down and fit in the content container.

Components

Alerts

Sizing

Add some sections here to see how the ToC looks like. Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.

Parameters available

Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.

Using pixels

Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.

Using rem

Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.

Memory

Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.

RAM to use

Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.

More is better

Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.

Used RAM

Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.

This is the final element on the page and there should be no margin below this.

ufw deny规则排序

前言

​ 服务器炸了几天,手机没留意消息了,21号才看到。

chat.png

you are not sorry

上代码


#!/usr/bin/env bash

# 使用 ufw status 命令获取规则列表
rules=$(ufw status | grep "DENY" | grep -v "Anywhere (v6)" | awk '{print $1 " " $3}')

IFS=$'\n' read -r -d '' -a rule_array <<<"$rules"

for rule in "${rule_array[@]}"; do
    to=$(echo "$rule" | awk '{print $1}')
    from=$(echo "$rule" | awk '{print $2}')
    echo " ==================== $to From: $from ==================== "

    if [ "$to" != "Anywhere" ] && [ "$from" == "Anywhere" ]; then
        to_port=$(echo "$to" | awk -F'/' '{print $1}')
        to_proto=$(echo "$to" | awk -F'/' '{print $2}')
        proto_arg=""
        if [ -z "$to_proto" ]; then
            proto_arg=""
        else
            proto_arg="proto $to_proto"
        fi

        ufw delete deny to any port ${to_port} ${proto_arg}

        ufw insert 1 deny from 0.0.0.0/0 to any port ${to_port} ${proto_arg}
        ufw insert $(ufw status numbered | grep '(v6)' | awk '{print $1}' | grep -o '[0-9]*' | head -n 1) deny from ::/0 to any port ${to_port} ${proto_arg}

    elif
        [ "$to" == "Anywhere" ] && [ "$from" != "Anywhere" ]
    then
        ufw delete deny from ${from}
        if [[ "$from" =~ : ]]; then
            # shellcheck disable=SC2046
            ufw insert $(ufw status numbered | grep '(v6)' | awk '{print $1}' | grep -o '[0-9]*' | head -n 1) deny from ${from} to any port ${to}
        else
            ufw insert 1 deny from ${from}
        fi

    elif [ "$to" != "Anywhere" ] && [ "$from" != "Anywhere" ]; then
        to_port=$(echo "$to" | awk -F'/' '{print $1}')
        to_proto=$(echo "$to" | awk -F'/' '{print $2}')

        if [[ "$from" =~ : ]]; then
            rule_number=$(ufw status numbered | grep '(v6)' | awk '{print $1}'| grep -o '[0-9]*' | head -n 1)
        else
            rule_number=1
        fi

        proto_arg=""
        if [ -z "$to_proto" ]; then
            proto_arg=""
        else
            proto_arg="proto $to_proto"
        fi

        ufw delete deny from ${from} to any port ${to_port} ${proto_arg}
        ufw insert $rule_number deny from ${from} to any port ${to_port} ${proto_arg}
    fi
done
ufw reload

​ 结果测试

result.png

​ 屏蔽一些扫描


## censys
ufw delete deny from  162.142.125.0/24
ufw delete deny from 167.94.138.0/24
ufw delete deny from 167.94.145.0/24
ufw delete deny from 167.94.146.0/24
ufw delete deny from  167.248.133.0/24
ufw delete deny from 2602:80d:1000:b0cc:e::/80
ufw delete deny from 2620:96:e000:b0cc:e::/80

ufw insert 1 deny from  162.142.125.0/24
ufw insert 1 deny from 167.94.138.0/24
ufw insert 1 deny from 167.94.145.0/24
ufw insert 1 deny from 167.94.146.0/24
ufw insert 1 deny from  167.248.133.0/24
ufw insert `ufw status numbered | grep '(v6)' | grep -o '[0-9]*' | head -n 1` deny from 2602:80d:1000:b0cc:e::/80
ufw insert `ufw status numbered | grep '(v6)' | grep -o '[0-9]*' | head -n 1` deny from 2620:96:e000:b0cc:e::/80

## driftnet.io

ufw delete deny from 87.236.176.0/24
ufw delete deny from 193.163.125.0/24
ufw delete deny from 68.183.53.77/24
ufw delete deny from 104.248.203.191/24
ufw delete deny from 104.248.204.195/24
ufw delete deny from 142.93.191.98/24
ufw delete deny from 157.245.216.203/24
ufw delete deny from 165.22.39.64/24
ufw delete deny from 167.99.209.184/24
ufw delete deny from 188.166.26.88/24
ufw delete deny from 206.189.7.178/24
ufw delete deny from 209.97.152.248/24
ufw delete deny from 2a06:4880::/32
ufw delete deny from 2604:a880:800:10::c4b:f000/124
ufw delete deny from 2604:a880:800:10::c51:a000/124
ufw delete deny from 2604:a880:800:10::c52:d000/124
ufw delete deny from 2604:a880:800:10::c55:5000/124
ufw delete deny from 2604:a880:800:10::c56:b000/124
ufw delete deny from 2a03:b0c0:2:d0::153e:a000/124
ufw delete deny from 2a03:b0c0:2:d0::1576:8000/124
ufw delete deny from 2a03:b0c0:2:d0::1577:7000/124
ufw delete deny from 2a03:b0c0:2:d0::1579:e000/124
ufw delete deny from 2a03:b0c0:2:d0::157c:a000/124


ufw insert 1 deny from 87.236.176.0/24
ufw insert 1 deny from 193.163.125.0/24
ufw insert 1 deny from 68.183.53.77/24
ufw insert 1 deny from 104.248.203.191/24
ufw insert 1 deny from 104.248.204.195/24
ufw insert 1 deny from 142.93.191.98/24
ufw insert 1 deny from 157.245.216.203/24
ufw insert 1 deny from 165.22.39.64/24
ufw insert 1 deny from 167.99.209.184/24
ufw insert 1 deny from 188.166.26.88/24
ufw insert 1 deny from 206.189.7.178/24
ufw insert 1 deny from 209.97.152.248/24

ufw insert `ufw status numbered | grep '(v6)' | grep -o '[0-9]*' | head -n 1` deny from 2a06:4880::/32
ufw insert `ufw status numbered | grep '(v6)' | grep -o '[0-9]*' | head -n 1` deny from 2604:a880:800:10::c4b:f000/124
ufw insert `ufw status numbered | grep '(v6)' | grep -o '[0-9]*' | head -n 1` deny from 2604:a880:800:10::c51:a000/124
ufw insert `ufw status numbered | grep '(v6)' | grep -o '[0-9]*' | head -n 1` deny from 2604:a880:800:10::c52:d000/124
ufw insert `ufw status numbered | grep '(v6)' | grep -o '[0-9]*' | head -n 1` deny from 2604:a880:800:10::c55:5000/124
ufw insert `ufw status numbered | grep '(v6)' | grep -o '[0-9]*' | head -n 1` deny from 2604:a880:800:10::c56:b000/124
ufw insert `ufw status numbered | grep '(v6)' | grep -o '[0-9]*' | head -n 1` deny from 2a03:b0c0:2:d0::153e:a000/124
ufw insert `ufw status numbered | grep '(v6)' | grep -o '[0-9]*' | head -n 1` deny from 2a03:b0c0:2:d0::1576:8000/124
ufw insert `ufw status numbered | grep '(v6)' | grep -o '[0-9]*' | head -n 1` deny from 2a03:b0c0:2:d0::1577:7000/124
ufw insert `ufw status numbered | grep '(v6)' | grep -o '[0-9]*' | head -n 1` deny from 2a03:b0c0:2:d0::1579:e000/124
ufw insert `ufw status numbered | grep '(v6)' | grep -o '[0-9]*' | head -n 1` deny from 2a03:b0c0:2:d0::157c:a000/124

The End