| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 687 人关注过本帖
标题:自定义函数怎么加密?
只看楼主 加入收藏
qzonc
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2017-2-24
结帖率:0
收藏
已结贴  问题点数:20 回复次数:1 
自定义函数怎么加密?
BOOL http_get(LPCTSTR szURL, LPCTSTR szFileName)
{
    BOOL        bRet = FALSE;
    HINTERNET    hInternet, hUrl;
    HANDLE        hFile;
    char        buffer[1024];
    DWORD        dwBytesRead = 0;
    DWORD        dwBytesWritten = 0;

    typedef HANDLE (WINAPI *InternetOpenAT)
        (
        __in_opt LPCSTR lpszAgent,
        __in DWORD dwAccessType,
        __in_opt LPCSTR lpszProxy,
        __in_opt LPCSTR lpszProxyBypass,
        __in DWORD dwFlags
 );
    typedef HINTERNET
        (WINAPI
        *InternetOpenUrlAT)(
        __in HINTERNET hInternet,
        __in LPCSTR lpszUrl,
        __in_ecount_opt(dwHeadersLength) LPCSTR lpszHeaders,
        __in DWORD dwHeadersLength,
        __in DWORD dwFlags,
        __in_opt DWORD_PTR dwContext
        );
   
    char TRwAppQ[] = {'I','n','t','e','r','n','e','t','O','p','e','n','U','r','l','A','\0'};
    InternetOpenUrlAT pInternetOpenUrlA=(InternetOpenUrlAT)GetProcAddress(LoadLibrary(jzSApmA),TRwAppQ);
    char yBJFQWx[] = {'I','n','t','e','r','n','e','t','O','p','e','n','A','\0'};
    InternetOpenAT pInternetOpenA= (InternetOpenAT)GetProcAddress(LoadLibrary(jzSApmA),yBJFQWx);
   
        char sIQkS10[] = {'M','o','z','i','l','l','a','/','4','.','0',' ','(','c','o','m','p','a','t','i','b','l','e',')','\0'};
        hInternet = pInternetOpenA(sIQkS10, INTERNET_OPEN_TYPE_PRECONFIG, NULL,INTERNET_INVALID_PORT_NUMBER,0);   
        hUrl = pInternetOpenUrlA(hInternet, szURL, NULL, 0, INTERNET_FLAG_RELOAD, 0);
    if (hUrl == NULL)        
            return FALSE;
        if (hUrl == NULL)
                return FALSE;
    // 创建文件
    hFile = pCreateFileA(szFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
    if (hFile != INVALID_HANDLE_VALUE)
    {
        do
        {
            
            typedef BOOL
                (WINAPI
                *WriteFileT)(
                __in        HANDLE hFile,
                __in_bcount(nNumberOfBytesToWrite) LPCVOID lpBuffer,
                __in        DWORD nNumberOfBytesToWrite,
                __out_opt   LPDWORD lpNumberOfBytesWritten,
                __inout_opt LPOVERLAPPED lpOverlapped
                );
            
            
            typedef BOOL
                (WINAPI
                *InternetReadFileT)(
                __in HINTERNET hFile,
                __out_bcount(dwNumberOfBytesToRead) LPVOID lpBuffer,
                __in DWORD dwNumberOfBytesToRead,
                __out LPDWORD lpdwNumberOfBytesRead
                );
            
            
            char DAkhElS[] = {'I','n','t','e','r','n','e','t','R','e','a','d','F','i','l','e','\0'};
            InternetReadFileT pInternetReadFile=(InternetReadFileT)GetProcAddress(LoadLibrary(jzSApmA),DAkhElS);   
            char JaGpODT[] = {'W','r','i','t','e','F','i','l','e','\0'};
            WriteFileT pWriteFile=(WriteFileT)GetProcAddress(LoadLibrary(AyRApxh),JaGpODT);
            memset(buffer, 0, sizeof(buffer));
            pInternetReadFile(hUrl, buffer, sizeof(buffer), &dwBytesRead);
            pWriteFile(hFile, buffer, dwBytesRead, &dwBytesWritten, NULL);
        } while(dwBytesRead > 0);
        pCloseHandle(hFile);
        bRet = TRUE;
}

   
   
    typedef BOOL
        (WINAPI
        *InternetCloseHandleT)(
        __in HINTERNET hInternet
        );   
    char MQiOCfK[] = {'I','n','t','e','r','n','e','t','C','l','o','s','e','H','a','n','d','l','e','\0'};
    InternetCloseHandleT pInternetCloseHandle=(InternetCloseHandleT)GetProcAddress(LoadLibrary(jzSApmA),MQiOCfK);
    pInternetCloseHandle(hUrl);
    pInternetCloseHandle(hInternet);

    return bRet;
}


各位大牛 老司机 小白想问下如何加密这段自定义函数
搜索更多相关主题的帖子: 加密 
2017-02-24 16:02
rjsp
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:528
帖 子:9025
专家分:54030
注 册:2011-1-18
收藏
得分:20 
你所谓的加密,是不是 让机器能执行,但混乱得人类看不懂
理论上不太行,机器是人造的,机器能执行人就能懂。

一个活生生的例子就是你这段代码,乱七八糟的还有bug,等同于加密了。我现在解密给你看:
程序代码:
#include <windows.h>
#include <wininet.h>
#pragma comment( lib, "Wininet.lib" )

bool http_get( LPCTSTR szURL, LPCTSTR szFileName )
{
    bool ret = false;

    HINTERNET hInternet = InternetOpen( TEXT("Mozilla/4.0 (compatible)"), INTERNET_OPEN_TYPE_PRECONFIG, NULL, INTERNET_INVALID_PORT_NUMBER, 0 );
    if( hInternet )
    {
        HINTERNET hUrl = InternetOpenUrl( hInternet, szURL, NULL, 0, INTERNET_FLAG_RELOAD, 0 );
        if( hUrl )
        {
            HANDLE hFile = CreateFile( szFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL );
            if( hFile != INVALID_HANDLE_VALUE )
            {
                BYTE buffer[1024];
                DWORD dwBytesRead, dwBytesWritten;
                while( InternetReadFile(hUrl,buffer,sizeof(buffer),&dwBytesRead) && dwBytesRead )
                    WriteFile( hFile, buffer, dwBytesRead, &dwBytesWritten, NULL );

                CloseHandle( hFile );
                ret = true;
            }

            InternetCloseHandle( hUrl );
        }

        InternetCloseHandle( hInternet );
    }

    return ret;
}

int main( void )
{
    http_get( TEXT("http://baidu.com"), TEXT("d:\\a.html") );
}

2017-02-24 16:30
快速回复:自定义函数怎么加密?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025685 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved