前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >专栏 >spring boot 加密_springboot 密码加密

spring boot 加密_springboot 密码加密

作者头像
全栈程序员站长
发布于 2022-11-09 07:11:20
发布于 2022-11-09 07:11:20
2.8K00
代码可运行
举报
运行总次数:0
代码可运行

大家好,又见面了,我是你们的朋友全栈君。


首先介绍一下jasypt的使用方法

可以参考下面这篇文章:

Get史上最优雅的加密方式!没有之一!

版本对应的坑

使用的时候还是遇到一个坑,就是jasypt的版本与spring boot版本存在对应情况。可以看到jasypt是区分java7和java8的,也存在依赖spring版本的情况。

自己尝试了一下

在使用jasypt-spring-boot-starter的前提下

jasypt版本

springboot版本

2.1.0

2.1.0

1.5

1.4.2

1.5

1.5.3

1.8

1.4.2

所以如果引入maven之后启动系统报错,那么可以根据版本对应情况这个角度进行排查。

关键技术点

下面说一下jasypt的两个关键的技术实现点

一是如何实现对spring环境中包含的PropertySource对象实现加密感知的

二是其默认的PBEWITHMD5ANDDES算法是如何工作的,并澄清一下在使用jasypt的时候最常遇到的一个疑问:既然你的password也配置在properties文件中,那么我拿到了加密的密文和password,不是可以直接解密吗?

源码解析

总结来说:其通过BeanFactoryPostProcessor#postProcessBeanFactory方法,获取所有的propertySource对象,将所有propertySource都会重新包装成新的EncryptablePropertySourceWrapper

解密的时候,也是使用EncryptablePropertySourceWrapper#getProperty方法,如果通过 prefixes/suffixes 包裹的属性,那么返回解密后的值;如果没有被包裹,那么返回原生的值。从源头开始走起:

将jar包引入到spring boot中

spring.factories

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.ulisesbocchio.jasyptspringboot.JasyptSpringBootAutoConfiguration

这里补充一下spring boot @EnableAutoConfiguration的原理。

@EnableAutoConfiguration原理

@EnableAutoConfiguration注解@Import(AutoConfigurationImportSelector.class)

这个配置类实现了ImportSelector接口,重写其selectImports方法

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
List<String> configurations = getCandidateConfigurations(annotationMetadata,
      attributes);

getCandidateConfigurations方法,会从classpath中搜索所有META-INF/spring.factories配置文件,然后,将其中org.springframework.boot.autoconfigure.EnableAutoConfiguration key对应的配置项加载到spring容器中。这样就实现了在spring boot中加载外部项目的bean或者第三方jar中的bean。

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
protected List<String> getCandidateConfigurations(AnnotationMetadata metadata,
      AnnotationAttributes attributes) {
   List<String> configurations = SpringFactoriesLoader.loadFactoryNames(
         getSpringFactoriesLoaderFactoryClass(), getBeanClassLoader());
   Assert.notEmpty(configurations,
         "No auto configuration classes found in META-INF/spring.factories. If you "
               + "are using a custom packaging, make sure that file is correct.");
   return configurations;
}

其内部实现的关键点有:

1. ImportSelector 该接口的方法的返回值都会被纳入到spring容器的管理中

2. SpringFactoriesLoader 该类可以从classpath中搜索所有META-INF/spring.factories配置文件,读取配置

@EnableAutoConfiguration注解中有spring.boot.enableautoconfiguration=true就开启,默认为true,可以在application.properties中设置此开关项

exclude()方法是根据类排除,excludeName是根据类名排除

在spring-boot-autoconfigure jar中,META-INF中有一个spring.factories文件,其中配置了spring-boot所有的自动配置参数,如GsonAutoConfiguration,配合@ConditionalOnClass(Gson.class),可以实现如果Gson bean存在,就启动自动注入,否则就不启用此注入的灵活配置

好了,有了上面的基础知识,我们就关心JasyptSpringBootAutoConfiguration

JasyptSpringBootAutoConfiguration

其@Import EnableEncryptablePropertySourcesConfiguration

关注两个地方

一是其@Import的StringEncryptorConfiguration.class

