抱歉,您的浏览器无法访问本站
本页面需要浏览器支持(启用)JavaScript
了解详情 >

/etc/vsftpd/vsftpd.conf

1
2
3
4
## Enable active mode
port_enable=YES
connect_from_port_20=YES
ftp_data_port=20

通过自定义异常拦截器,讲程序异常,转化为 org.springframework.http.ResponseEntity.ResponseEntity,这个类允许自定义任意的状态码和错误数据。

代码

1
2
3
4
5
6
7
8
9
public void save(BusUser busUser) {
BusUser.checkAccountAndPasswordNotNull(busUser);
if (busUserRepository.findByAccount(busUser.getAccount()).size() != 0) {
throw new ApiException(ErrorType.SAVE_EXIST, "账号已经存在!");
}
// 存储的时候,服务器应该再次进行一次 hash,双重哈希,避免数据库泄漏,密码被人拿去登陆 todo
busUserRepository.save(busUser);
log.info("增加了一个用户:" + busUser.getAccount());
}

GlobalExceptionHandler.class

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package pri.anarckk.common;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import pri.anarckk.common.entity.ErrorEntity;
import pri.anarckk.common.exception.ApiException;

/**
* Created by zzanar on 2019/6/1
* 全局异常事件处理类
*/
@ControllerAdvice
public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
private final Logger logger = LoggerFactory.getLogger(GlobalExceptionHandler.class);

@ResponseBody
@ExceptionHandler
public ResponseEntity<ErrorEntity> handleException(Exception e) {
if (e instanceof ApiException) {
ApiException apiException = (ApiException) e;
ErrorType code = apiException.getCode();
apiException.error(logger);
return new ResponseEntity<>(new ErrorEntity(code.code(), apiException.getMessage()), code.httpStatus());
} else {
logger.error(e.getMessage(), e);
return new ResponseEntity<>(new ErrorEntity(ErrorType.UN_KNOW.code(), ErrorType.UN_KNOW.message()), ErrorType.UN_KNOW.httpStatus());
}
}
}

https://www.cnblogs.com/badtree/articles/9145493.html

创建容器的时候报错WARNING: IPv4 forwarding is disabled. Networking will not work.

script
1
2
docker run -p 3000:3000 liyasthomas/postwoman:latest
WARNING: IPv4 forwarding is disabled. Networking will not work.

解决方法

script
1
vim  /usr/lib/sysctl.d/00-system.conf

添加如下代码:

script
1
net.ipv4.ip_forward=1

重启network服务

script
1
systemctl restart network

完成以后,删除错误的容器,再次创建新容器,就不再报错了。

查看IP

script
1
ip addr

查看路由

script
1
ip route

查看DNS

script
1
cat /etc/resolv.conf

查看主机名

script
1
hostname

查看网关

script
1
netstat -rn

转载:https://www.cnblogs.com/loveyoulx/p/9526068.html

思考与理解

SQL注入本质上,是程序将用户输入的参数当成命令的一部分进行解析,从而使用户可以自由搜索我们的数据库中的记录。

解决方法,是将用户输入的内容进行解析和转义,将用户输入内容中的恶意代码转为普通字符串,从而保护数据库不被攻击。

SQL 注入攻击

SQL注入攻击,简称SQL攻击或注入攻击,是发生于应用程序之数据库层的安全漏洞。简而言之,是在输入的字符串之中注入SQL指令,在设计不良的程序当中忽略了检查,那么这些注入进去的指令就会被数据库服务器误认为是正常的SQL指令而运行,因此遭到破坏或是入侵。

最常见的就是我们在应用程序中使用字符串联结方式组合 SQL 指令,有心之人就会写一些特殊的符号,恶意篡改原本的 SQL 语法的作用,达到注入攻击的目的。

举个栗子:

比如验证用户登录需要 username 和 password,编写的 SQL 语句如下:

1
String querySql = "select * from user where (name = '"+ username +"') and (pw = '"+ password +"');";

username 和 password 字段被恶意填入

1
username = "1' OR '1'='1";

1
password = "1' OR '1'='1";

将导致原本的 SQL 字符串被填为:

1
select * from user where (name = '1' or '1'='1') and (pw = '1' or '1'='1');

实际上运行的 SQL 语句将变成:

1
select * from user;

也就是不再需要 username 和 password 账密即达到登录的目的,结果不言而喻。

https://docs.microsoft.com/zh-cn/windows-hardware/drivers/kernel/

  1. 指定cmd窗口运行时名称

  1)直接执行命令:title 窗口名称 

  2)bat文件中直接加上命令:title 窗口名称

例子:

script
1
2
title test_ v1
java -jar -Dfile.encoding=utf-8 test-1.0.1.jar

iis 的 default web site 默认的本地网站路径

%SystemDrive%\inetpub\wwwroot

在windows平台下,使用系统的记事本以UTF-8编码格式存储了一个文本文件,但是由于Microsoft开发记事本的团队使用了一个非常怪异的行为来保存UTF-8编码的文件,它们自作聪明地在每个文件开头添加了0xefbbbf(十六进制)的字符,所以我们就会遇到很多不可思议的问题,比如,网页第一行可能会显示一个“?”,明明正确的程序一编译就报出语法错误,等等。

下面为一段测试程序,由记事本编辑的文本文件导致文件开头前三个字符乱码。