当前位置: 首页 > news >正文

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) 对于嵌入式系统,我们可能必须测试正在使用的软件&#xff0…...

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是一种现代的、高效的、开源的编程语言&#xff0c;由Google开发。它的语法简洁、易于学习和使用&#xff0c;支持并发编程&#xff0c;特别适合构建网络应用和分布式系统。本篇文章将介绍Go语言的基础语法和常用特性&#xff0c;帮助初学者快速入门。 一、Go语言的基础语法…...

JavaScript教程(二)

BOM浏览器对象模型 什么是BOM BOM&#xff08;Browser Object Model&#xff09;即浏览器对象模型&#xff0c;它提供了独立于内容而与浏览器窗口进行交互的对象&#xff0c;其核心对象是 window&#xff1b;BOM由一系列相关的对象构成&#xff0c;并且每个对象都提供了很多方…...

设计模式之代理模式

代理模式的定义是&#xff1a;为其他对象提供一种代理以控制对这个对象的访问。 因为代理类与服务类实现同样的接口&#xff0c;所以代理类能代替服务类提供给客户端。当客户端使用代理类时&#xff0c;代理类能对请求进行处理&#xff08;例如增加访问控制、缓存请求结果、隐…...

初识MySQL

&#x1f495;与其抱怨生活的不公&#xff0c;不如积极行动改变它。&#x1f495; &#x1f43c;作者&#xff1a;不能再留遗憾了&#x1f43c; &#x1f386;专栏&#xff1a;MySQL学习&#x1f386; &#x1f697;本文章主要内容&#xff1a;简单了解什么是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&#xff0c;并提供各种参数配置和封装的API调用方法&#xff0c;以方便用户快速实现自己的图片搜索需求。 该接口封装库将1688图片搜索API的…...

HashMap的源码分析(基于JDK1.8)

HashMap的源码分析&#xff08;基于JDK1.8&#xff09; Java中的HashMap是一种常用的数据结构&#xff0c;它是基于哈希表的数据结构&#xff0c;可以用来存储键值对。在HashMap中&#xff0c;每个键值对被称作一个Entry&#xff0c;每个Entry包含一个键和一个值。HashMap的实…...

算法能力-数据安全复合治理框架和模型解读(5)

数据治理,数据安全治理行业在发展,在实践,所以很多东西是实践出来的,哪有什么神仙理论指导,即使有也是一家之说,但为了提高企业投产比,必要的认知是必须的,落地数据安全治理科技水平差异直接决定产品和项目是否可持续性,当前和未来更需要专业和有效创新。数据安全治理…...

java从入门到起飞——基础概念

目录 背景注释和关键字注释关键字 常量变量数据类型计算存储单元数据类型分类 标识符小驼峰命名法&#xff08;方法、变量&#xff09;大驼峰命名法&#xff08;类&#xff09; 类型转换自动类型转换强制类型转换 计算机中的数据存储总结 背景 学编程这么长时间了&#xff0c;重…...

C语言判断队列满or空

1 静态数组队列 循环队列通常使用数组来实现&#xff0c;判别循环队列是否满或空&#xff0c;可以借助两个变量front和rear。 判空&#xff1a;当front和rear相等时&#xff0c;队列为空。 判满&#xff1a;当(front 1) % n rear时&#xff0c;队列为满&#xff0c;其中n为…...

LBE-LEX系列工业语音播放器|预警播报器|喇叭蜂鸣器的上位机配置操作说明

LBE-LEX系列工业语音播放器|预警播报器|喇叭蜂鸣器专为工业环境精心打造&#xff0c;完美适配AGV和无人叉车。同时&#xff0c;集成以太网与语音合成技术&#xff0c;为各类高级系统&#xff08;如MES、调度系统、库位管理、立库等&#xff09;提供高效便捷的语音交互体验。 L…...

日语AI面试高效通关秘籍:专业解读与青柚面试智能助攻

在如今就业市场竞争日益激烈的背景下&#xff0c;越来越多的求职者将目光投向了日本及中日双语岗位。但是&#xff0c;一场日语面试往往让许多人感到步履维艰。你是否也曾因为面试官抛出的“刁钻问题”而心生畏惧&#xff1f;面对生疏的日语交流环境&#xff0c;即便提前恶补了…...

【杂谈】-递归进化:人工智能的自我改进与监管挑战

递归进化&#xff1a;人工智能的自我改进与监管挑战 文章目录 递归进化&#xff1a;人工智能的自我改进与监管挑战1、自我改进型人工智能的崛起2、人工智能如何挑战人类监管&#xff1f;3、确保人工智能受控的策略4、人类在人工智能发展中的角色5、平衡自主性与控制力6、总结与…...

椭圆曲线密码学(ECC)

一、ECC算法概述 椭圆曲线密码学&#xff08;Elliptic Curve Cryptography&#xff09;是基于椭圆曲线数学理论的公钥密码系统&#xff0c;由Neal Koblitz和Victor Miller在1985年独立提出。相比RSA&#xff0c;ECC在相同安全强度下密钥更短&#xff08;256位ECC ≈ 3072位RSA…...

为什么需要建设工程项目管理?工程项目管理有哪些亮点功能?

在建筑行业&#xff0c;项目管理的重要性不言而喻。随着工程规模的扩大、技术复杂度的提升&#xff0c;传统的管理模式已经难以满足现代工程的需求。过去&#xff0c;许多企业依赖手工记录、口头沟通和分散的信息管理&#xff0c;导致效率低下、成本失控、风险频发。例如&#…...

在四层代理中还原真实客户端ngx_stream_realip_module

一、模块原理与价值 PROXY Protocol 回溯 第三方负载均衡&#xff08;如 HAProxy、AWS NLB、阿里 SLB&#xff09;发起上游连接时&#xff0c;将真实客户端 IP/Port 写入 PROXY Protocol v1/v2 头。Stream 层接收到头部后&#xff0c;ngx_stream_realip_module 从中提取原始信息…...

return this;返回的是谁

一个审批系统的示例来演示责任链模式的实现。假设公司需要处理不同金额的采购申请&#xff0c;不同级别的经理有不同的审批权限&#xff1a; // 抽象处理者&#xff1a;审批者 abstract class Approver {protected Approver successor; // 下一个处理者// 设置下一个处理者pub…...

人工智能--安全大模型训练计划:基于Fine-tuning + LLM Agent

安全大模型训练计划&#xff1a;基于Fine-tuning LLM Agent 1. 构建高质量安全数据集 目标&#xff1a;为安全大模型创建高质量、去偏、符合伦理的训练数据集&#xff0c;涵盖安全相关任务&#xff08;如有害内容检测、隐私保护、道德推理等&#xff09;。 1.1 数据收集 描…...

uniapp 小程序 学习(一)

利用Hbuilder 创建项目 运行到内置浏览器看效果 下载微信小程序 安装到Hbuilder 下载地址 &#xff1a;开发者工具默认安装 设置服务端口号 在Hbuilder中设置微信小程序 配置 找到运行设置&#xff0c;将微信开发者工具放入到Hbuilder中&#xff0c; 打开后出现 如下 bug 解…...

SQL Server 触发器调用存储过程实现发送 HTTP 请求

文章目录 需求分析解决第 1 步:前置条件,启用 OLE 自动化方式 1:使用 SQL 实现启用 OLE 自动化方式 2:Sql Server 2005启动OLE自动化方式 3:Sql Server 2008启动OLE自动化第 2 步:创建存储过程第 3 步:创建触发器扩展 - 如何调试?第 1 步:登录 SQL Server 2008第 2 步…...