iptables扩展匹配条件
文章目录
- 1. multiport模块
- 2. iprange模块
- 3. string模块
- 4. time模块
- 5. icmp模块
- 6. connlimit模块
- 7. limit模块
- 8.tcp扩展模块
- 9.state模块
- 10 Iptables自定义链
- 1.1 为什么要使用自定义链
- 1.2 创建自定义链
- 1.3 引用自定义链
- 1.4 重命名自定义链
- 1.5 删除自定义链
1. multiport模块
常用的扩展匹配条件如下:
-p tcp -m multiport –sports 用于匹配报文的源端口,可以指定离散的多个端口号,端口之间用”逗号”隔开。
-p udp -m multiport –dports 用于匹配报文的目标端口,可以指定离散的多个端口号,端口之间用”逗号”隔开。
示例:仅允许10.0.0.1访问本机:80、443、20、21、22
[root]# iptables -t filter -I INPUT -s 10.0.0.1 -d 10.0.0.5 -p tcp -m multiport --dports 20,21,22,80,443 -j ACCEPT
[root]# iptables -t filter -A INPUT -p tcp -j DROP
[root]# iptables -t filter -L -n -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
1 0 0 ACCEPT tcp -- * * 10.0.0.1 10.0.0.5 multiport dports 20,21,22,80,443
2 0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
2. iprange模块
包含的扩展匹配条件如下:
指定一段连续的ip地址范围:
--src-range from[-to]: 源地址范围Match source IP in the specified range.
--dst-range from[-to] 目标地址范围Match destination IP in the specified range.
示例:10.0.0.1-10.0.0.7 地址段都 不允许ping 10.0.0.5
[root]# iptables -t filter -I INPUT -p icmp -m iprange --src-range 10.0.0.1-10.0.0.7 -j DROP
[root]# iptables -t filter -L -n -v --line-numbers
Chain INPUT (policy ACCEPT 1 packets, 104 bytes)
num pkts bytes target prot opt in out source destination
1 0 0 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 source IP range 10.0.0.1-10.0.0.7Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 1 packets, 104 bytes)
num pkts bytes target prot opt in out source destination
3. string模块
匹配指定字符串
--string pattern # 指定要匹配的字符串Matches the given pattern.
--algo {bm|kmp} # 匹配的查询算法,可用算法为bm、kmp,此选项为必需选项。Select the pattern matching strategy. (bm = Boyer-Moore, kmp = Knuth-Pratt-Morris)
示例:应用返回的数据报文包含hello,则丢弃,其他的正常通过。
配置规则:filter、OUTPUT、[root]# iptables -t filter -F
[root]# iptables -t filter -I OUTPUT -p tcp -m string --string "hello" --algo bm -j DROP
[root]# iptables -t filter -L -n -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
1 0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 STRING match "hello" ALGO name bm TO 65535
4. time模块
根据 时间段匹配报文;
--timestart hh:mm[:ss] # 开始时间--timestop hh:mm[:ss] 结束时间Only match during the given daytime. The possible time range is 00:00:00 to 23:59:59. Leading zeroesare allowed (e.g. "06:03") and correctly interpreted as base-10.--monthdays day[,day...] # 指定一个月的某一天Only match on the given days of the month. Possible values are 1 to 31. Note that specifying 31 willof course not match on months which do not have a 31st day; the same goes for 28- or 29-day February.--weekdays day[,day...] # 指定周 还是 周天 Only match on the given weekdays. Possible values are Mon, Tue, Wed, Thu, Fri, Sat, Sun, or valuesfrom 1 to 7, respectively. You may also use two-character variants (Mo, Tu, etc.).--kerneltz 使用内核时区而且不是utc时间
示例:拒绝每天8:30(00:30)~18:00(10:00)任何主机发送icmp请求协议;
[root]# iptables -t filter -I INPUT -p icmp -m time --timestart 00:30 --timestop 10:30 -j DROP
[root]# iptables -t filter -L -n -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
1 0 0 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 TIME from 00:30:00 to 10:30:00 UTCChain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
5. icmp模块
针对的协议:ICMP,用来检查 ICMP 数据包的类型
[!] --icmp-type {type[/code]|typename} ICMP 类型使用字符串或数字显示echo-request (8) (ICMP 协议请求)echo-reply (0) (ICMP 协议回显)destination-unreachable:(3)(ICMP 协议目标不可达)
比方说:若要禁止从其他主机 ping 本机,但是允许本机 ping 其他主机。
# iptables -A INPUT -p icmp --icmp-type 8 -j DROP
# iptables -A INPUT -p icmp --icmp-type 0 -j ACCEPT
# iptables -A INPUT -p icmp --icmp-type 3 -j ACCEPT
# iptables -A INPUT -p icmp -j DROP或者
#iptables -t filter -I INPUT -p icmp --icmp-type "echo-request" -j DROP
root@kaka-virtual-machine:/home/kaka# iptables -t filter -L -n -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
1 0 0 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 8
2 0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 0
3 0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 3
4 0 0 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
6. connlimit模块
connlimit 模块是对连接数量进行限制的
并发连接数:
--connlimit-upto n # 如果现有连接数小于或等于 n 则 匹配Match if the number of existing connections is below or equal n.--connlimit-above n # 如果现有连接数大于n 则匹配Match if the number of existing connections is above n.
限制:每个客户端主机允许两个telnet连接
[root]# iptables -t filter -I INPUT -p tcp --dport 23 -m connlimit --connlimit-above 2 -j REJECT
root@kaka-virtual-machine:/home/kaka# iptables -t filter -L -n -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
1 0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:23 #conn src/32 > 2 reject-with icmp-port-unreachableChain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
7. limit模块
limit 模块是对”报文到达速率”进行限制的。就是想要限制单位时间内流入的包的数量,就能用 limit 模块。可以以秒为单位进行限制,也可以以分钟、小时、天作为单位进行限制。常用的扩展匹配条件如下:
–limit rate[/second|/minute|/hour|/day]
Maximum average matching rate: specified as a number, with an optional /second', /minute’, /hour', or /day’ suffix; the default is 3/hour.
--limit-burst numberMaximum initial number of packets to match: this number gets recharged by one every time the limitspecified above is not reached, up to this number; the default is 5.
1.限制每分钟接收10个icmp的数据报文,
[root@lb01 ~]# iptables -t filter -I INPUT -p icmp -m limit --limit 10/minute -j ACCEPT
[root@lb01 ~]# iptables -t filter -A INPUT -p icmp -j DROP
root@kaka-virtual-machine:/home/kaka# iptables -t filter -L -n -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
1 1 104 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 limit: avg 10/min burst 5
2 0 0 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
2.允许10个数据报文快速通过,超过的数据报文 1/m
[root@lb01 ~]# iptables -t filter -I INPUT -p icmp -m limit --limit 1/m --limit-burst 10 -j ACCEPT
[root@lb01 ~]# iptables -t filter -A INPUT -j DROP
root@kaka-virtual-machine:/home/kaka# iptables -t filter -L -n -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
1 0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 limit: avg 1/min burst 10
2 0 0 DROP all -- * * 0.0.0.0/0 0.0.0.0/0 Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
3.限速:限制传输的带宽不可以超过500k
500 * 1000 = 500000 /1500 = 333 包
[root@lb01 ~]# iptables -t filter -I OUTPUT -p tcp -m limit --limit 300/s -j ACCEPT
[root@lb01 ~]# iptables -t filter -A OUTPUT -p tcp -j DROP
root@kaka-virtual-machine:/home/kaka# iptables -t filter -L -n -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
1 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 limit: avg 303/sec burst 5
2 0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0
8.tcp扩展模块
常用的扩展匹配条件如下:
–sport: 用于匹配 tcp 协议报文的源端口,可以使用冒号指定一个连续的端口范围。
–dport: 用于匹配 tcp 协议报文的目标端口,可以使用冒号指定一个连续的端口范围。
–tcp-flags: 用于匹配报文的tcp头的标志位。
–syn: 用于匹配 tcp 新建连接的请求报文,相当于使用 –tcp-flags SYN,RST,ACK,FIN SYN。注意,-p tcp与 -m tcp 并不冲突,-p 用于匹配报文的协议,-m 用于指定扩展模块的名称,这个扩展模块也叫 tcp。
示例如下
iptables -t filter -I OUTPUT -d 192.168.1.146 -p tcp -m tcp --sport 22 -j REJECT
iptables -t filter -I INPUT -s 192.168.1.146 -p tcp -m tcp --dport 22:25 -j REJECT
iptables -t filter -I INPUT -s 192.168.1.146 -p tcp -m tcp --dport :22 -j REJECT
iptables -t filter -I INPUT -s 192.168.1.146 -p tcp -m tcp --dport 80: -j REJECT
iptables -t filter -I OUTPUT -d 192.168.1.146 -p tcp -m tcp ! --sport 22 -j ACCEPTiptables -t filter -I INPUT -p tcp -m tcp --dport 22 --tcp-flags SYN,ACK,FIN,RST,URG,PSH SYN -j REJECT
iptables -t filter -I OUTPUT -p tcp -m tcp --sport 22 --tcp-flags SYN,ACK,FIN,RST,URG,PSH SYN,ACK -j REJECT
iptables -t filter -I INPUT -p tcp -m tcp --dport 22 --tcp-flags ALL SYN -j REJECT
iptables -t filter -I OUTPUT -p tcp -m tcp --sport 22 --tcp-flags ALL SYN,ACK -j REJECT
iptables -t filter -I INPUT -p tcp -m tcp --dport 22 --syn -j REJECT
只有客户端能主动连接服务器22端口示例
三次握手过程客户端 --》 服务端22 端口, 客户端 ---》 syn = 1服务端 ---》 syn ack = 1客户端 --》 ack = 1服务端配置INPUT:syn =1ack =1OUTPUT:syn,ack = 1ack = 1
服务器输入
[root@lb01 ~]# iptables -t filter -I INPUT -p tcp -m tcp --dport 22 --tcp-flags SYN,ACK,FIN,RST SYN -j ACCEPT
[root@lb01 ~]# iptables -t filter -I INPUT -p tcp -m tcp --dport 22 --tcp-flags SYN,ACK,FIN,RST ACK -j ACCEPT
[root@lb01 ~]# iptables -t filter -A INPUT -j DROP服务端输出
[root@lb01 ~]# iptables -t filter -I OUTPUT -p tcp --sport 22 -m tcp --tcp-flags SYN,ACK,FIN,RST SYN,ACK -j ACCEPT
[root@lb01 ~]# iptables -t filter -I OUTPUT -p tcp --sport 22 -m tcp --tcp-flags SYN,ACK,FIN,RST ACK -j ACCEPT
[root@lb01 ~]#
[root@lb01 ~]# iptables -t filter -A OUTPUT -j DROP
root@kaka-virtual-machine:/home/kaka# iptables -t filter -L -n -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
1 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 flags:0x17/0x10
2 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 flags:0x17/0x02
3 0 0 DROP all -- * * 0.0.0.0/0 0.0.0.0/0 Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
1 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:22 tcp flags:0x17/0x10
2 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:22 tcp flags:0x17/0x12
3 0 0 DROP all -- * * 0.0.0.0/0 0.0.0.0/0
9.state模块
conntrack 连接追踪,对于 state 模块的连接而言,”连接”其中的报文可以分为5种状态,分别为:
- NEW:连接中的第一个包,状态就是 NEW,我们可以理解为新连接的第一个包的状态为 NEW。
- ESTABLISHED:我们可以把 NEW 状态包后面的包的状态理解为 ESTABLISHED,表示连接已建立。
- RELATED:从字面上理解 RELATED 译为关系,但是这样仍然不容易理解,我们举个例子。比如 FTP 服务,FTP 服务端会建立两个进程,一个命令进程,一个数据进程。命令进程负责服务端与客户端之间的命令传输(我们可以把这个传输过程理解成 state 中所谓的一个”连接”,暂称为”命令连接”)。数据进程负责服务端与客户端之间的数据传输 (我们把这个过程暂称为”数据连接”)。但是具体传输哪些数据,是由命令去控制的,所以,”数据连接”中的报文与”命令连接”有”关系”的。那么,”数据连接”中的报文可能就是 RELATED 状态,因为这些报文与”命令连接”中的报文有关系。(注:如果想要对ftp进行连接追踪,需要单独加载对应的内核模块 nf_conntrack_ftp,如果想要自动加载,可以配置 /etc/sysconfig/iptables-config 文件)
- INVALID:如果一个包没有办法被识别,或者这个包没有任何状态,那么这个包的状态就是 INVALID,可以主动屏蔽状态为 INVALID 的报文。
- UNTRACKED:报文的状态为 untracked 时,表示报文未被追踪,当报文的状态为 Untracked 时通常表示无法找到相关的连接。
示例:允许接收 远程主机的ssh和http请求(NEW,ESTABLISHED),回应仅允许本机回应ssh、http的响应是 (ESABLISHED),
[root]# iptables -I INPUT -p tcp -m multiport --dport 22,80 -m state --state NEW,ESTABLISHED -j ACCEPT
[root]# iptables -I OUTPUT -p tcp -m multiport --sport 22,80 -m state --state ESTABLISHED -j ACCEPT[root]# iptables -A INPUT -j DROP
[root]# iptables -A OUTPUT -j DROP
root@kaka-virtual-machine:/home/kaka# iptables -t filter -L -n -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
1 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 multiport dports 22,80 state NEW,ESTABLISHED
2 0 0 DROP all -- * * 0.0.0.0/0 0.0.0.0/0 Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
1 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 multiport sports 22,80 state ESTABLISHED
2 0 0 DROP all -- * * 0.0.0.0/0 0.0.0.0/0
10 Iptables自定义链
1.1 为什么要使用自定义链
-
当默认链中的规则非常多时,不方便我们管理。想象一下,如果 INPUT 链中存放了 200 条规则,这 200 条规则有针对 httpd 服务的,有针对 sshd 服务的,有针对私网 IP 的,有针对公网 IP 的,假如,突然想要修改针对 httpd 服务的相关规则,难道还要从头看一遍这 200 条规则,找出哪些规则是针对 httpd 的吗?这显然不合理。
-
所以,iptables 中,可以自定义链,通过自定义链即可解决上述问题。假设,自定义一条链,链名叫 IN_WEB,可以将所有针对 80 端口的入站规则都写入到这条自定义链中,当以后想要修改针对 web 服务的入站规则时,就直接修改 IN_WEB 链中的规则就好了,即使默认链中有再多的规则,也不会害怕了,因为所有针对 80 端口的入站规则都存放在IN_WEB链中。
1.2 创建自定义链
#在filter表中创建IN_WEB自定义链
iptables -t filter -N IN_WEB
root@kaka-virtual-machine:/home/kaka# iptables -t filter -L -n -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination Chain IN_WEB (0 references)
num pkts bytes target prot opt in out source destination
1.3 引用自定义链
#在INPUT链中引用刚才创建的自定义链
iptables -t filter -I INPUT -p tcp --dport 80 -j IN_WEB
iptables -t filter -L -n
root@kaka-virtual-machine:/home/kaka# iptables -t filter -L -n -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
1 0 0 IN_WEB tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination Chain IN_WEB (1 references)
1.4 重命名自定义链
#将IN_WEB自定义链重命名为WEB
iptables -E IN_WEB WEB
root@kaka-virtual-machine:/home/kaka# iptables -t filter -L -n -v --line-numbers
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
1 0 0 WEB tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination Chain WEB (1 references)
num pkts bytes target prot opt in out source destination
1.5 删除自定义链
删除自定义链需要满足两个条件:
- 自定义链没有被引用。
- 自定义链中没有任何规则。
#第一步:清除自定义链中的规则
iptables -t filter -F WEB
iptables -t filter -F
#第二步:删除自定义链
iptables -t filter -X WEB
相关文章:
iptables扩展匹配条件
文章目录 1. multiport模块2. iprange模块3. string模块4. time模块5. icmp模块6. connlimit模块7. limit模块8.tcp扩展模块9.state模块10 Iptables自定义链1.1 为什么要使用自定义链1.2 创建自定义链1.3 引用自定义链1.4 重命名自定义链1.5 删除自定义链 1. multiport模块 常…...
直播录音时准备一副监听耳机,实现所听即所得,丁一号G800S上手
有些朋友在录视频还有开在线会议的时候,都会遇到一个奇怪的问题,就是自己用麦克风收音的时候,自己的耳机和别人的耳机听到的效果不一样,像是音色、清晰度不好,或者是缺少伴奏以及背景音嘈杂等,这时候我们就…...
回归测试最小化(贪心算法,帕累托支配)
回归测试最小化(贪心算法,帕累托支配) 介绍 有时我们不能只是重新运行我们的测试(例如,当我们 换界面)。 回归测试可能很昂贵: (1)一些公司通宵运行回归测试套件。 (2) 对于嵌入式系统,我们可能必须测试正在使用的软件࿰…...
Python系列模块之标准库shutil详解
感谢点赞和关注 ,每天进步一点点!加油! 目录 一、shutil介绍 二 、使用详解 2.1 复制函数 2.1.1 shutil.copy 2.1.2 shutil.copy2 2.1.3 shutil.copyfile 2.1.4 shutil.copytree 2.2 移动文件 2.2.1 shutil.move 2.3 删除文件 2.3…...
pb如何播放Flash
---- Flash动画不仅包含动画,还可有声音、超文本连接,同时由于它是矢量格式文件,生成的这种包含动画、声音等的文件(*.swf)很小,非常适 合在网络上传输使用,因而在当前Web网页技术中得到很快发展。本文讨论在PowerBuilder6.5数据库编程中用Flash4提供的控件"Swflas…...
独立成分分析ICA
独立成分分析 ICA 1. 算法原理简介2.源信号与混合信号的差异2.1 独立性 Independence2.2 高斯性 Normality2.3 复杂性 Complexity 3.非高斯性的度量3.1 峭度 Kurtosis 参考文献 blind source separation (BSS) 1. 算法原理简介 mixing得到signal mixture过程: x 1…...
从零开始之如何在React Native中使用导航
好的,让我们开始学习如何在React Native中使用导航。 安装React Navigation 首先,你需要安装React Navigation库。在项目文件夹中打开终端窗口,并运行以下命令: npm install react-navigation/native 或者 yarn add react-nav…...
RAW、RGB 、YUV三种图像格式理解
文章目录 1. 背景2. 相关概念2.1 颜色与色彩空间2.2 RAW图像2.3 RGB图像2.4 YUV图像 3. 分类简图 RAW、RGB 、YUV三种图像格式理解 1. 背景 在工作中,经常听到用来描述图像格式的RAW,RGB与YUV,但一直没有系统的进行了解,处于局部认…...
关于对【mysql存储过程】的理解与简述
【版权声明】未经博主同意,谢绝转载!(请尊重原创,博主保留追究权) https://blog.csdn.net/m0_69908381/article/details/130857854 出自【进步*于辰的博客】 【存储过程】这个知识点,我在大二下期学习【mys…...
贪吃蛇游戏的制作记录
关于蛇的实现代码 #include "snake.h" #include "globalvar.h" #include <graphics.h> int fangXiang 1;//方向 0 右 1 上 2 左 3 下 int snakeHang[100] { 10,11,12,13,14 };//蛇 每节所在行 int snakeLie[100] { 10,10,10,10,10 };//蛇 每节所…...
Go基础入门
Go是一种现代的、高效的、开源的编程语言,由Google开发。它的语法简洁、易于学习和使用,支持并发编程,特别适合构建网络应用和分布式系统。本篇文章将介绍Go语言的基础语法和常用特性,帮助初学者快速入门。 一、Go语言的基础语法…...
JavaScript教程(二)
BOM浏览器对象模型 什么是BOM BOM(Browser Object Model)即浏览器对象模型,它提供了独立于内容而与浏览器窗口进行交互的对象,其核心对象是 window;BOM由一系列相关的对象构成,并且每个对象都提供了很多方…...
设计模式之代理模式
代理模式的定义是:为其他对象提供一种代理以控制对这个对象的访问。 因为代理类与服务类实现同样的接口,所以代理类能代替服务类提供给客户端。当客户端使用代理类时,代理类能对请求进行处理(例如增加访问控制、缓存请求结果、隐…...
初识MySQL
💕与其抱怨生活的不公,不如积极行动改变它。💕 🐼作者:不能再留遗憾了🐼 🎆专栏:MySQL学习🎆 🚗本文章主要内容:简单了解什么是MySQL、MySQL的发展…...
内网渗透(八十五)之ADCS证书服务攻击
ADCS证书服务攻击 漏洞背景 2021年6月17日,国外安全研究员 Will Schroeder 和 Lee Christensen 共同发布了针对ADCS(Active Directory Certificate Service, 活动目录证书服务)的攻击手法。同年8月5日,在Black Hat 2021上 Will Schroeder 和 Lee CHristensen 对该攻击手法进…...
通过python封装1688图片搜索商品数据接口,拍立淘API接口
1688图片搜索API封装接口是一个可以帮助用户快速使用1688图片搜索API的接口封装库。该接口封装库可以帮助用户快速引入1688图片搜索API,并提供各种参数配置和封装的API调用方法,以方便用户快速实现自己的图片搜索需求。 该接口封装库将1688图片搜索API的…...
HashMap的源码分析(基于JDK1.8)
HashMap的源码分析(基于JDK1.8) Java中的HashMap是一种常用的数据结构,它是基于哈希表的数据结构,可以用来存储键值对。在HashMap中,每个键值对被称作一个Entry,每个Entry包含一个键和一个值。HashMap的实…...
算法能力-数据安全复合治理框架和模型解读(5)
数据治理,数据安全治理行业在发展,在实践,所以很多东西是实践出来的,哪有什么神仙理论指导,即使有也是一家之说,但为了提高企业投产比,必要的认知是必须的,落地数据安全治理科技水平差异直接决定产品和项目是否可持续性,当前和未来更需要专业和有效创新。数据安全治理…...
java从入门到起飞——基础概念
目录 背景注释和关键字注释关键字 常量变量数据类型计算存储单元数据类型分类 标识符小驼峰命名法(方法、变量)大驼峰命名法(类) 类型转换自动类型转换强制类型转换 计算机中的数据存储总结 背景 学编程这么长时间了,重…...
C语言判断队列满or空
1 静态数组队列 循环队列通常使用数组来实现,判别循环队列是否满或空,可以借助两个变量front和rear。 判空:当front和rear相等时,队列为空。 判满:当(front 1) % n rear时,队列为满,其中n为…...
【Python】 -- 趣味代码 - 小恐龙游戏
文章目录 文章目录 00 小恐龙游戏程序设计框架代码结构和功能游戏流程总结01 小恐龙游戏程序设计02 百度网盘地址00 小恐龙游戏程序设计框架 这段代码是一个基于 Pygame 的简易跑酷游戏的完整实现,玩家控制一个角色(龙)躲避障碍物(仙人掌和乌鸦)。以下是代码的详细介绍:…...
利用ngx_stream_return_module构建简易 TCP/UDP 响应网关
一、模块概述 ngx_stream_return_module 提供了一个极简的指令: return <value>;在收到客户端连接后,立即将 <value> 写回并关闭连接。<value> 支持内嵌文本和内置变量(如 $time_iso8601、$remote_addr 等)&a…...
DeepSeek 赋能智慧能源:微电网优化调度的智能革新路径
目录 一、智慧能源微电网优化调度概述1.1 智慧能源微电网概念1.2 优化调度的重要性1.3 目前面临的挑战 二、DeepSeek 技术探秘2.1 DeepSeek 技术原理2.2 DeepSeek 独特优势2.3 DeepSeek 在 AI 领域地位 三、DeepSeek 在微电网优化调度中的应用剖析3.1 数据处理与分析3.2 预测与…...
【人工智能】神经网络的优化器optimizer(二):Adagrad自适应学习率优化器
一.自适应梯度算法Adagrad概述 Adagrad(Adaptive Gradient Algorithm)是一种自适应学习率的优化算法,由Duchi等人在2011年提出。其核心思想是针对不同参数自动调整学习率,适合处理稀疏数据和不同参数梯度差异较大的场景。Adagrad通…...
【ROS】Nav2源码之nav2_behavior_tree-行为树节点列表
1、行为树节点分类 在 Nav2(Navigation2)的行为树框架中,行为树节点插件按照功能分为 Action(动作节点)、Condition(条件节点)、Control(控制节点) 和 Decorator(装饰节点) 四类。 1.1 动作节点 Action 执行具体的机器人操作或任务,直接与硬件、传感器或外部系统…...
MySQL 8.0 OCP 英文题库解析(十三)
Oracle 为庆祝 MySQL 30 周年,截止到 2025.07.31 之前。所有人均可以免费考取原价245美元的MySQL OCP 认证。 从今天开始,将英文题库免费公布出来,并进行解析,帮助大家在一个月之内轻松通过OCP认证。 本期公布试题111~120 试题1…...
Springboot社区养老保险系统小程序
一、前言 随着我国经济迅速发展,人们对手机的需求越来越大,各种手机软件也都在被广泛应用,但是对于手机进行数据信息管理,对于手机的各种软件也是备受用户的喜爱,社区养老保险系统小程序被用户普遍使用,为方…...
A2A JS SDK 完整教程:快速入门指南
目录 什么是 A2A JS SDK?A2A JS 安装与设置A2A JS 核心概念创建你的第一个 A2A JS 代理A2A JS 服务端开发A2A JS 客户端使用A2A JS 高级特性A2A JS 最佳实践A2A JS 故障排除 什么是 A2A JS SDK? A2A JS SDK 是一个专为 JavaScript/TypeScript 开发者设计的强大库ÿ…...
GitFlow 工作模式(详解)
今天再学项目的过程中遇到使用gitflow模式管理代码,因此进行学习并且发布关于gitflow的一些思考 Git与GitFlow模式 我们在写代码的时候通常会进行网上保存,无论是github还是gittee,都是一种基于git去保存代码的形式,这样保存代码…...
Kubernetes 网络模型深度解析:Pod IP 与 Service 的负载均衡机制,Service到底是什么?
Pod IP 的本质与特性 Pod IP 的定位 纯端点地址:Pod IP 是分配给 Pod 网络命名空间的真实 IP 地址(如 10.244.1.2)无特殊名称:在 Kubernetes 中,它通常被称为 “Pod IP” 或 “容器 IP”生命周期:与 Pod …...