如果没有自定义的EncryptorBean,即jasyptStringEncryptor bean,那么就注册默认的jasyptStringEncryptor bean

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
@Conditional(OnMissingEncryptorBean.class)
@Bean(name = ENCRYPTOR_BEAN_PLACEHOLDER)
public StringEncryptor stringEncryptor(Environment environment) {
    String encryptorBeanName = environment.resolveRequiredPlaceholders(ENCRYPTOR_BEAN_PLACEHOLDER);
    LOG.info("String Encryptor custom Bean not found with name '{}'. Initializing String Encryptor based on properties with name '{}'",
             encryptorBeanName, encryptorBeanName);
    return new LazyStringEncryptor(() -> {
        PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
        SimpleStringPBEConfig config = new SimpleStringPBEConfig();
        config.setPassword(getRequiredProperty(environment, "jasypt.encryptor.password"));
        config.setAlgorithm(getProperty(environment, "jasypt.encryptor.algorithm", "PBEWithMD5AndDES"));
        config.setKeyObtentionIterations(getProperty(environment, "jasypt.encryptor.keyObtentionIterations", "1000"));
        config.setPoolSize(getProperty(environment, "jasypt.encryptor.poolSize", "1"));
        config.setProviderName(getProperty(environment, "jasypt.encryptor.providerName", "SunJCE"));
        config.setSaltGeneratorClassName(getProperty(environment, "jasypt.encryptor.saltGeneratorClassname", "org.jasypt.salt.RandomSaltGenerator"));
        config.setStringOutputType(getProperty(environment, "jasypt.encryptor.stringOutputType", "base64"));
        encryptor.setConfig(config);
        return encryptor;
    });
}

StringEncryptor接口提供了加密和解密的方法

我们可以自定义StringEncryptor,如

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
@Configuration
public class JasyptConfig {

    @Bean(name = "jasypt.encryptor.bean:jasyptStringEncryptor")
    public StringEncryptor stringEncryptor() {
        PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
        SimpleStringPBEConfig config = new SimpleStringPBEConfig();
        config.setPassword("password");
        config.setAlgorithm("PBEWithMD5AndDES");
        config.setKeyObtentionIterations("1000");
        config.setPoolSize("1");
        config.setProviderName("SunJCE");
        config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator");
        config.setStringOutputType("base64");
        encryptor.setConfig(config);
        return encryptor;
    }
}

二是其对spring环境中包含的PropertySource对象的处理

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
@Configuration
@Import(StringEncryptorConfiguration.class)
public class EnableEncryptablePropertySourcesConfiguration implements EnvironmentAware {

    private static final Logger LOG = LoggerFactory.getLogger(EnableEncryptablePropertySourcesConfiguration.class);
    private ConfigurableEnvironment environment;

    @Bean
    public EnableEncryptablePropertySourcesPostProcessor enableEncryptablePropertySourcesPostProcessor() {
        boolean proxyPropertySources = environment.getProperty("jasypt.encryptor.proxyPropertySources", Boolean.TYPE, false);
        InterceptionMode interceptionMode = proxyPropertySources ? InterceptionMode.PROXY : InterceptionMode.WRAPPER;
        return new EnableEncryptablePropertySourcesPostProcessor(environment, interceptionMode);
    }

    @Override
    public void setEnvironment(Environment environment) {
        this.environment = (ConfigurableEnvironment) environment;
    }
}

其提供了两种模式来创建 分别为proxy和wrapper 默认情况下interceptionMode为wrapper

下面就是关键了,new了一个EnableEncryptablePropertySourcesPostProcessor

其implements BeanFactoryPostProcessor

这里又需要两个背景知识

一是AbstractApplicationContext的refresh方法

是启动spring容器的关键方法

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
// Allows post-processing of the bean factory in context subclasses.
postProcessBeanFactory(beanFactory);

// Invoke factory processors registered as beans in the context.
invokeBeanFactoryPostProcessors(beanFactory);

// Register bean processors that intercept bean creation.
registerBeanPostProcessors(beanFactory);

来注册我们下面的postProcessors

二是BeanFactoryPostProcessor接口的作用

BeanFactoryPostProcessor接口提供了postProcessBeanFactory方法,在容器初始化之后执行一次

invokeBeanFactoryPostProcessors,获取的手动注册的BeanFactoryPostProcessor

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
/**
 * Invoke the given BeanFactoryPostProcessor beans.
 */
