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

【蓝队技能】【规则开发1】Suricata-C2Webshell隧道

蓝队技能


Suricata-C2&Webshell&隧道

  • 蓝队技能
  • 总结
  • 前言
  • 一、C2规则开发
      • 1.1 Sliver
      • 1.2 CS
  • 二、内网隧道
      • 1.1 frps
      • 1.2 nps
  • 三、webshell
      • 3.1 蚁剑
      • 3.2 冰蝎
      • 3.3 哥斯拉

总结

在这里插入图片描述


前言

本文聚焦于Suricata规则开发,提供针对Sliver、Cobalt Strike(CS)等C2框架,以及蚁剑、冰蝎、哥斯拉等Webshell工具的检测规则。同时,我们还将涵盖FRP和NPS等内网隧道工具的检测策略。通过运用这些规则,安全团队能够更有效地识别并响应潜在的安全威胁,保障网络环境的安全稳定。


一、C2规则开发

1.1 Sliver

alert tcp any any -> any any (msg: "Sliver HTTP woff request"; flow:to_server,established;content:".woff";http_uri;pcre: "/\/(static|assets|fonts|locales)(.*?)((attribute_text_w01_regular|ZillaSlab-Regular\.subset\.bbc33fb47cf6|ZillaSlab-Bold\.subset\.e96c15f68c68|Inter-Regular|Inter-Medium)\.woff)\?[a-z_]{1,2}=[a-z0-9_]{1,10}/i";sid:1000001;classtype:trojan-activity; rev:1;)
alert tcp any any -> any any (msg: "Sliver HTTP js request"; flow:to_server,established;content:"GET";http_method;nocase;content:".js";http_uri;pcre: "/\/(js|umd|assets|bundle|bundles|scripts|script|javascripts|javascript|jscript)(.*?)((bootstrap|bootstrap.min|jquery.min|jquery|route|app|app.min|array|backbone|script|email)\.js)\?[a-z_]{1,2}=[a-z0-9_]{1,10}/i";sid:1000002;classtype:trojan-activity; rev:1;)
alert tcp any any -> any any (msg: "Sliver HTTP html request&getsessionID"; flow:to_server,established;content:"POST";http_method;nocase;content:".html";http_uri;pcre: "/\/(php|api|upload|actions|rest|v1|oauth2callback|authenticate|oauth2|oauth|auth|database|db|namespaces)(.*?)((login|signin|api|samples|rpc|index|admin|register|sign-up)\.html)\?[a-z_]{1,2}=[a-z0-9_]{1,10}/i";sid:1000003;flowbits:set,name;flowbits:noalert;classtype:trojan-activity; rev:1;)
alert tcp any any <> any any (msg: "Sliver HTTP html response&set-cookie";flow:to_client,established;content:"Set-Cookie";http_header;pcre:"/^Set-Cookie\:\s*(PHPSESSID|SID|SSID|APISID|csrf-state|AWSALBCORS)\=[a-z0-9]{32}\;\s*HttpOnly$/i";sid:1000004;flowbits:isset,name;classtype:trojan-activity;)
alert tcp any any -> any any (msg: "Sliver HTTP php request"; flow:to_server,established;content:"POST";http_method;nocase;content:".php";http_uri;pcre: "/\/(php|api|upload|actions|rest|v1|oauth2callback|authenticate|oauth2|oauth|auth|database|db|namespaces)(.*?)((login|signin|api|samples|rpc|index|admin|register|sign-up)\.php)\?[a-z_]{1,2}=[a-z0-9_]{1,10}/i";sid:1000005;classtype:trojan-activity; rev:1;)
alert tcp any any -> any any (msg: "Sliver HTTP png request"; flow:to_server,established;content:".png";http_uri;pcre: "/\/(static|www|assets|images|icons|image|icon|png)(.*?)((favicon|sample|example)\.png)\?[a-z_]{1,2}=[a-z0-9_]{1,10}/i";sid:1000006;classtype:trojan-activity; rev:1;)
alert tls any any -> any any (msg:"sliver https debian"; ja3.hash; content:"19e29534fd49dd27d09234e639c4057e"; classtype:misc-activity; sid:1001; rev:1;)
alert tls any any -> any any (msg:"sliver https"; ja3.hash; content:"f4febc55ea12b31ae17cfb7e614afda8"; sid:1002;)

如下解释如何使用Suricata进行规则开发 Suricata下载

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述



