<?xml version="1.0" encoding="utf-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><title>优雅人生</title><link>https://dllhook.com/</link><description>来也飘云，去也飘云，浮名永不追逐！</description><item><title>acme申请SSL证书</title><link>https://dllhook.com/post/263.html</link><description>&lt;h2 id=&quot;h2-cloudflare&quot;&gt;&lt;a name=&quot;CloudFlare&quot; class=&quot;reference-link&quot; href=&quot;#&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;CloudFlare&lt;/h2&gt;&lt;pre&gt;&lt;code&gt;export CF_Token=&amp;quot;&amp;quot;
export CF_Zone_ID=&amp;quot;&amp;quot;
export CF_Account_ID=&amp;quot;&amp;quot;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;h2-u963Fu91CCu4E91&quot;&gt;&lt;a name=&quot;阿里云&quot; class=&quot;reference-link&quot; href=&quot;#&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;阿里云&lt;/h2&gt;&lt;pre&gt;&lt;code&gt;export Ali_Key=&amp;quot;&amp;quot;
export Ali_Secret=&amp;quot;&amp;quot;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;h2-u8C37u6B4Cu4E91&quot;&gt;&lt;a name=&quot;谷歌云&quot; class=&quot;reference-link&quot; href=&quot;#&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;谷歌云&lt;/h2&gt;&lt;p&gt;先注册账号&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;acme.sh  --register-account -m piaoyunsoft@163.com --server google \
    --eab-kid 你的kid \
    --eab-hmac-key 你的key&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;h2-u751Fu6210u8BC1u4E66&quot;&gt;&lt;a name=&quot;生成证书&quot; class=&quot;reference-link&quot; href=&quot;#&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;生成证书&lt;/h2&gt;&lt;pre&gt;&lt;code&gt;acme.sh --issue --dns dns_cf -d dllhook.com -d *.dllhook.com --keylength 2048&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;dns_cf根据实际情况改动&lt;/p&gt;
&lt;h2 id=&quot;h2-u5B89u88C5u8BC1u4E66&quot;&gt;&lt;a name=&quot;安装证书&quot; class=&quot;reference-link&quot; href=&quot;#&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;安装证书&lt;/h2&gt;&lt;pre&gt;&lt;code&gt;acme.sh --install-cert -d dllhook.com \
--key-file       /www/path/cert/dllhook.com.key  \
--fullchain-file /www/path/cert/dllhook.com.pem \
--capath         /www/path/cert/dllhook.com.ca.pem  \
--reloadcmd      &amp;quot;service nginxd restart&amp;quot;&lt;/code&gt;&lt;/pre&gt;</description><pubDate>Wed, 15 Jan 2025 14:20:33 +0800</pubDate></item><item><title>使用``vmss2core``转储``dump``文件</title><link>https://dllhook.com/post/262.html</link><description>&lt;p&gt;使用&lt;code&gt;vmss2core&lt;/code&gt;转储&lt;code&gt;dump&lt;/code&gt;文件&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;C:\Program Files (x86)\VMware\VMware Workstation&amp;gt;vmss2core.exe -W8 &amp;quot;F:\VM\Windows 10 x64\Windows 10 x64-b771606e.vmss&amp;quot; &amp;quot;F:\VM\Windows 10 x64\Windows 10 x64-b771606e.vmem&amp;quot;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;路径自行修改&lt;/p&gt;
</description><pubDate>Thu, 24 Aug 2023 10:10:00 +0800</pubDate></item><item><title>利用fs::path进行wstring与string互转</title><link>https://dllhook.com/post/261.html</link><description>&lt;pre&gt;&lt;code&gt;#if _MSVC_LANG &amp;lt; 201703L // /std:c++17
#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
#include &amp;lt;experimental/filesystem&amp;gt;
namespace fs = std::experimental::filesystem;
#else
#include &amp;lt;filesystem&amp;gt;
namespace fs = std::filesystem;
#endif

std::wstring StringToWString(const std::string&amp;amp; str)
{
    fs::path p = str;
    return p.wstring();
}

std::string WStringToString(const std::wstring&amp;amp; wstr)
{
    fs::path p = wstr;
    return p.string();
}&lt;/code&gt;&lt;/pre&gt;</description><pubDate>Thu, 18 May 2023 14:58:06 +0800</pubDate></item><item><title>封装bit位基本操作</title><link>https://dllhook.com/post/260.html</link><description>&lt;pre&gt;&lt;code&gt;// 设置指定位置的比特位为1
void setBit(BYTE&amp;amp; byte, int position) 
{
    byte |= (1 &amp;lt;&amp;lt; position);
}

// 清除指定位置的比特位，将其设置为0
void clearBit(BYTE&amp;amp; byte, int position) 
{
    byte &amp;amp;= ~(1 &amp;lt;&amp;lt; position);
}