private static void invokeBeanFactoryPostProcessors(
      Collection<? extends BeanFactoryPostProcessor> postProcessors, ConfigurableListableBeanFactory beanFactory) {

   for (BeanFactoryPostProcessor postProcessor : postProcessors) {
      postProcessor.postProcessBeanFactory(beanFactory);
   }
}

可以看到postProcessors有4个

接下来看关键的EnableEncryptablePropertySourcesPostProcessor

EnableEncryptablePropertySourcesPostProcessor

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
public class EnableEncryptablePropertySourcesPostProcessor implements BeanFactoryPostProcessor, ApplicationListener<ApplicationEvent>, Ordered {

其实现了BeanFactoryPostProcessor以及Ordered接口

其中getOrder方法 让这个jasypt定义的BeanFactoryPostProcessor的初始化顺序最低,即最后初始化

我们知道spring中排序分为两种PriorityOrdered 和Ordered接口,一般来说就是PriorityOrdered 优于Ordered 其次都是按照order大小来的排序

我们就知道了接下来就执行EnableEncryptablePropertySourcesPostProcessor的postProcessBeanFactory方法,

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
    LOG.info("Post-processing PropertySource instances");
    MutablePropertySources propSources = environment.getPropertySources();
    StreamSupport.stream(propSources.spliterator(), false)
        .filter(ps -> !(ps instanceof EncryptablePropertySource))
        .map(s -> makeEncryptable(s, beanFactory))
        .collect(toList())
        .forEach(ps -> propSources.replace(ps.getName(), ps));
}

接下来,获取所有的propertySource对象

然后用stream方式遍历,如果是通过jasypt加密的,那么来执行方法makeEncryptable,使得propertySource对象具备加密解密的能力

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
private <T> PropertySource<T> makeEncryptable(PropertySource<T> propertySource, ConfigurableListableBeanFactory registry) {
    StringEncryptor encryptor = registry.getBean(environment.resolveRequiredPlaceholders(ENCRYPTOR_BEAN_PLACEHOLDER), StringEncryptor.class);
    PropertySource<T> encryptablePropertySource = interceptionMode == InterceptionMode.PROXY
            ? proxyPropertySource(propertySource, encryptor) : instantiatePropertySource(propertySource, encryptor);
    LOG.info("Converting PropertySource {} [{}] to {}", propertySource.getName(), propertySource.getClass().getName(),
             AopUtils.isAopProxy(encryptablePropertySource) ? "AOP Proxy" : encryptablePropertySource.getClass().getSimpleName());
    return encryptablePropertySource;
}

首先获取StringEncrypt Bean,然后执行instantiatePropertySource方法。

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
private <T> PropertySource<T> instantiatePropertySource(PropertySource<T> propertySource, StringEncryptor encryptor) {
    PropertySource<T> encryptablePropertySource;
    if (propertySource instanceof MapPropertySource) {
        encryptablePropertySource = (PropertySource<T>) new EncryptableMapPropertySourceWrapper((MapPropertySource) propertySource, encryptor);
    } else if (propertySource.getClass().getName().equals("org.springframework.boot.context.config.ConfigFileApplicationListener$ConfigurationPropertySources")) {
        //Some Spring Boot code actually casts property sources to this specific type so must be proxied.
        encryptablePropertySource = proxyPropertySource(propertySource, encryptor);
    } else if (propertySource instanceof EnumerablePropertySource) {
        encryptablePropertySource = new EncryptableEnumerablePropertySourceWrapper<>((EnumerablePropertySource) propertySource, encryptor);
    } else {
        encryptablePropertySource = new EncryptablePropertySourceWrapper<>(propertySource, encryptor);
    }
    return encryptablePropertySource;
}

可以看到将所有propertySource都会重新包装成新的EncryptablePropertySourceWrapper

log日志:将上面的6个对象包装一下

最后的application.properties中的配置项结果

完整的转换完成后的EncryptablePropertySourceWrapper

到这里就注册postProcessor完成了,而且每个PropertySource warpped,具备了加密解密的能力,然后继续回到AbstractApplicationContext的流程

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
// Instantiate all remaining (non-lazy-init) singletons.
finishBeanFactoryInitialization(beanFactory);

具体的解密过程

