0%

winapi判断目录访问权限

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
35
36
37
38
39
bool CanAccessFolder( LPCTSTR folderName, DWORD genericAccessRights )
{
bool bRet = false;
DWORD length = 0;
if (!::GetFileSecurity(folderName, OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION
| DACL_SECURITY_INFORMATION, NULL, NULL, &length ) &&
ERROR_INSUFFICIENT_BUFFER == ::GetLastError()) {
PSECURITY_DESCRIPTOR security = static_cast<PSECURITY_DESCRIPTOR >( ::malloc( length ) );
if (security && ::GetFileSecurity( folderName, OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION
| DACL_SECURITY_INFORMATION, security, length, &length )) {
HANDLE hToken = NULL;
if (::OpenProcessToken(::GetCurrentProcess(), TOKEN_IMPERSONATE | TOKEN_QUERY |
TOKEN_DUPLICATE | STANDARD_RIGHTS_READ, &hToken )) {
HANDLE hImpersonatedToken = NULL;
if (::DuplicateToken( hToken, SecurityImpersonation, &hImpersonatedToken )) {
GENERIC_MAPPING mapping = { 0xFFFFFFFF };
PRIVILEGE_SET privileges = { 0 };
DWORD grantedAccess = 0, privilegesLength = sizeof( privileges );
BOOL result = FALSE;

mapping.GenericRead = FILE_GENERIC_READ;
mapping.GenericWrite = FILE_GENERIC_WRITE;
mapping.GenericExecute = FILE_GENERIC_EXECUTE;
mapping.GenericAll = FILE_ALL_ACCESS;

::MapGenericMask( &genericAccessRights, &mapping );
if (::AccessCheck( security, hImpersonatedToken, genericAccessRights,
&mapping, &privileges, &privilegesLength, &grantedAccess, &result )) {
bRet = (result == TRUE);
}
::CloseHandle( hImpersonatedToken );
}
::CloseHandle( hToken );
}
::free( security );
}
}
return bRet;
}
阅读全文 »

本次博主将使用 c++ 操作 libcurl 进行 get post
摘自官网: libcurl是一个免费且易于使用的客户端URL传输库,支持DICT、FILE、FTP、FTPS、GOPHER、GOPHERS、HTTP、HTTPS、IMAP、IMAPS、LDAP、LDAPS、MQTT、POP3、POP3S、RTMP、RTMPS、RTSP、SCP、SFTP、SMB、SMBS、SMTP、SMTPS、TELNET和TFTP。libcurl支持SSL证书、HTTP POST、HTTP PUT、FTP上载、基于HTTP表单的上载、代理、HTTP/2、HTTP/3、cookie、用户+密码身份验证(基本、摘要、NTLM、协商、Kerberos)、文件传输恢复、HTTP代理隧道等
本章节博主将使用 libcurl 完成 get post json post form 操作

阅读全文 »

想为你的域名搭建权威DNS? 来试试 PowerDNS
PowerDNS成立于20世纪90年代末,是开源DNS软件的主要供应商,本次博主将编写 PowerDNS 搭建教程
以及如何配置 PowerDNS-Admindnssec

阅读全文 »

DOH:
dns over https 查询和响应是加密的,但它们是通过HTTP或HTTP/2协议发送的,他一般在443端口运行

DOT:
dns over tls 是加密DNS查询以确保其安全和私有的标准,DoT使用安全协议TLS,它在853端口上运行

阅读全文 »

application config file

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
server.port: 8080

spring:
datasource:
hikari:
sqlite:
jdbc-url: jdbc:sqlite:database/sqlite.db
username:
password:
driver-class-name: org.sqlite.JDBC
mysql:
jdbc-url: jdbc:mysql://127.0.0.1:3306/db0314?useUnicode=true&characterEncoding=UTF-8
username: root
password: 123456
driverClassName: com.mysql.cj.jdbc.Driver
阅读全文 »

运行下面指令

1
2
3
4
5
6
7
8
9
10
11
sudo apt update
sudo apt install software-properties-common gnupg2 curl -y

curl -LsS -O https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
sudo bash mariadb_repo_setup

sudo apt update
sudo apt install mariadb-server mariadb-client

sudo systemctl start mariadb
sudo systemctl enable mariadb

初始化root密码为空
使用 mysql -uroot -p 登录

1
sudo mysql -uroot -p