// 翻转指定位置的比特位，如果原来是1则变为0，如果原来是0则变为1
void toggleBit(BYTE&amp;amp; byte, int position) 
{
    byte ^= (1 &amp;lt;&amp;lt; position);
}

// 检查指定位置的比特位是否为1
bool checkBit(BYTE byte, int position) 
{
    return (byte &amp;amp; (1 &amp;lt;&amp;lt; position)) != 0;
}&lt;/code&gt;&lt;/pre&gt;</description><pubDate>Wed, 10 May 2023 14:53:02 +0800</pubDate></item><item><title>利用CryptGenRandom生成高精度随机数</title><link>https://dllhook.com/post/259.html</link><description>&lt;pre&gt;&lt;code&gt;#include &amp;lt;windows.h&amp;gt;
#include &amp;lt;wincrypt.h&amp;gt;

// https://www.dllhook.com
BOOL GenerateRandomData(LPVOID buffer, DWORD dwLen)
{
    HCRYPTPROV hProv = 0;
    if (!CryptAcquireContext(&amp;amp;hProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
    {
        return FALSE;
    }

    BOOL result = CryptGenRandom(hProv, dwLen, (BYTE*)buffer);

    CryptReleaseContext(hProv, 0);
    return result;
}

void TestCryptGenRandom()
{
    const int len = 16;
    BYTE buffer[len];

    if (GenerateRandomData(buffer, len))
    {
        printf(&amp;quot;Random data: &amp;quot;);
        for (int i = 0; i &amp;lt; len; i++)
        {
            printf(&amp;quot;%02X &amp;quot;, buffer[i]);
        }
        printf(&amp;quot;\n&amp;quot;);
    }
}

int main()
{
    TestCryptGenRandom();
}
&lt;/code&gt;&lt;/pre&gt;</description><pubDate>Thu, 20 Apr 2023 15:02:36 +0800</pubDate></item><item><title>Ansi、Unicode互相转换（Windows/ntdll函数）</title><link>https://dllhook.com/post/258.html</link><description>&lt;pre&gt;&lt;code&gt;
#include &amp;lt;windows.h&amp;gt;
#include &amp;lt;winternl.h&amp;gt;
#include &amp;lt;cstdio&amp;gt;

// https://www.dllhook.com
std::wstring ConvertAnsiToUnicode(const std::string&amp;amp; ansiStr)
{
    ANSI_STRING ansiString;
    RtlInitAnsiString(&amp;amp;ansiString, ansiStr.c_str());

    UNICODE_STRING unicodeString;
    RtlAnsiStringToUnicodeString(&amp;amp;unicodeString, &amp;amp;ansiString, TRUE);
    const size_t bufferLength = unicodeString.MaximumLength;

    std::unique_ptr&amp;lt;wchar_t[]&amp;gt; buffer(new wchar_t[bufferLength]);

    unicodeString.Buffer = buffer.get();
    unicodeString.Length = 0;
    unicodeString.MaximumLength = static_cast&amp;lt;USHORT&amp;gt;(bufferLength);

    RtlAnsiStringToUnicodeString(&amp;amp;unicodeString, &amp;amp;ansiString, FALSE);

    const std::wstring result(unicodeString.Buffer, unicodeString.Length / sizeof(wchar_t));

    return result;
}

std::string ConvertUnicodeToAnsi(const std::wstring&amp;amp; unicodeStr)
{
    ANSI_STRING ansiString;
    RtlInitAnsiString(&amp;amp;ansiString, NULL);

    UNICODE_STRING unicodeString;
    RtlInitUnicodeString(&amp;amp;unicodeString, unicodeStr.c_str());

    RtlUnicodeStringToAnsiString(&amp;amp;ansiString, &amp;amp;unicodeString, TRUE);

    std::string str(ansiString.Buffer, ansiString.Length);

    RtlFreeAnsiString(&amp;amp;ansiString);

    return str;
}&lt;/code&gt;&lt;/pre&gt;</description><pubDate>Thu, 20 Apr 2023 14:56:11 +0800</pubDate></item><item><title>#pragma code_seg(&amp;quot;.piao&amp;quot;)强制指定代码区段</title><link>https://dllhook.com/post/257.html</link><description>&lt;p&gt;使用&lt;code&gt;#pragma code_seg&lt;/code&gt;强制指定代码编译或所处区段。&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#pragma code_seg(&amp;quot;.piao&amp;quot;)

#pragma optimize(&amp;quot;&amp;quot;, off) // 关闭优化
void PiaoYun()
{
    // TODO
}
#pragma optimize(&amp;quot;&amp;quot;, on) // 开启优化&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;驱动开发中使用得比较多的是如下几种：&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#pragma  code_seg(“PAGE”)
将此部分代码放入分页内存中运行。

#pragma  code_seg()
将代码段设置为默认的代码段

#pragma  code_seg(&amp;quot;INIT&amp;quot;)
加载到INIT内存区域中，成功加载后，可以退出内存&lt;/code&gt;&lt;/pre&gt;</description><pubDate>Wed, 01 Feb 2023 14:30:54 +0800</pubDate></item><item><title>Android Studio Native(so) 隐藏符号</title><link>https://dllhook.com/post/256.html</link><description>&lt;h2 id=&quot;h2-cmakelists-txt&quot;&gt;&lt;a name=&quot;CMakeLists.txt&quot; class=&quot;reference-link&quot; href=&quot;#&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;CMakeLists.txt&lt;/h2&gt;&lt;pre&gt;&lt;code&gt;set(CMAKE_C_VISIBILITY_PRESET hidden)

set(CMAKE_CXX_VISIBILITY_PRESET hidden)&lt;/code&gt;&lt;/pre&gt;</description><pubDate>Wed, 04 Jan 2023 15:22:10 +0800</pubDate></item><item><title>VS生成shellcode配置</title><link>https://dllhook.com/post/255.html</link><description>&lt;h2 id=&quot;h2-1-&quot;&gt;&lt;a name=&quot;1.配置&quot; class=&quot;reference-link&quot; href=&quot;#&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;1.配置&lt;/h2&gt;&lt;p&gt;禁用优化、全程序优化（这个非常重要），如下图所示。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dllhook.com/zb_users/upload/2022/08/202208311548287780788.png&quot; alt=&quot;禁用优化&quot;&gt;&lt;/p&gt;
&lt;p&gt;禁用安全检查、设置MT，如下图所示。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dllhook.com/zb_users/upload/2022/08/202208311549054882180.png&quot; alt=&quot;禁用安全检查&quot;&gt;&lt;/p&gt;
&lt;p&gt;修改入口点为&lt;code&gt;Shellcode&lt;/code&gt;函数的名称，如下图所示。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dllhook.com/zb_users/upload/2022/08/202208311549268533136.png&quot; alt=&quot;修改入口点&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;h2-2-&quot;&gt;&lt;a name=&quot;2.成品&quot; class=&quot;reference-link&quot; href=&quot;#&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;2.成品&lt;/h2&gt;&lt;p&gt;生成的&lt;code&gt;exe&lt;/code&gt;非常漂亮，如下图所示。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dllhook.com/zb_users/upload/2022/08/202208311549445210555.png&quot; alt=&quot;生成的exe&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;h2-3-&quot;&gt;&lt;a name=&quot;3.提取&quot; class=&quot;reference-link&quot; href=&quot;#&quot;&gt;&lt;/a&gt;&lt;span class=&quot;header-link octicon octicon-link&quot;&gt;&lt;/span&gt;3.提取&lt;/h2&gt;&lt;p&gt;使用&lt;code&gt;010 editor&lt;/code&gt;之类的工具提取&lt;code&gt;shellcode&lt;/code&gt;即可。如下图所示。&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dllhook.com/zb_users/upload/2022/08/202208311549581028790.png&quot; alt=&quot;提取shellcode&quot;&gt;&lt;/p&gt;
</description><pubDate>Wed, 31 Aug 2022 15:47:41 +0800</pubDate></item><item><title>C++11之UTF8编码转换</title><link>https://dllhook.com/post/254.html</link><description>&lt;p&gt;C++11语法转换UTF8很方便，记录一下&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;inline std::wstring to_wide_string(const std::string&amp;amp; input)
{
    std::wstring_convert&amp;lt;std::codecvt_utf8&amp;lt;wchar_t&amp;gt;&amp;gt; converter;
    return converter.from_bytes(input);
}

inline std::string to_byte_string(const std::wstring&amp;amp; input)
{
    std::wstring_convert&amp;lt;std::codecvt_utf8&amp;lt;wchar_t&amp;gt;&amp;gt; converter;
    return converter.to_bytes(input);
}

int main()
{
    std::string string = to_byte_string(L&amp;quot;中国飘云阁&amp;quot;); // &amp;quot;\xE4\xB8\xAD\xE5\x9B\xBD\xE9\xA3\x98\xE4\xBA\x91\xE9\x98\x81&amp;quot;
    std::wstring wide_string = to_wide_string(&amp;quot;\xE4\xB8\xAD\xE5\x9B\xBD\xE9\xA3\x98\xE4\xBA\x91\xE9\x98\x81&amp;quot;); // 中国飘云阁
}&lt;/code&gt;&lt;/pre&gt;</description><pubDate>Thu, 06 May 2021 14:20:10 +0800</pubDate></item></channel></rss>