当spring boot项目启动的时候,需要用到属性值的时候,就是将原本spring中的propertySource的getProperty()方法委托给其自定义的实现EncryptablePropertySourceWrapper,调用其getProperty()方法,在这个方法的自定义实现中。判断是否是已经加密的value,如果是,则进行解密。如果不是,那就返回原值。

调用EncryptablePropertySourceWrapper的getProperty方法,其extends PropertySource,override了getProperty方法

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
public class EncryptablePropertySourceWrapper<T> extends PropertySource<T> implements EncryptablePropertySource<T> {
    private final PropertySource<T> delegate;
    private final StringEncryptor encryptor;

    public EncryptablePropertySourceWrapper(PropertySource<T> delegate, StringEncryptor encryptor) {
        super(delegate.getName(), delegate.getSource());
        Assert.notNull(delegate, "PropertySource delegate cannot be null");
        Assert.notNull(encryptor, "StringEncryptor cannot be null");
        this.delegate = delegate;
        this.encryptor = encryptor;
    }

    @Override
    public Object getProperty(String name) {
        return getProperty(encryptor, delegate, name);
    }
}

其getProperty就去调用其implements的EncryptablePropertySource的getProperty方法,于是执行下面

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
public interface EncryptablePropertySource<T> {
    public default Object getProperty(StringEncryptor encryptor, PropertySource<T> source, String name) {
        Object value = source.getProperty(name);
        if(value instanceof String) {
            String stringValue = String.valueOf(value);
            if(PropertyValueEncryptionUtils.isEncryptedValue(stringValue)) {
                value = PropertyValueEncryptionUtils.decrypt(stringValue, encryptor);
            }
        }
        return value;
    }
}

isEncryptedValue方法

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
private static final String ENCRYPTED_VALUE_PREFIX = "ENC(";
private static final String ENCRYPTED_VALUE_SUFFIX = ")";

public static boolean isEncryptedValue(final String value) {
    if (value == null) {
        return false;
    }
    final String trimmedValue = value.trim();
    return (trimmedValue.startsWith(ENCRYPTED_VALUE_PREFIX) && 
            trimmedValue.endsWith(ENCRYPTED_VALUE_SUFFIX));
}

如果通过 prefixes/suffixes 包裹的属性,那么返回解密后的值;

如果没有被包裹,那么返回原生的值;

如果是加密的值,那么就去解密

StandardPBEByteEncryptor

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
public byte[] decrypt(final byte[] encryptedMessage) 
throws EncryptionOperationNotPossibleException {
if (encryptedMessage == null) {
return null;
}
// Check initialization
if (!isInitialized()) {
initialize();
}
if (this.saltGenerator.includePlainSaltInEncryptionResults()) {
// Check that the received message is bigger than the salt
if (encryptedMessage.length <= this.saltSizeBytes) {
throw new EncryptionOperationNotPossibleException();
}
}
try {
// If we are using a salt generator which specifies the salt
// to be included into the encrypted message itself, get it from 
// there. If not, the salt is supposed to be fixed and thus the
// salt generator can be safely asked for it again.
byte[] salt = null; 
byte[] encryptedMessageKernel = null; 
if (this.saltGenerator.includePlainSaltInEncryptionResults()) {
final int saltStart = 0;
final int saltSize = 
(this.saltSizeBytes < encryptedMessage.length? this.saltSizeBytes : encryptedMessage.length);
final int encMesKernelStart =
(this.saltSizeBytes < encryptedMessage.length? this.saltSizeBytes : encryptedMessage.length);
final int encMesKernelSize = 
(this.saltSizeBytes < encryptedMessage.length? (encryptedMessage.length - this.saltSizeBytes) : 0);
salt = new byte[saltSize];
encryptedMessageKernel = new byte[encMesKernelSize];
System.arraycopy(encryptedMessage, saltStart, salt, 0, saltSize);
System.arraycopy(encryptedMessage, encMesKernelStart, encryptedMessageKernel, 0, encMesKernelSize);
} else if (!this.usingFixedSalt){
salt = this.saltGenerator.generateSalt(this.saltSizeBytes);
encryptedMessageKernel = encryptedMessage;
} else {
// this.usingFixedSalt == true
salt = this.fixedSaltInUse;
encryptedMessageKernel = encryptedMessage;
}
final byte[] decryptedMessage;
if (this.usingFixedSalt) {
/*
* Fixed salt is being used, therefore no initialization supposedly needed
*/
synchronized (this.decryptCipher) {
decryptedMessage = 
this.decryptCipher.doFinal(encryptedMessageKernel);
}
} else {
/*
* Perform decryption using the Cipher
*/
final PBEParameterSpec parameterSpec = 
new PBEParameterSpec(salt, this.keyObtentionIterations);
synchronized (this.decryptCipher) {
this.decryptCipher.init(
Cipher.DECRYPT_MODE, this.key, parameterSpec);
decryptedMessage = 
this.decryptCipher.doFinal(encryptedMessageKernel);
}
}
// Return the results
return decryptedMessage;
} catch (final InvalidKeyException e) {
// The problem could be not having the unlimited strength policies
// installed, so better give a usefull error message.
handleInvalidKeyException(e);
throw new EncryptionOperationNotPossibleException();
} catch (final Exception e) {
// If decryption fails, it is more secure not to return any 
// information about the cause in nested exceptions. Simply fail.
throw new EncryptionOperationNotPossibleException();
}
}