1. suricata.exe :运行文件名称
2. -c suricata.yaml :加载的配置文件
3. -s sliver.rules :验证的规则
4. -i 192.168.189.152 :监听的网卡

后面运行sliver并执行命令,不会的看我前几篇文章即可

在这里插入图片描述

1.2 CS

1. 修改suricata.yaml配置文件:
在这里插入图片描述
在这里插入图片描述
2. lua_script文件夹中创建checksum8_check.lua文件,并写入如下内容:
在这里插入图片描述

# java代理换算成lua代码
-- 定义函数来计算checksum8  
function checksum8(text)  if #text < 4 then  return 0  end  -- 移除字符串中的'/'字符  text = text:gsub("/", "")  local sum = 0  for x = 1, #text do  sum = sum + string.byte(text, x)  end  return sum % 256  
end  -- 主程序  
print(checksum8("Yle2"))

3. cs.rules文件内容:

alert http any any -> any any (gid:3333; sid:30001; rev:1; \msg:"http-beacon-checksum8-path-parse"; \classtype: http-beacon; \flow: established, to_server; \urilen:4<>6; \luajit:checksum8_check.lua; \
)# http-beacon上线/心跳请求,匹配敏感路径
alert http any any -> any any (gid:3333; sid:30003; rev:1; \msg:"http-beacon-get-data"; \classtype: http-beacon; \flow:to_server; \http.method; content:"GET"; \http.accept; content:"*/*"; \http.uri; pcre:"/\/ca|\/dpixel|\/__utm.gif|\/pixel.gif|\/g.pixel|\/dot.gif|\/updates.rss|\/fwlink|\/cm|\/cx|\/pixel|\/match|\/visit.js|\/load|\/push|\/ptj|\/j.ad|\/ga.js|\/en_US\/all.js|\/activity|\/IE9CompatViewList.xml/"; \http.user_agent; pcre:"/Mozilla\/5.0 \(compatible/"; \
)# http-beacon执行完下发的命令后,通过post方式向c2服务器发起数据回传请求
alert http any any -> any any (gid:3333; sid:30004; rev:1; \msg:"http-beacon-post-data"; \classtype: http-beacon; \flow:to_server; \http.method; content:"POST"; \http.uri; content:"/submit.php?id="; \http.accept; content:"*/*"; \http.content_type; content:"application/octet-stream"; \http.connection; content:"keep-alive"; nocase; \http.request_body; content:"|00 00 00|"; startswith; \
)# https-beacon-ja3指纹,client-hello
alert tls any any -> any any (gid:6666; sid:30005; rev:1; \msg:"https-beacon-ja3-hash"; \classtype: https-beacon; \ja3.hash; pcre:"/72a589da586844d7f0818ce684948eea|652358a663590cfc624787f06b82d9ae|4d93395b1c1b9ad28122fb4d09f28c5e|a0e9f5d64349fb13191bc781f81f42e1/"; \
)# https-beacon-ja3s指纹,server-hello
alert tls any any -> any any (gid:6666; sid:30006; rev:1; \msg:"https-beacon-ja3s-hash"; \classtype: https-beacon; \ja3s.hash; pcre:"/fd4bc6cea4877646ccd62f0792ec0b62|b742b407517bac9536a77a7b0fee28e9/"; \
)# https-beacon-cert指纹,subject、cert_issuer,默认为空
alert tls any any -> any any (gid:6666; sid:30007; rev:1; \msg:"https-beacon-tls-cert-issuer"; \classtype: https-beacon; \tls.cert_subject; content:"C=, ST=, L=, O=, OU=, CN="; nocase; \tls.cert_issuer; content:"C=, ST=, L=, O=, OU=, CN="; nocase; \tls_cert_notbefore:2015-05-20T18:26:24; \tls_cert_notafter:2025-05-17T18:26:24; \
)# https-beacon-cert指纹,fingerprint
alert tls any any -> any any (gid:6666; sid:30008; rev:1; \msg:"https-beacon-tls-cert-fingerprint"; \classtype: https-beacon; \tls.cert_fingerprint; content:"6e:ce:5e:ce:41:92:68:3d:2d:84:e2:5b:0b:a7:e0:4f:9c:b7:eb:7c" ;\
)# https-beacon-cert指纹,serialNumber
alert tls any any -> any any (gid:6666; sid:30009; rev:1; \msg:"https-beacon-tls-cert-fingerprint"; \classtype: https-beacon; \tls.cert_serial; content:"08:BB:00:EE"; \
)# dns-beacon,匹配dns-beacon发起上线/心跳请求后,c2服务器的返回包
# Type: A, Class: IN, 0.0.0.0
alert dns any any -> any any (gid:9999; sid:30010; rev:1; \msg:"dns-beacon-live-response"; \classtype: dns-beacon; \content:"|00 01 00 01 00 00 00|"; \content:"|00 00 00 00|"; endswith; \
)# dns-beacon,匹配dns-beacon发起上线/心跳请求后,c2服务器的返回包,选择后续使用A记录
# Type: A, Class: IN, 0.0.0.241
alert dns any any -> any any (gid:9999; sid:30011; rev:1; \msg:"dns-beacon-live-response"; \classtype: dns-beacon; \content:"|00 01 00 01 00 00 00|"; \content:"|00 00 00 f1|"; nocase; endswith; \
)# dns-beacon,匹配dns-beacon发起上线/心跳请求后,c2服务器的返回包,选择后续使用TXT记录
# Type: A, Class: IN, 0.0.0.243
alert dns any any -> any any (gid:9999; sid:30012; rev:1; \msg:"dns-beacon-live-response"; \classtype: dns-beacon; \content:"|00 01 00 01 00 00 00|"; \content:"|00 00 00 f3|"; nocase; endswith; \
)# dns-beacon,匹配dns-beacon发起上线/心跳请求后,c2服务器的返回包,选择后续使用AAAA记录
# Type: A, Class: IN, 0.0.0.245
alert dns any any -> any any (gid:9999; sid:30013; rev:1; \msg:"dns-beacon-live-response"; \classtype: dns-beacon; \content:"|00 01 00 01 00 00 00|"; \content:"|00 00 00 f5|"; nocase; endswith; \
)# dns-beacon,匹配dns-beacon发起元数据提交请求后,c2服务器的确认返回包
# 以www开头0.0.0.0结尾的A记录查询返回包
# Type: A, Class: IN, 0.0.0.0
alert udp any any -> any any (gid:9999; sid:30014; rev:1; \msg:"dns-beacon-metadata-response"; \classtype: dns-beacon; \flow:to_client; \content:"www"; \content:"|00 01 00 01 00 00 00|"; \content:"|00 00 00 00|"; nocase; endswith; \
)# dns-beacon,匹配dns-beacon使用AAAA、TXT方式向c2服务器发起payload下载请求后,c2服务器的返回包
# www6 ==> AAAA 、api ==> TXT 
# Type: A, Class: IN, 0.0.0.80
alert udp any any -> any any (gid:9999; sid:30015; rev:1; \msg:"dns-beacon-getpayload-response"; \classtype: dns-beacon; \flow:to_client; \pcre:"/www6|api/"; \content:"|00 01 00 01 00 00 00|"; \content:"|00 00 00 50|"; endswith; \
)# dns-beacon,匹配dns-beacon使用A方式向c2服务器发起payload下载请求后,c2服务器的返回包
# cdn ==> A
# Type: A, Class: IN, 0.0.0.64
alert udp any any -> any any (gid:9999; sid:30016; rev:1; \msg:"dns-beacon-getpayload-response"; \classtype: dns-beacon; \flow:to_client; \pcre:"/cdn/"; \content:"|00 01 00 01 00 00 00|"; \content:"|00 00 00 40|"; endswith; \
)# dns-beacon,匹配dns-beacon使用执行完payload后,向c2服务器执行结果数据,c2服务器的返回包
# post ==> put_output
# Type: A, Class: IN, 0.0.0.00
alert udp any any -> any any (gid:9999; sid:30017; rev:1; \msg:"dns-beacon-output-response"; \classtype: dns-beacon; \flow:to_client; \content:"post"; \content:"|00 01 00 01 00 00 00|"; \content:"|00 00 00 00|"; nocase; endswith; \
)

二、内网隧道

按照和C2相似的操作(监听流量 -> 工具运行)

1.1 frps

alert tcp any any -> any any (msg:"frp find"; content:"{\"version\":\""; pcre:"/\"version\":\"0\.\d{2}\.\d{1}\"/"; nocase; sid:1000042; rev:1;)alert tcp any any -> any any (msg:"frp find"; content:"{\"run_id\":\""; nocase; sid:1000044; rev:1;)

1.2 nps

alert tcp any any -> any any (msg:"nps find"; content:"sucs"; nocase; sid:1000053; rev:1;)

三、webshell

3.1 蚁剑

alert http any any -> $HOME_NET any (msg:"antSword find"; content:"User-Agent|3a| antSword/v2.1"; http_header; sid:1000009; rev:1;)

3.2 冰蝎

alert http any any -> $HOME_NET any (msg:"behinder find"; content:"Accept:"; http_header; content:"text/html"; http_header; content:"application/xhtml+xml"; http_header; content:"application/xml"; http_header; content:"q=0.9"; http_header; content:"image/webp"; http_header; content:"image/apng"; http_header; content:"*/*"; http_header; content:"q=0.8"; http_header; content:"application/signed-exchange"; http_header; content:"v=b3"; http_header; content:"Accept-Language: zh-CN"; http_header; content:"q=0.9"; http_header; content:"en-US"; http_header; content:"q=0.8"; http_header; sid:1000047; rev:3;)

3.3 哥斯拉

alert http any any -> $HOME_NET any (msg:"godzilla find"; content:"Accept:"; http_header; content:"text/html"; http_header; content:"application/xhtml+xml"; http_header; content:"application/xml"; http_header; content:"q=0.9"; http_header; content:"image/webp"; http_header; content:"*/*"; http_header; content:"q=0.8"; http_header; sid:1000099; rev:1;)

相关文章:

【蓝队技能】【规则开发1】Suricata-C2Webshell隧道

蓝队技能 Suricata-C2&Webshell&隧道 蓝队技能总结前言一、C2规则开发1.1 Sliver1.2 CS 二、内网隧道1.1 frps1.2 nps 三、webshell3.1 蚁剑3.2 冰蝎3.3 哥斯拉 总结 前言 本文聚焦于Suricata规则开发&#xff0c;提供针对Sliver、Cobalt Strike&#xff08;CS&#xf…...

全面了解 NGINX 的负载均衡算法

NGINX 提供多种负载均衡方法&#xff0c;以应对不同的流量分发需求。常用的算法包括&#xff1a;最少连接、最短时间、通用哈希、随机算法和 IP 哈希。这些负载均衡算法都通过独立指令来定义&#xff0c;每种算法都有其独特的应用场景。 以下负载均衡方法&#xff08;IP 哈希除…...

Java-继承与多态-上篇

关于类与对象&#xff0c;内容较多&#xff0c;我们分为两篇进行讲解&#xff1a; &#x1f4da; Java-继承与多态-上篇&#xff1a;———— <就是本篇> &#x1f4d5; 继承的概念与使用 &#x1f4d5; 父类成员访问 &#x1f4d5; super关键字 &#x1f4d5; supe…...

通过比较list与vector在简单模拟实现时的不同进一步理解STL的底层

cplusplus.com/reference/list/list/?kwlist 当我们大致阅读完list的cplusplus网站的文档时&#xff0c;我们会发现它提供的接口大致上与我们的vector相同。当然的&#xff0c;在常用接口的简单实现上它们也大体相同&#xff0c;但是它们的构造函数与迭代器的实现却大有不同。…...

软件I2C的代码

I2C的函数 GPIO的配置——scl和sda都配置为开漏输出 void MyI2C_Init(void) {RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE);GPIO_InitTypeDef GPIO_InitStruture;GPIO_InitStruture.GPIO_Mode GPIO_Mode_Out_OD;GPIO_InitStruture.GPIO_PinGPIO_Pin_10 | GPIO_Pin_…...

登录时用户名密码加密传输(包含前后端代码)

页面输入用户名密码登录过程中&#xff0c;如果没有对用户名密码进行加密处理&#xff0c;可能会导致传输过程中数据被窃取&#xff0c;就算使用https协议&#xff0c;在浏览器控制台的Request Payload中也是能直接看到传输的明文&#xff0c;安全感是否还是不足。 大致流程&a…...

ai聊天对话页面-uniapp

流式传输打字机效果&#xff0c;只支持uniapp内使用 &#xff0c;下载地址 https://download.csdn.net/download/qq_54123885/89899859...

虚拟滚动列表如何实现?

highlight: a11y-dark 虚拟滚动列表&#xff0c;虚拟滚动的关键在于只渲染当前视口内可见的数据项&#xff0c;而不是一次性渲染所有数据项。这可以显著提高性能&#xff0c;尤其是在处理大量数据时。 以下是一个完整的虚拟滚动列表的示例代码&#xff1a; <!DOCTYPE htm…...

07_Linux网络配置与管理:命令与工具指南

本系列文章导航&#xff1a;01_Linux基础操作CentOS7学习笔记-CSDN博客 文章目录 网络配置与管理&#xff1a;命令与工具指南1. ping命令2. ifconfig命令3. ip命令4. route命令5. ip route命令6. nslookup命令7. nmcli命令8. nmtui命令9. RHEL7修改网卡名1. 修改网络(会话)配置…...

首个统一生成和判别任务的条件生成模型框架BiGR:专注于增强生成和表示能力,可执行视觉生成、辨别、编辑等任务

BiGR是一种新型的图像生成模型&#xff0c;它可以生成高质量的图像&#xff0c;同时还能有效地提取图像特征。该方法是通过将图像转换为一系列的二进制代码来工作&#xff0c;这些代码就像是图像的“压缩版”。在训练时会遮住一些代码&#xff0c;然后让模型学习如何根据剩下的…...

【Java知识】Java进阶-服务发现机制SPI

文章目录 SPI概述SPI 工作原理 ServiceLoader代码展示简化的 ServiceLoader 类关键点解释使用示例1. 定义服务接口2. 实现服务提供者3. 配置文件4. 加载服务提供者 总结 SPI使用场景1. 数据库驱动2. 日志框架3. 图像处理4. 加密算法5. 插件系统6. 缓存机制示例代码1. 定义服务接…...

多模态技术的协同表现:从文本生成、语音合成到口型同步综合测评

本文是针对多模态对话系统核心技术栈的使用效果和网络测评整理。 测评内容基于用户体验&#xff0c;侧重于从使用者角度出发&#xff0c;讨论实际操作中的体验感受&#xff0c;如技术的易用性、输出效果如文本的连贯性、语音的自然度、口型同步的准确性等。不涉及具体算法架构…...

Java最全面试题->Java主流框架->Srping面试题

Spring面试题 下边是我自己整理的面试题,基本已经很全面了,想要的可以私信我,我会不定期去更新思维导图 哪里不会点哪里 谈谈你对 Spring 的理解? Spring 是一个开源框架,为简化企业级应用开发而生。Spring 可以是使简单的 JavaBean 实现以前只有 EJB 才能实现的功能。…...

参编国家标准需要注意的事项有哪些?

1. 项目相关性&#xff1a; • 选择与自身企业产品、业务或专业领域紧密相关的国家标准进行参编。这样不仅能确保企业在标准制定过程中发挥自身的优势和专长&#xff0c;使参编工作更有实际意义和价值&#xff0c;也有利于企业将标准更好地应用于自身的生产经营活动&#xff0c…...

【Dash】feffery_antd_components 按钮组件的应用

一、feffery_antd_componenet 中的 AntdFloatButton 和 AntdFloatButtonGroup AntdFloatButton 和 AntdFloatButtonGroup 是两个用于创建悬浮按钮和悬浮按钮组的组件。 AntdFloatButton 是单个悬浮按钮组件&#xff0c;它提供了多种属性来定义按钮的外观及行为。AntdFloatBut…...

01 springboot-整合日志(logback-config.xml)

logback-config.xml 是一个用于配置 Logback 日志框架的 XML 文件&#xff0c;通常位于项目的 classpath 下的根目录或者 src/main/resources 目录下。 Logback 提供了丰富的配置选项&#xff0c;可以满足各种不同的日志需求。需要根据具体情况进行配置。 项目创建&#xff0…...

Java最全面试题->计算机基础面试题->计算机网络面试题

计算机网络 下边是我自己整理的面试题&#xff0c;基本已经很全面了&#xff0c;想要的可以私信我&#xff0c;我会不定期去更新思维导图 哪里不会点哪里 1.说一下TCP/IP四层模型 TCP/IP协议是美国国防部高级计划研究局为实现ARPANET互联网而开发的。 网络接口层&#xff…...

VSCode编译器改为中文

1. 通过快捷键设置中文 打开命令面板&#xff1a;按住键盘上的CtrlShiftP组合键&#xff0c;打开命令面板。 输入并设置语言&#xff1a;在命令面板中输入Configure Display Language。 点击Configure Display Language选项。 在弹出的语言选择列表中&#xff0c;选择zh-cn…...

前端开发设计模式——状态模式

目录 一、状态模式的定义和特点 二、状态模式的结构与原理 1.结构&#xff1a; 2.原理&#xff1a; 三、状态模式的实现方式 四、状态模式的使用场景 1.按钮的不同状态&#xff1a; 2.页面加载状态&#xff1a; 3.用户登录状态&#xff1a; 五、状态模式的优点 1.提…...

