SpringSecurity 入门

文章目录

  • Spring Security概念
  • 快速入门案例
    • 环境准备
      • Spring配置文件
      • SpringMVC配置文件
      • log4j配置文件
      • web.xml
      • Tomcat插件
    • 整合SpringSecurity
  • 认证操作
    • 自定义登录页面
    • 关闭CSRF拦截
    • 数据库认证
    • 加密
    • 认证状态
    • 记住我
    • 授权
      • 注解使用
      • 标签使用

Spring Security概念

Spring Security是Spring采用 AOP思想,基于 servlet过滤器实现的安全框架。它提供了完善的认证机制方法级的授权功能。是一款非常优秀的权限管理框架。

特征

  • 对身份验证和授权的全面且可扩展的支持
  • 保护免受会话固定,劫持,跨站点请求伪造等攻击
  • Servlet API集成
  • 与Spring Web MVC的可选集成

快速入门案例

环境准备

准备一个SpringMVC+Spring+jsp的Web环境,然后在这个基础上整合SpringSecurity。

添加相关的依赖

  <dependencies><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.11</version><scope>test</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId><version>5.2.1.RELEASE</version></dependency><dependency><groupId>javax.servlet</groupId><artifactId>servlet-api</artifactId><version>2.5</version><scope>provided</scope></dependency><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-log4j12</artifactId><version>1.7.25</version></dependency></dependencies>

Spring配置文件

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context.xsd"><context:component-scan base-package="com.xx.service" ></context:component-scan></beans>

SpringMVC配置文件

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"xmlns:mvc="http://www.springframework.org/schema/mvc"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context.xsdhttp://www.springframework.org/schema/mvchttp://www.springframework.org/schema/mvc/spring-mvc.xsd"><context:component-scan base-package="com.xx.controller"></context:component-scan><mvc:annotation-driven ></mvc:annotation-driven></beans>

log4j配置文件

log4j.properties文件

log4j.rootCategory=INFO, stdoutlog4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[QC] %p [%t] %C.%M(%L) | %m%n

web.xml

web.xml

<!DOCTYPE web-app PUBLIC"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN""http://java.sun.com/dtd/web-app_2_3.dtd" ><web-app version="2.5" id="WebApp_ID" xmlns="http://java.sun.com/xml/ns/javaee"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"><display-name>Archetype Created Web Application</display-name><!-- 初始化spring容器 --><context-param><param-name>contextConfigLocation</param-name><param-value>classpath:applicationContext.xml</param-value></context-param><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener><!-- post乱码过滤器 --><filter><filter-name>CharacterEncodingFilter</filter-name><filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class><init-param><param-name>encoding</param-name><param-value>utf-8</param-value></init-param></filter><filter-mapping><filter-name>CharacterEncodingFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping><!-- 前端控制器 --><servlet><servlet-name>dispatcherServletb</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class><!-- contextConfigLocation不是必须的, 如果不配置contextConfigLocation, springmvc的配置文件默认在:WEB-INF/servlet的name+"-servlet.xml" --><init-param><param-name>contextConfigLocation</param-name><param-value>classpath:spring-mvc.xml</param-value></init-param><load-on-startup>1</load-on-startup></servlet><servlet-mapping><servlet-name>dispatcherServletb</servlet-name><!-- 拦截所有请求jsp除外 --><url-pattern>/</url-pattern></servlet-mapping></web-app>

Tomcat插件

添加Tomcat的插件 启动测试

    <plugins><plugin><groupId>org.apache.tomcat.maven</groupId><artifactId>tomcat7-maven-plugin</artifactId><version>2.2</version><configuration><port>8082</port><path>/</path></configuration></plugin></plugins>

image.png

整合SpringSecurity

添加相关的依赖

spring-security-core.jar 核心包,任何SpringSecurity的功能都需要此包

spring-security-web.jar:web工程必备,包含过滤器和相关的web安全的基础结构代码

spring-security-config.jar:用于xml文件解析处理

spring-security-tablibs.jar:动态标签库

<!-- 添加SpringSecurity的相关依赖 -->
<dependency><groupId>org.springframework.security</groupId><artifactId>spring-security-config</artifactId><version>5.1.5.RELEASE</version>
</dependency>
<dependency><groupId>org.springframework.security</groupId><artifactId>spring-security-taglibs</artifactId><version>5.1.5.RELEASE</version>
</dependency>

web.xml文件中配置SpringSecurity

  <!-- 配置过滤器链 springSecurityFilterChain 名称固定 --><filter><filter-name>springSecurityFilterChain</filter-name><filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class></filter><filter-mapping><filter-name>springSecurityFilterChain</filter-name><url-pattern>/*</url-pattern></filter-mapping>

添加SpringSecurity的配置文件

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:security="http://www.springframework.org/schema/security"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/securityhttp://www.springframework.org/schema/security/spring-security.xsd"><!-- SpringSecurity配置文件 --><!--auto-config:表示自动加载SpringSecurity的配置文件use-expressions:表示使用Spring的EL表达式--><security:http auto-config="true" use-expressions="true"><!--拦截资源pattern="/**" 拦截所有的资源access="hasAnyRole('ROLE_USER')" 表示只有ROLE_USER 这个角色可以访问资源--><security:intercept-url pattern="/**" access="hasAnyRole('ROLE_USER')" ></security:intercept-url></security:http><!-- 认证用户信息 --><security:authentication-manager><security:authentication-provider><security:user-service ><!-- 设置一个账号 zhangsan 密码123 {noop} 表示不加密 具有的角色是  ROLE_USER--><security:user name="zhangsan" authorities="ROLE_USER" password="{noop}123" ></security:user><security:user name="lisi" authorities="ROLE_USER" password="{noop}123456" ></security:user></security:user-service></security:authentication-provider></security:authentication-manager>
</beans>

将SpringSecurity的配置文件引入到Spring配置文件中

启动测试访问

image.png

认证操作

自定义登录页面

如何使用我们自己写的登录页面呢?

<%--Created by IntelliJ IDEA.User: dpbDate: 2021/3/16Time: 16:57To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head><title>Title</title>
</head>
<body><h1>登录页面</h1><form action="/login" method="post">账号:<input type="text" name="username"><br>密码:<input type="password" name="password"><br><input type="submit" value="登录"></form>
</body>
</html>

修改相关的配置文件

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:security="http://www.springframework.org/schema/security"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/securityhttp://www.springframework.org/schema/security/spring-security.xsd"><!-- SpringSecurity配置文件 --><!--auto-config:表示自动加载SpringSecurity的配置文件use-expressions:表示使用Spring的EL表达式--><security:http auto-config="true" use-expressions="true"><!-- 匿名访问登录页面--><security:intercept-url pattern="/login.jsp" access="permitAll()"/><!--拦截资源pattern="/**" 拦截所有的资源access="hasAnyRole('ROLE_USER')" 表示只有ROLE_USER 这个角色可以访问资源--><security:intercept-url pattern="/**" access="hasAnyRole('ROLE_USER')" /><!--配置认证的信息--><security:form-login login-page="/login.jsp"login-processing-url="/login"default-target-url="/home.jsp"authentication-failure-url="/error.jsp"/><!-- 注销 --><security:logout logout-url="/logout"logout-success-url="/login.jsp" /></security:http><!-- 认证用户信息 --><security:authentication-manager><security:authentication-provider><security:user-service ><!-- 设置一个账号 zhangsan 密码123 {noop} 表示不加密 具有的角色是  ROLE_USER--><security:user name="zhangsan" authorities="ROLE_USER" password="{noop}123" ></security:user><security:user name="lisi" authorities="ROLE_USER" password="{noop}123456" ></security:user></security:user-service></security:authentication-provider></security:authentication-manager>
</beans>

访问home.jsp页面后会自动跳转到自定义的登录页面

image.png

但是当提交了请求后页面出现了如下的错误

image.png

关闭CSRF拦截

为什么系统默认的登录页面提交没有CRSF拦截的问题呢

image.png

自定义的认证页面没有这个信息怎么办呢?两种方式:

  1. 关闭CSRF拦截
    image.png
    再次登录显示成功

  2. 使用CSRF防护
    在页面中添加对应taglib
    image.png
    访问登录页面可以看到csrf的信息,再次登陆即可成功。

image.png

数据库认证

前面的案例账号信息是直接写在配置文件中的,这显然是不太好的,如何实现和数据库中的信息进行认证?

添加相关的依赖

    <dependency><groupId>org.mybatis</groupId><artifactId>mybatis</artifactId><version>3.5.4</version></dependency><dependency><groupId>org.mybatis</groupId><artifactId>mybatis-spring</artifactId><version>2.0.4</version></dependency><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>8.0.11</version></dependency><dependency><groupId>com.alibaba</groupId><artifactId>druid</artifactId><version>1.1.8</version></dependency>

添加配置文件

jdbc.driver=com.mysql.cj.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/logistics?characterEncoding=utf-8&serverTimezone=UTC
jdbc.username=root
jdbc.password=123456
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context.xsd"><context:component-scan base-package="com.xxx.service" ></context:component-scan><!-- SpringSecurity的配置文件 --><import resource="classpath:spring-security.xml" /><context:property-placeholder location="classpath:db.properties" /><bean class="com.alibaba.druid.pool.DruidDataSource" id="dataSource"><property name="url" value="${jdbc.url}" /><property name="driverClassName" value="${jdbc.driver}" /><property name="username" value="${jdbc.username}" /><property name="password" value="${jdbc.password}" /></bean><bean class="org.mybatis.spring.SqlSessionFactoryBean" id="sessionFactoryBean" ><property name="dataSource" ref="dataSource" /><property name="configLocation" value="classpath:mybatis-config.xml" /><property name="mapperLocations" value="classpath:mapper/*.xml" /></bean><bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"><property name="basePackage" value="com.xxx.mapper" /></bean>
</beans>

需要完成认证的service中继承 UserDetailsService父接口

实现类中实现验证方法

@Service
public class UserServiceImpl extends UserDetailsService {@Autowiredprivate UserMapper mapper;@Overridepublic UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {// 根据账号查询用户信息UserExample example = new UserExample();example.createCriteria().andUserNameEqualTo(s);List<User> users = mapper.selectByExample(example);if(users != null && users.size() > 0){User user = users.get(0);if(user != null){List<SimpleGrantedAuthority> authorities = new ArrayList<>();// 设置登录账号的角色authorities.add(new SimpleGrantedAuthority("ROLE_USER"));UserDetails userDetails = new org.springframework.security.core.userdetails.User(user.getUserName(),"{noop}"+user.getPassword(),authorities);return userDetails;}}return null;}
}

最后修改配置文件关联自定义的service即可

image.png

加密

在SpringSecurity中推荐我们是使用的加密算法是 BCryptPasswordEncoder

修改配置文件

image.png

image.png

认证状态

用户的状态包括 是否可用,账号过期,凭证过期,账号锁定等等。

image.png

可以在用户的表结构中添加相关的字段来维护这种关系

记住我

在表单页面添加一个 记住我的按钮.

image.png

在SpringSecurity中默认是关闭 RememberMe功能的,需要放开

image.png

记住我的功能会方便大家的使用,但是安全性却是令人担忧的,因为Cookie信息存储在客户端很容易被盗取,这时我们可以将这些数据持久化到数据库中。

CREATE TABLE `persistent_logins` (
`username` VARCHAR (64) NOT NULL,
`series` VARCHAR (64) NOT NULL,
`token` VARCHAR (64) NOT NULL,
`last_used` TIMESTAMP NOT NULL,
PRIMARY KEY (`series`)
) ENGINE = INNODB DEFAULT CHARSET = utf8

image.png

image.png

注意设置了过期时间,到期后并不是删除表结构中的数据,而是客户端不会在携带相关信息了,同时删除掉数据库中的数据 记住我也会失效

授权

注解使用

开启注解的支持

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"xmlns:mvc="http://www.springframework.org/schema/mvc"xmlns:security="http://www.springframework.org/schema/security"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context.xsdhttp://www.springframework.org/schema/mvchttp://www.springframework.org/schema/mvc/spring-mvc.xsdhttp://www.springframework.org/schema/securityhttp://www.springframework.org/schema/security/spring-security.xsd"><context:component-scan base-package="com.xxx.controller"></context:component-scan><mvc:annotation-driven ></mvc:annotation-driven><!--开启权限控制注解支持jsr250-annotations="enabled" 表示支持jsr250-api的注解支持,需要jsr250-api的jar包pre-post-annotations="enabled" 表示支持Spring的表达式注解secured-annotations="enabled" 这个才是SpringSecurity提供的注解--><security:global-method-securityjsr250-annotations="enabled"pre-post-annotations="enabled"secured-annotations="enabled"/>
</beans>

jsr250的使用

添加依赖

<dependency><groupId>javax.annotation</groupId><artifactId>jsr250-api</artifactId><version>1.0</version>
</dependency>

控制器中通过注解设置


@Controller
@RequestMapping("/user")
public class UserController {@RolesAllowed(value = {"ROLE_ADMIN"})@RequestMapping("/query")public String query(){System.out.println("用户查询....");return "/home.jsp";}@RolesAllowed(value = {"ROLE_USER"})@RequestMapping("/save")public String save(){System.out.println("用户添加....");return "/home.jsp";}@RequestMapping("/update")public String update(){System.out.println("用户更新....");return "/home.jsp";}
}

image.png

image.png

Spring表达式的使用


@Controller
@RequestMapping("/order")
public class OrderController {@PreAuthorize(value = "hasAnyRole('ROLE_USER')")@RequestMapping("/query")public String query(){System.out.println("用户查询....");return "/home.jsp";}@PreAuthorize(value = "hasAnyRole('ROLE_ADMIN')")@RequestMapping("/save")public String save(){System.out.println("用户添加....");return "/home.jsp";}@RequestMapping("/update")public String update(){System.out.println("用户更新....");return "/home.jsp";}
}

SpringSecurity提供的注解

@Controller
@RequestMapping("/role")
public class RoleController {@Secured("ROLE_USER")@RequestMapping("/query")public String query(){System.out.println("用户查询....");return "/home.jsp";}@Secured("ROLE_ADMIN")@RequestMapping("/save")public String save(){System.out.println("用户添加....");return "/home.jsp";}@RequestMapping("/update")public String update(){System.out.println("用户更新....");return "/home.jsp";}
}

异常处理

新增一个错误页面,然后在SpringSecurity的配置文件中配置即可

image.png

image.png

当然也可以使用SpringMVC中的各种异常处理器处理

image.png

标签使用

注解的权限管理可以控制用户是否具有这个操作的权限,但是当用户具有了这个权限后进入到具体的操作页面,这时我们还有进行更细粒度的控制,这时注解的方式就不太适用了,这时可以通过标签来处理

添加SpringSecurity的标签库


<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<html>
<head><title>Title</title>
</head>
<body><h1>欢迎光临...</h1><security:authentication property="principal.username" /><security:authorize access="hasAnyRole('ROLE_USER')" ><a href="#">用户查询</a><br></security:authorize><security:authorize access="hasAnyRole('ROLE_ADMIN')" ><a href="#">用户添加</a><br></security:authorize><security:authorize access="hasAnyRole('ROLE_USER')" ><a href="#">用户更新</a><br></security:authorize><security:authorize access="hasAnyRole('ROLE_ADMIN')" ><a href="#">用户删除</a><br></security:authorize>
</body>
</html>

页面效果

image.png

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.xdnf.cn/news/142705.html

如若内容造成侵权/违法违规/事实不符,请联系一条长河网进行投诉反馈,一经查实,立即删除!

相关文章

docker 安装 nessus新版、awvs15-简单更快捷

一、docker 安装 nessus 参考项目地址&#xff1a; https://github.com/elliot-bia/nessus 介绍&#xff1a;几行代码即可一键安装更新 nessus -推荐 安装好 docker后执行以下命令 #拉取镜像创建容器 docker run -itd --nameramisec_nessus -p 8834:8834 ramisec/nessus …

C#中的(++)和(--)运算符

目录 背景: 的前加 效果展示:​ 的后加 效果展示 :​ 总结: 背景: 自增和自减运算符存在于C/C/C#/Java等高级语言中&#xff0c;它的作用是在运算结束前(前置自增自减运算符 )或后(后置自增自减运算符 )将 变量的值加(或减)1。 在C#中&#xff0c;和--是自增和自减运…

【趣味JavaScript】5年前端开发都没有搞懂toString和valueOf这两个方法!

&#x1f680; 个人主页 极客小俊 ✍&#x1f3fb; 作者简介&#xff1a;web开发者、设计师、技术分享博主 &#x1f40b; 希望大家多多支持一下, 我们一起进步&#xff01;&#x1f604; &#x1f3c5; 如果文章对你有帮助的话&#xff0c;欢迎评论 &#x1f4ac;点赞&#x1…

UE5 虚幻引擎 如何使用构造脚本(Construction Script)? 构造脚本的奥秘!

目录 1 构造脚本&#xff08;Construction Script&#xff09;1.1 介绍1.2 案例1&#xff1a;利用样条组件程序化生成树木1.2 案例2&#xff1a;利用样条组件和样条网格体组件程序化生成道路 1 构造脚本&#xff08;Construction Script&#xff09; 1.1 介绍 问题&#xff1a…

【考研数学】概率论与数理统计 —— 第三章 | 二维随机变量及其分布(2,常见的二维随机变量及二维变量的条件分布和独立性)

文章目录 引言四、常见的二维随机变量4.1 二维均匀分布4.2 二维正态分布 五、二维随机变量的条件分布5.1 二维离散型随机变量的条件分布律5.2 二维连续型随机变量的条件分布 六、随机变量的独立性6.1 基本概念6.2 随机变量独立的等价条件 写在最后 引言 有了上文关于二维随机变…

【Vue.js】使用ElementUI搭建动态树数据表格与分页

一&#xff0c;动态树 本文章为上一篇文章拓展内容》》实现首页导航及左侧菜单 将左侧菜单结构更换为下面代码&#xff1a; 菜单结构&#xff1a; <el-menu><el-submenu index"" key""><template slot"title"><i class…

1526. 形成目标数组的子数组最少增加次数;2008. 出租车的最大盈利;1589. 所有排列中的最大和

1526. 形成目标数组的子数组最少增加次数 核心思想&#xff1a;差分数组。对于一个数组a,要想从全为0的数组增加1变为它&#xff0c;等价于从a减少1变为全0的数组。然后a有一个差分数组d&#xff0c;对于a区间的[L,R]减少1操作等价于对d[L]-1,然后d[R1]1。你想让a变为全0&…

灰色预测GM(1,1)

目录 一、灰色预测模型简介 二、GM(1,1)灰色模型 1、GM(1,1)模型预测方法 &#xff08;1&#xff09;原始数据&#xff08;参考列&#xff09; &#xff08;2&#xff09;累加生成序列&#xff08;Acumulated Generating Operator,1-AGO&#xff09; &#xff08;3&#xff…

PHY6252—超高性价比蓝牙/2.4G芯片

PHY6252是用于蓝牙5.2应用的芯片&#xff08;SOC&#xff09;系统。它具有高性能的低功率32位处理器&#xff0c;具有64K保留SRAM&#xff0c;512/256KB flash&#xff0c;96KB ROM&#xff0c;256bit Efuse和超低功率&#xff0c;高性能&#xff0c;多模式广播。此外&#xff…

03 MIT线性代数-矩阵乘法和逆矩阵Multiplication inverse matrices

1. 矩阵乘法 Matrix multiplication 我们通过四种方法讨论如何使矩阵A与B相乘得到矩阵C。其中A为mxn&#xff08;m行n列&#xff09;矩阵&#xff0c;而B为nxp矩阵&#xff0c;则C为mxp矩阵&#xff0c;记cij为矩阵C中第i行第j列的元素 1.1 Regular way 矩阵乘法的标准计算方…

分享从零开始学习网络设备配置--任务4.1 IPv6地址的基本配置

任务描述 某公司构建了互联互通的办公网&#xff0c;需要不断扩大网络规模。网络管理员小赵决定采用IPv6的地址&#xff0c;满足公司网络规模的未来发展。 由于IPv4地址耗尽及IPv4地址区域分配不均衡&#xff0c;成为运营商必须面临的一个问题。另外随着互联网的商业化&#…

Matlab信号处理:FFT频谱分辨率

频谱分辨率&#xff1a; 其中为采样间隔&#xff0c;为采样点数。 FFT分辨率&#xff1a; 其中为采样频率&#xff0c;为FFT点数。 有两正弦函数&#xff0c;频率分别为 f1 1Hz&#xff0c;f2 10Hz&#xff0c;f3 40Hz&#xff1b; 示例1&#xff1a; 采样频率 fs 1000H…

sox音频处理和ffmpeg评测

ffmpeg音频处理不如sox&#xff0c;ffmpeg切分&#xff0c;最低切分是0.1秒&#xff0c;而sox可以切分更小单位0.001这种 ffmpeg处理视频等功能更全。 命令 ffmpeg -i 2.wav -y -ss 0.01 -acodec copy test.wav sox 2.wav output2.wav trim 0.01

抖 X-Bongus 参数逆向 python案例实战

前言 嗨喽~大家好呀&#xff0c;这里是魔王呐 ❤ ~! python更多源码/资料/解答/教程等 点击此处跳转文末名片免费获取 知识点&#xff1a; 动态数据抓包 requests发送请求 X-Bogus 参数逆向 开发环境: python 3.8 运行代码 pycharm 2022.3 辅助敲代码 requests pip ins…

CleanMyMac X版本4.14.2中文版新功能介绍

CleanMyMac X版本4.14.2中文版是一款专业的Mac清理工具&#xff0c;只需要一键智能清理&#xff0c;便能让Mac恢复原始的性能&#xff0c;是MAC系统非常好用的工具。CleanMyMac X自身拥有一个安全数据库&#xff0c;它是一个项目列表&#xff0c;拥有一定的规格&#xff0c;可以…

24届近3年中国矿业大学自动化考研院校分析

所谓又专又精&#xff0c;专是指我们售后群团队上百人都是自动化研究生&#xff0c;精是指我们只做自动化这一门专业学科7年了&#xff0c;研究到极致&#xff01; &#x1f509;今天学姐给大家带来的是中国矿业大学控制考研分析 满满干货&#xff5e;还不快快点赞收藏 目录…

网络安全内网渗透之DNS隧道实验--dnscat2直连模式

目录 一、DNS隧道攻击原理 二、DNS隧道工具 &#xff08;一&#xff09;安装dnscat2服务端 &#xff08;二&#xff09;启动服务器端 &#xff08;三&#xff09;在目标机器上安装客户端 &#xff08;四&#xff09;反弹shell 一、DNS隧道攻击原理 在进行DNS查询时&#x…

【考研】2023暨南大学848答案 2020-2023 计算机基础综合 830答案

&#x1f525;&#x1f525; I 仓库 还在更新&#xff0c;敬请期待 &#x1f525;暨南大学计算机848报考信息汇总仓库 仓库内有20年真题答案 https://github.com/zhanjuex/JNU_848 备用仓库 (目录可能用不了 https://xindon.coding.net/public/open/JNU_848/git/files &#x1…

暗月中秋靶场活动writeup

前言 暗月在中秋节搞了个靶场活动&#xff0c;一共有4个flag&#xff0c;本着增长经验的想法参加了本次活动&#xff0c;最终在活动结束的时候拿到了3个flag&#xff0c;后面看了其他人的wp也复现拿到第四个flag。过程比较曲折&#xff0c;所以记录一下。 靶场地址 103.108.…

获得京东商品详情(关键词搜索,店铺所有商品)API接口返回值说明

京东API接口&#xff0c;简单而言&#xff0c;就是一套工具&#xff0c;可以帮助你与京东平台的数据与功能进行智能对接。它能够让你的店铺信息、商品信息、用户数据等信息实现高效流通&#xff0c;帮助你更好地理解客户需求 我们深知数据安全的重要性&#xff0c;因此&#x…