以spring.datasource.username为例:

明文是root

密文是ENC(X4OZ4csEAWqPCEvWf+aRPA==)

可以看到其salt是encryptedMessage的

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
System.arraycopy(encryptedMessage, saltStart, salt, 0, saltSize);
System.arraycopy(encryptedMessage, encMesKernelStart, encryptedMessageKernel, 0, encMesKernelSize);

0-7byte解析为salt,8-15byte解析为密文

然后就通过基本的PBE解析方式,来解析出来

ASCII码对应的结果就是root

PBE解析原理图:

加密过程:每一次随机产生新的salt,所以每一次加密后生成的密文是不同的

解密过程:

所以我们就可以知道,如果我获得了jasypt的password,那么由于其salt是放在encryptedMessage中的,那么我是没什么压力就可以解密的。

所以应该java -jar –Djasypt.encryptor.password=xxx abc.jar方式来启动服务。这样只要在运维端不泄露password,那么只拿到配置文件的密文,还是安全的。

补充1:查看JDK提供的Cipher算法

jasypt默认使用的是PBEWITHMD5ANDDES,其实JDK中由SunJCE所提供的。

可以通过下面的代码来查看JDK中提供了哪些Cipher算法

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
@Test
public void listJdkAlgorithm() {
/*        Provider[] providers = Security.getProviders();
for (Provider provider :
providers) {
LOGGER.info("security provider: {} , version: {}", provider.getName(), provider.getVersion());
LOGGER.info("security provider info: {}", provider.getInfo());
}*/
Set<String> messageDigest = Security.getAlgorithms("Cipher");
for (String s :
messageDigest) {
LOGGER.info("MessageDigest: {}",s);
}
}

更全面的安全方面的算法,如摘要算法、签名算法等,参考:

Standard Algorithm Name Documentation

补充2:PBE的基础算法demo,

而且可以看出来,jasypt中使用了几乎相同的代码来进行加解密的

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
public class PBECipher {
static final String CIPHER_NAME = "PBEwithMD5AndDES";
public static byte[] encrypt(String password, byte[] salt, byte[] input) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidAlgorithmParameterException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException {
PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray());
SecretKeyFactory secretKeyFactory = SecretKeyFactory.getInstance(CIPHER_NAME);
// 这个secretKey 就是我们将来要使用的加密的密钥
SecretKey secretKey = secretKeyFactory.generateSecret(keySpec);
// 传入1000,表示用户输入的口令,会与这个salt进行1000次的循环
PBEParameterSpec pbeParameterSpec = new PBEParameterSpec(salt, 1000);
Cipher cipher = Cipher.getInstance(CIPHER_NAME);
cipher.init(Cipher.ENCRYPT_MODE, secretKey, pbeParameterSpec);
return cipher.doFinal(input);
}
public static byte[] decrypt(String password, byte[] salt, byte[] input) throws NoSuchAlgorithmException,
InvalidKeySpecException, NoSuchPaddingException, InvalidAlgorithmParameterException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException {
PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray());
SecretKeyFactory secretKeyFactory = SecretKeyFactory.getInstance(CIPHER_NAME);
SecretKey secretKey = secretKeyFactory.generateSecret(keySpec);
PBEParameterSpec pbeParameterSpec = new PBEParameterSpec(salt, 1000);
Cipher cipher = Cipher.getInstance(CIPHER_NAME);
cipher.init(Cipher.DECRYPT_MODE, secretKey, pbeParameterSpec);
return cipher.doFinal(input);
}
}