特种作业操作烟花爆竹试题分享

1.&#xff08;单选题&#xff09;职业卫生研究的是人类从事各种职业劳动过程中的&#xff08; &#xff09;。 A.健康问题 B.环境问题 C.卫生问题 答案:C 2.&#xff08;单选题&#xff09;安全生产事关人民群众的&#xff08; &#xff09;安全&#xff0c;事关改革发展和…...

实现prometheus+grafana的监控部署

直接贴部署用的文件信息了 kubectl label node xxx monitoringtrue 创建命名空间 kubectl create ns monitoring 部署operator kubectl apply -f operator-rbac.yml kubectl apply -f operator-dp.yml kubectl apply -f operator-crd.yml # 定义node-export kubectl app…...

确保Spring Boot定时任务只执行一次方案

在Spring Boot项目中&#xff0c;确保定时任务只执行一次是一个常见的需求。这种需求可以通过多种方式来实现&#xff0c;以下是一些常见的方法&#xff0c;它们各具特点&#xff0c;可以根据项目的实际需求来选择最合适的方法。 1. 使用Scheduled注解并设置极大延迟 一种简单…...

【Python数据可视化】利用Matplotlib绘制美丽图表!

【Python数据可视化】利用Matplotlib绘制美丽图表&#xff01; 数据可视化是数据分析过程中的重要步骤&#xff0c;它能直观地展示数据的趋势、分布和相关性&#xff0c;帮助我们做出明智的决策。在 Python 中&#xff0c;Matplotlib 是最常用的可视化库之一&#xff0c;它功能…...

【最新通知】2024年Cisco思科认证CCNA详解

CCNA现在涵盖安全性、自动化和可编程性。该计划拥有一项涵盖IT职业基础知识的认证&#xff0c;包括一门考试和一门培训课程&#xff0c;助您做好准备。 CCNA培训课程和考试最近面向最新技术和工作岗位进行了重新调整&#xff0c;为您提供了向任何方向发展事业所需的基础。CCNA认…...

监控内容、监控指标、监控工具大科普

在现代信息技术领域&#xff0c;监控技术扮演着至关重要的角色。它帮助我们实时了解系统、网络、应用以及环境的状态&#xff0c;确保它们的安全、稳定和高效运行。以下是对监控内容、监控指标和监控工具的详细科普。 一、监控内容 监控内容是指监控系统所关注和记录的具体信…...

生成文件夹 - python 实现

生成文件夹保存图片和文本等信息。 代码具体实现如下&#xff1a; #-*-coding:utf-8-*- # date:2021-04-13 # Author: DataBall - XIAN # Function: 生成文件夹import os if __name__ "__main__":path "./dataset"if not os.path.exists(path): # 如果…...

快速了解学会python基础语言及IDLE 提供的常用快捷键

&#x1f600;前言 本篇博文是关于python的基础语言介绍及IDLE 提供的常用快捷键&#xff0c;希望你能够喜欢 &#x1f3e0;个人主页&#xff1a;晨犀主页 &#x1f9d1;个人简介&#xff1a;大家好&#xff0c;我是晨犀&#xff0c;希望我的文章可以帮助到大家&#xff0c;您的…...

【python】OpenCV—Sort the Point Set from Top Left to Bottom Right

文章目录 1、功能描述2、代码实现3、效果展示4、更多例子5、参考 1、功能描述 给出一张图片&#xff0c;里面含有各种图形&#xff0c;取各种图形的中心点&#xff0c;从左到右从上到下排序 例如 2、代码实现 import cv2 import numpy as npdef process_img(img):img_gray c…...

LeetCode 1493.删掉一个元素以后全为1的最长子数组

题目&#xff1a; 给你一个二进制数组 nums &#xff0c;你需要从中删掉一个元素。 请你在删掉元素的结果数组中&#xff0c;返回最长的且只包含 1 的非空子数组的长度。 如果不存在这样的子数组&#xff0c;请返回 0 。 思路&#xff1a;不定长滑动窗口&#xff0c;将问题…...

php常用设计模式之工厂模式

引言 在日常开发中&#xff0c;我们一些业务场景需要用到发送短信通知。然而实际情况考虑到不同厂商之间的价格、实效性、可能会出现的情况等 我们的业务场景往往会接入多个短信厂商来保证我们业务的正常运行&#xff0c;而不同的短信厂商&#xff08;如阿里云短信、腾讯云短信…...