ls ${privilege_path}/*.sh | xargs sed -i "s/{{${key}}}/${val}/g"
时间: 2023-11-23 17:56:28 浏览: 205
这是一个用于替换指定目录下所有.sh文件中的文本的命令。其中`${privilege_path}`是一个变量,表示目录路径,`*.sh`表示匹配该目录下所有以.sh结尾的文件,`|`表示管道,将前一个命令的输出作为后一个命令的输入,`xargs`命令将前一个命令的输出作为参数传递给后一个命令,`sed`命令用于替换文本,其中`s/{{${key}}}/${val}/g`表示将文本中所有`${{key}}`的地方替换成`${val}`。具体的操作步骤如下:
```shell
# 切换到目标目录
cd ${privilege_path}
# 查找所有以.sh结尾的文件,并将它们的路径传递给xargs命令
ls ${privilege_path}/*.sh | xargs \
# 对于每个文件,执行sed命令进行文本替换
sed -i "s/{{${key}}}/${val}/g"
```
相关问题
public void addInterceptors(InterceptorRegistry registry){ registry.addInterceptor(new MVCInterceptor()) .addPathPatterns("/**") .excludePathPatterns("/show_login") .excludePathPatterns("/check_login_mybatis") .excludePathPatterns("/no_privilege") .excludePathPatterns("/register") .excludePathPatterns("/js/*") .excludePathPatterns("/css/*") .excludePathPatterns("/image/*") .excludePathPatterns("/css/img/*") .excludePathPatterns("/error") .excludePathPatterns("/css/font/*") .excludePathPatterns("/*.js") .excludePathPatterns("/*.html") ; }
这段代码是在Spring MVC框架中注册拦截器,其中添加了一个MVCInterceptor拦截器,该拦截器会拦截所有的请求("/**"),但排除了一些特定的路径,如登录、注册、静态资源等。
拦截器可以在请求到达Controller之前或之后对请求进行处理,用于实现一些通用的功能,例如身份验证、日志记录等。在Spring MVC中,可以通过实现HandlerInterceptor接口来自定义拦截器,并通过InterceptorRegistry进行注册。在注册时,可以指定拦截的路径和排除的路径,以及拦截器的优先级等。
ALERT: ET EXPLOIT Grafana 8.x Path Traversal (CVE-2021-43798) 82 Timestamp 2023-06-07T14:21:22.266209+0000 Sensor suricata Protocol TCP Source 172.16.1.23:34770 Destination 10.0.1.4:445 In Interface eno2 Flow ID 997920879570354 Signature ET EXPLOIT Grafana 8.x Path Traversal (CVE-2021-43798) Category Attempted Administrator Privilege Gain Signature ID 1: 2034629 :2 Severity 1 History 2023-06-07 22:26:19 - Archived by anonymous HTTP Hostname: 10.0.1.4 Http Method: GET Http Port: 445 Http User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.3 Safari/605.1.15 Length: 0 Protocol: HTTP/1.1 Url: /public/plugins/welcome/../../../../../../../../../etc/passwd User Agent.Device: Mac User Agent.Major: 12 User Agent.Minor: 0 User Agent.Name: Safari User Agent.Os: Mac OS X User Agent.Os Full: Mac OS X 10.14.3 User Agent.Os Major: 10 User Agent.Os Minor: 14 User Agent.Os Name: Mac OS X User Agent.Os Patch: 3 User Agent.Os Version: 10.14.3 User Agent.Patch: 3 User Agent.Version: 12.0.3 Payload GET /public/plugins/welcome/../../../../../../../../../etc/passwd HTTP/1.1..Host: 10.0.1.4:445..User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.3 Safari/605.1.15..Accept-Encoding: gzip....
It looks like you have provided a log of a security event that alerts of a potential exploit of CVE-2021-43798, which is a path traversal vulnerability found in Grafana 8.x. The log shows that there was an attempted administrator privilege gain on the destination IP address 10.0.1.4 from the source IP address 172.16.1.23. The HTTP request was a GET method to the URL "/public/plugins/welcome/../../../../../../../../../etc/passwd" which is an attempt to access the system's password file. The user agent in the request shows that it was made using Safari on a Mac OS X machine. It is important to investigate and mitigate this security event to prevent any potential damage to the system.
阅读全文