测试

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
@Test
public void testPBE() throws NoSuchAlgorithmException, UnsupportedEncodingException, NoSuchPaddingException,
InvalidKeyException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException, InvalidKeySpecException {
String message = "constfafa";
String password = "ydbs";
byte[] salt = SecureRandom.getInstanceStrong().generateSeed(8);
System.out.printf("salt: %032x\n", new BigInteger(1, salt));
//加密和解密的salt是一样的
byte[] data = message.getBytes("UTF-8");
byte[] encrypt = PBECipher.encrypt(password, salt, data);
LOGGER.info("encrypted data: {}", Base64.getEncoder().encodeToString(encrypt));
byte[] decrypt = PBECipher.decrypt(password, salt, encrypt);
LOGGER.info("decrypted data: {}", new String(decrypt,"UTF-8"));
}

参考:

Jasypt之源码解析

官方github

8.Java 加解密技术系列之 PBE – crazyYong – 博客园

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022年9月26日 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
超详细的 Wireshark 使用教程
wireshark是非常流行的网络封包分析软件,简称小鲨鱼,功能十分强大。可以截取各种网络封包,显示网络封包的详细信息。
杰哥的IT之旅
2023/02/26
6.5K0
超详细的 Wireshark 使用教程
【工具】564- Wireshark抓包使用指南
这篇有点类似工具介绍。这个也是前几天有一个业务场景需要用到才了解的。希望对你的工作有所帮助,知道这个软件就好。今日早读文章由@Ju5tice授权分享。
pingan8787
2020/04/17
1.6K0
一文了解 Wireshark
勾选WLAN网卡(这里需要根据各自电脑网卡使用情况选择,简单的办法可以看使用的IP对应的网卡)。点击Start。启动抓包。
玖柒的小窝
2021/11/05
8000
一文了解 Wireshark
wireshark 过滤方式「建议收藏」
src host 192.168.1.104 && dst port 80 抓取主机地址为192.168.1.80、目的端口为80的数据包
全栈程序员站长
2022/09/07
10K0
wireshark 过滤方式「建议收藏」
wireshark简明教程,新手专用,挑实在的讲,不搞花里胡哨
如果安装过程中出现了问题,不妨看一下我昨晚写的问题解决教程:问题解决:wireshark之npcap无法安装、winpcap无法安装问题解决
看、未来
2021/09/18
8920
网络工程师的高端玩具:WireShark 从入门到精通,收藏!
抓包应该是每个技术人员掌握的基础知识,无论是技术支持运维人员或者是研发,多少都会遇到要抓包的情况,用过的抓包工具有fiddle、wireshark,作为一个不是经常要抓包的人员,学会用Wireshark就够了,毕竟它是功能最全面使用者最多的抓包工具。
网络技术联盟站
2023/03/01
1.1K0
网络工程师的高端玩具:WireShark 从入门到精通,收藏!
Python黑帽编程1.5 使用Wireshark练习网络协议分析
1.5.0.1 本系列教程说明 本系列教程,采用的大纲母本为《Understanding Network Hacks Attack and Defense with Python》一书,为了解决很多同学对英文书的恐惧,解决看书之后实战过程中遇到的问题而作。由于原书很多地方过于简略,笔者根据实际测试情况和最新的技术发展对内容做了大量的变更,当然最重要的是个人偏好。教程同时提供图文和视频教程两种方式,供不同喜好的同学选择。 1.5.0.2 本节前言 在上一节,笔者罗列的学习网络编程应该了解或掌握的网络基础知识
用户1631416
2018/04/12
1.3K0
Python黑帽编程1.5  使用Wireshark练习网络协议分析
保姆级WireShark入门教程,速度收藏!
来源:网络技术联盟站 链接:https://www.wljslmz.cn/19287.html
网络技术联盟站
2023/03/01
2.7K0
保姆级WireShark入门教程,速度收藏!
wireshark抓包工具详细说明及操作使用_wireshark ping抓包
wireshark是非常流行的网络封包分析软件,功能十分强大。可以截取各种网络封包,显示网络封包的详细信息。使用wireshark的人必须了解网络协议,否则就看不懂wireshark了。 为了安全考虑,wireshark只能查看封包,而不能修改封包的内容,或者发送封包。
全栈程序员站长
2022/10/04
1.3K0
wireshark抓包工具详细说明及操作使用_wireshark ping抓包
工具的使用 | Wireshark使用详解
WireShark只要是学计算机的人应该都听过,也用过。一个非常好用的免费的抓包工具。Wireshark使用WinPcap作为接口,直接与网卡进行数据报文交换。
谢公子
2022/01/13
2.6K0
工具的使用 | Wireshark使用详解
Wireshark过滤基础语法简析
Wireshark是一款强大的网络分析工具,它可以捕获和显示网络上的数据包,并提供多种过滤功能,让用户可以快速地找到自己感兴趣的数据包。
杜衡老师
2024/03/29
4550
Wireshark使用教程(界面说明、捕获过滤器表达式、显示过滤器表达式)
大家好,我是架构君,一个会写代码吟诗的架构师。今天说一说Wireshark使用教程(界面说明、捕获过滤器表达式、显示过滤器表达式),希望能够帮助大家进步!!!
Java架构师必看
2022/01/14
2.1K0
Wireshark使用教程(界面说明、捕获过滤器表达式、显示过滤器表达式)
抓包神器 Wireshark,帮你快速定位线上网络故障(2)
正式分享之前,先简单介绍一下 Wireshark。Wireshark 的前称是 Ethereal,该开源软件的功能正如其名,用来还原以太网的真相。
一猿小讲
2020/12/29
1.4K0
抓包神器 Wireshark,帮你快速定位线上网络故障(2)
Wireshark简单介绍和数据包分析
Wireshark是一款世界范围最广、最好用的网络封包分析软件,功能强大,界面友好直观,操作起来非常方便。它的创始人是Gerald Combs,前身是Ethereal,作为开源项目经过众多开发者的完善它已经成为使用量最大的安全工具之一。在CTF中也经常会使用wireshark进行流量数据包分析,可以快速检测网络通讯数据,获取最为详细的网络封包资料。Wireshark使用WinPCAP作为接口,直接与网卡进行数据报文交换。用户将在图形界面中浏览这些数据,实时监控TCP、session等网络动态,轻松完成网络管理工作。
安恒网络空间安全讲武堂
2018/12/29
3.5K0
Wireshark简单介绍和数据包分析
wireshark过滤语法总结[通俗易懂]
抓包采用wireshark,提取特征时,要对session进行过滤,找到关键的stream,这里总结了wireshark过滤的基本语法,供自己以后参考。(脑子记不住东西)
全栈程序员站长
2022/09/14
4.7K0
Wireshark介绍 与 过滤器表达式语法
WireShark安装,安装非常简单,处理安装路径自定义之外,其他都直接点下一步。
全栈程序员站长
2021/04/13
2.8K0
Wireshark介绍 与 过滤器表达式语法
快速学习多协议抓包利器Wireshark
因为Fiddler、charles采用是web代理的方式捕获数据包,无法完成如下这两个场景:
吾非同
2020/10/23
6830
Wireshark使用教程
把网卡的属性修改一下就可以,禁用 Checksum Offload(原理是让网卡硬件自己计算校验和,而不是交给操作系统的 tcp/ip 协议栈来计算):
全栈程序员站长
2022/07/04
7430
Wireshark使用教程
【最详细】Wireshark使用教程
到wireshark官网下载你所需要的版本,官网地址https://www.wireshark.org,选择下载,跟进自己的操作系统选择。
未名编程
2024/10/12
7830
【最详细】Wireshark使用教程
深入理解Wireshark过滤技法: 语法、表达式、操作符与常见故障排查全解析
Wireshark是一款强大的网络协议分析工具,能够捕获并分析网络中的数据包。本文将详细介绍如何通过Wireshark的精准过滤规则,帮助用户从海量数据报文中精确提取出所需的数据包,从而更有效地进行网络故障排查和安全分析。
RokasYang
2024/10/30
4.6K4
深入理解Wireshark过滤技法: 语法、表达式、操作符与常见故障排查全解析
推荐阅读
相关推荐
超详细的 Wireshark 使用教程
更多 >
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
查看详情【社区公告】 技术创作特训营有奖征文