主頁 >  其他 > 銀聯支付介面除錯

銀聯支付介面除錯

2020-09-10 02:29:42 其他

最近一周做銀聯的交易介面,踩了不少的坑,現在把代碼全部奉上,

 

#include <io.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
#include <tchar.h>
#include <winsock2.h>
#include <Windows.h>

#include <openssl/rsa.h>
#include <openssl/evp.h>
#include <openssl/objects.h>
#include <openssl/x509.h>
#include <openssl/err.h>
#include <openssl/pem.h>
#include <openssl/ssl.h>

#include "WjCryptLib_Sha1.h"
#include "WjCryptLib_Sha256.h"

#ifdef  __cplusplus
extern "C" {
#endif

#include <openssl/applink.c>

#ifdef  __cplusplus
}
#endif

//static char basis_64[203] = "/012FGpqrWXY39abPQRBjkcdNOwxCHIJefgzAvMKLhistuSTUVylmnoDEZ45678+???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????";
static char basis_64[203] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????";

static char Pad64 = '=';

int Base64Encode(src, srclength, target, targsize)
    unsigned char const *src;
    size_t srclength;
    char *target;
    size_t targsize;
{
    size_t datalength = 0;
    unsigned char input[3];
    unsigned char output[4];
    int i;

    while (2 < srclength) {
        input[0] = *src++;
        input[1] = *src++;
        input[2] = *src++;
        srclength -= 3;

        output[0] = input[0] >> 2;
        output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
        output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
        output[3] = input[2] & 0x3f;

        if (datalength + 4 > targsize)
            return (-1);
        target[datalength++] = basis_64[output[0]];
        target[datalength++] = basis_64[output[1]];
        target[datalength++] = basis_64[output[2]];
        target[datalength++] = basis_64[output[3]];
    }
    
    /* Now we worry about padding. */
    if (0 != srclength) {
        /* Get what's left. */
        input[0] = input[1] = input[2] = '\0';
        for (i = 0; i < srclength; i++)
            input[i] = *src++;
    
        output[0] = input[0] >> 2;
        output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
        output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);

        if (datalength + 4 > targsize)
            return (-1);
        target[datalength++] = basis_64[output[0]];
        target[datalength++] = basis_64[output[1]];
        if (srclength == 1)
            target[datalength++] = Pad64;
        else
            target[datalength++] = basis_64[output[2]];
        target[datalength++] = Pad64;
    }
    if (datalength >= targsize)
        return (-1);
    target[datalength] = '\0';    /* Returned value doesn't count \0. */
    return (datalength);
}

int Base64Decode(src, target, targsize)
    char const *src;
    unsigned char *target;
    size_t targsize;
{
    int tarindex, state, ch;
    unsigned char nextbyte;
    char *pos;

    state = 0;
    tarindex = 0;
    while ((ch = (unsigned char)*src++) != '\0') {
        if (isspace(ch))    /* Skip whitespace anywhere. */
            continue;

        if (ch == Pad64)
            break;

        pos = strchr(basis_64, ch);
        if (pos == 0)         /* A non-base64 character. */
            return (-1);

        switch (state) {
        case 0:
            if (target) {
                if (tarindex >= targsize)
                    return (-1);
                target[tarindex] = (pos - basis_64) << 2;
            }
            state = 1;
            break;
        case 1:
            if (target) {
                if (tarindex >= targsize)
                    return (-1);
                target[tarindex]   |=  (pos - basis_64) >> 4;
                nextbyte = ((pos - basis_64) & 0x0f) << 4;
                if (tarindex + 1 < targsize)
                    target[tarindex+1] = nextbyte;
                else if (nextbyte)
                    return (-1);
            }
            tarindex++;
            state = 2;
            break;
        case 2:
            if (target) {
                if (tarindex >= targsize)
                    return (-1);
                target[tarindex]   |=  (pos - basis_64) >> 2;
                nextbyte = ((pos - basis_64) & 0x03) << 6;
                if (tarindex + 1 < targsize)
                    target[tarindex+1] = nextbyte;
                else if (nextbyte)
                    return (-1);
            }
            tarindex++;
            state = 3;
            break;
        case 3:
            if (target) {
                if (tarindex >= targsize)
                    return (-1);
                target[tarindex] |= (pos - basis_64);
            }
            tarindex++;
            state = 0;
            break;
        }
    }
    /*
     * We are done decoding Base-64 chars.  Let's see if we ended
     * on a byte boundary, and/or with erroneous trailing characters.
     */

    if (ch == Pad64) {            /* We got a pad char. */
        ch = (unsigned char)*src++;    /* Skip it, get next. */
        switch (state) {
        case 0:        /* Invalid = in first position */
        case 1:        /* Invalid = in second position */
            return (-1);

        case 2:        /* Valid, means one byte of info */
            /* Skip any number of spaces. */
            for (; ch != '\0'; ch = (unsigned char)*src++)
                if (!isspace(ch))
                    break;
            /* Make sure there is another trailing = sign. */
            if (ch != Pad64)
                return (-1);
            ch = (unsigned char)*src++;        /* Skip the = */
            /* Fall through to "single trailing =" case. */
            /* FALLTHROUGH */

        case 3:        /* Valid, means two bytes of info */
            /*
             * We know this char is an =.  Is there anything but
             * whitespace after it?
             */
            for (; ch != '\0'; ch = (unsigned char)*src++)
                if (!isspace(ch))
                    return (-1);

            /*
             * Now make sure for cases 2 and 3 that the "extra"
             * bits that slopped past the last full byte were
             * zeros.  If we don't check them, they become a
             * subliminal channel.
             */
            if (target && tarindex < targsize &&
                target[tarindex] != 0)
                return (-1);
        }
    } else {
        /*
         * We ended by seeing the end of the string.  Make sure we
         * have no partial bytes lying around.
         */
        if (state != 0)
            return (-1);
    }

    return (tarindex);
}

//用openssl自家的base64輸出值,
int base64_encode(char *in_str, int in_len, char *out_str)
{
    BIO *b64, *bio;
    BUF_MEM *bptr = NULL;
    size_t size = 0;
 
    if (in_str == NULL || out_str == NULL)
        return -1;
 
    b64 = BIO_new(BIO_f_base64());
    bio = BIO_new(BIO_s_mem());
    bio = BIO_push(b64, bio);
 
    BIO_write(bio, in_str, in_len);
    BIO_flush(bio);
 
    BIO_get_mem_ptr(bio, &bptr);
    memcpy(out_str, bptr->data, bptr->length);
    out_str[bptr->length] = '\0';
    size = bptr->length;
 
    BIO_free_all(bio);
    return size;
}
 
int base64_decode(char *in_str, int in_len, char *out_str)
{
    BIO *b64, *bio;
    BUF_MEM *bptr = NULL;
    int counts;
    int size = 0;
 
    if (in_str == NULL || out_str == NULL)
        return -1;
 
    b64 = BIO_new(BIO_f_base64());
    BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
 
    bio = BIO_new_mem_buf(in_str, in_len);
    bio = BIO_push(b64, bio);
 
    size = BIO_read(bio, out_str, in_len);
    out_str[size] = '\0';
 
    BIO_free_all(bio);
    return size;
}

char *_btoa(char *ecode)
{
    static int inlen,outlen;
    static char outstr[4096];
    
    inlen=strlen(ecode);
    outlen=sizeof(outstr);
    Base64Encode(ecode, inlen, outstr, &outlen);
    return outstr;
}

char *_atob(char *dcode)
{
    static int outlen;
    static char outstr[4096];
    
    Base64Decode(dcode, outstr, &outlen);
    return outstr;
}

//有點bug 輸出大于4096自己改
char *urlencorder(char *ecode)
{
    int i,n,len;
    static char outstr[4096];
    
    len = strlen(ecode);
    for(i=n=0;n<len;n++)
    {
        //如果是數字或字母0-9 or a-z or A-Z
        if((ecode[n]>='0' && ecode[n]<='9') || 
        (ecode[n]>='a' && ecode[n]<='z') || 
        (ecode[n]>='A' && ecode[n]<='Z'))
        {
            outstr[i] = ecode[n];
            i++;
        }
        //否則就要加上%及字符16進制碼
        else
        {
            sprintf(outstr+i, "%%%02x", ecode[n]&0xff);
            i += 3;
        }
    }
    outstr[i] = 0;
    
    return outstr;
}

//https://www.php.net/manual/zh/function.hash.php
char *sha256Abstract(char *string)
{
    char *ptr;
    static char sha_str[64];
    Sha256Context sha256Context;
    SHA256_HASH sha256Hash;
    uint16_t i,j;
    
    Sha256Initialise( &sha256Context );
    Sha256Update( &sha256Context, (unsigned char*)string, (uint32_t)strlen(string) );
    Sha256Finalise( &sha256Context, &sha256Hash );
    
    for( i=0,j=0; i<sizeof(sha256Hash); i++ )
    {
        j = i*2;
        ptr = &sha_str[j];
        sprintf( ptr,"%02x", sha256Hash.bytes[i] );
    }
    
    printf( "%s\n",sha_str );
    
    return sha_str;
}

char *sha11Abstract(char *string)
{
    char *ptr;
    static char sha_str[40];
    Sha1Context sha1Context;
    SHA1_HASH sha1Hash;
    uint16_t i,j;
    
    Sha1Initialise( &sha1Context );
    Sha1Update( &sha1Context, (unsigned char*)string, (uint32_t)strlen(string) );
    Sha1Finalise( &sha1Context, &sha1Hash );
    
    for( i=0,j=0; i<sizeof(sha1Hash); i++ )
    {
        j = i*2;
        ptr = &sha_str[j];
        sprintf( ptr,"%02x", sha1Hash.bytes[i] );
    }
    
    printf( "%s\n",sha_str );
    
    return sha_str;
}

RSA *getRSAPrivateKey(char *file)
{
    BIO *priio;
    RSA *prikey = RSA_new();
    
    priio = BIO_new_file(file, "rb");
    prikey = PEM_read_bio_RSAPrivateKey(priio, &prikey, NULL, NULL);
    BIO_free(priio);
    
    return prikey;
}

RSA *getRSAPublicKey(char *file)
{
    BIO *pubio;
    RSA *pubkey = RSA_new();
    
    pubio = BIO_new_file(file, "rb");
    pubkey = PEM_read_bio_RSAPublicKey(pubio, &pubkey, NULL, NULL);
    BIO_free(pubio);
    
    return pubkey;
}

//https://pay.weixin.qq.com/wiki/doc/api/index.html //微信支付都要跳轉到微信平臺
//https://opendocs.alipay.com/apis/api_1/alipay.trade.wap.pay
//https://open.unionpay.com/tjweb/acproduct/APIList?acpAPIId=334&apiservId=453&version=V2.2&bussType=0
//application/x-www-form-urlencoded空格要轉換成'+'

//https://www.cnblogs.com/gordon0918/p/5382541.html
//openssl md5 -sha256 -sign acp_test_sign.key -out zsign1.txt zfile.txt
//openssl base64 -in zsign1.txt -out zbase64sign1.txt
char *Payment(SSL *fd)
{
    int i,len;
    time_t now;
    struct tm *tp;
    BIO *priio,*pubio;
    RSA *pubkey = RSA_new();
    RSA *prikey = RSA_new();
    char *ptr,*msg,buf[4096],temp[1024],sha[64];
    char version[] = "5.1.0";//版本號
    char encoding[16] = "utf-8";//"utf-8";//編碼方式
    char txnType[] = "01";//交易型別
    char txnSubType[] = "01";//交易子類
    char bizType[] = "000201";//業務型別
    char backUrl[64] = "http://www.specialUrl.com";//后臺通知地址 可以固定上送http://www.specialUrl.com
    char signMethod[] = "01";//"RSA-SHA256";//簽名方法 RSA-SHA256:表示采用RSA簽名,摘要演算法用SHA256
    unsigned char signature[1024];//報文簽名BASE64
    char channelType[] = "08";//渠道型別,07-PC,08-手機
    char accessType[] = "0";//接入型別
    char currencyCode[] ="156";//交易幣種,境內商戶固定156
    char merId[20] = "777290058183095";//商戶代碼 僅支持數字和字母
    char orderId[40] = "SJ20200827170201";//商戶訂單號 僅支持數字和字母
    char txnTime[20] = "20200827170201";//訂單發送時間,格式為YYYYMMDDhhmmss,取北京時間
    char txnAmt[10] = "22";//交易金額,單位分
    char payTimeout[20];//超過超時時間就算交易成功錢也會回傳到用戶卡上date('YmdHis', strtotime('+15 minutes'))
    //char riskRateInfo[] = "{commodityName=測驗商品名稱}";//風控資訊欄位
    //char merCertId[128];//商戶簽名私鑰證書的Serial Number(十進制)僅支持數字
    //char nonceStr[32] = "asdfasdf";//隨機字串
    //char bizMethod[128] = "acp.unified.pay";//"acp.trade.pay";//業務介面
    //char bizContent[10240];//
    char certId[128] = "68759663125";//"1002653215";//證書ID
    char frontUrl[64] = "http://api.mysxlive.com/";//前臺通知地址
    priio = BIO_new_file("./acp_test_sign.key", "rb");
    prikey = PEM_read_bio_RSAPrivateKey(priio, &prikey, NULL, NULL);
    
    pubio = BIO_new_file("./acp_test_public_sign.key", "rb");
    pubkey = PEM_read_bio_RSAPublicKey(pubio, &pubkey, NULL, NULL);
    
    now = time( (time_t*) 0 );
    tp = localtime(&now);
    //訂單發送時間
    sprintf(txnTime,"%d%02d%02d%02d%02d%02d",1900 + tp->tm_year,tp->tm_mon+1,tp->tm_mday,tp->tm_hour,tp->tm_min,tp->tm_sec);
    //tp->tm_min+1 超過五分鐘沒有交易成功的就超時
    sprintf(payTimeout,"%d%02d%02d%02d%02d%02d",1900 + tp->tm_year,tp->tm_mon+1,tp->tm_mday,tp->tm_hour,tp->tm_min+5,tp->tm_sec);
    //商戶訂單號
    sprintf(orderId,"SJ%s",txnTime);
    //注意了這里哪部分內容拿去前面銀聯demo也沒有說清楚!
    //sprintf(buf,"version=%s&encoding=%s&txnType=%s&txnSubType=%s&bizType=%s&backUrl=%s&channelType=%s&accessType=%s&currencyCode=%s&merId=%s&orderId=%s&txnTime=%s&txnAmt=%s&payTimeout=%s&certId=%s&frontUrl=%s&signMethod=%s",version,encoding,txnType,txnSubType,bizType,backUrl,channelType,accessType,currencyCode,merId,orderId,txnTime,txnAmt,payTimeout,certId,frontUrl,signMethod);
    
    sprintf(buf,"accessType=%s&backUrl=%s&bizType=%s&certId=%s&channelType=%s&currencyCode=%s&encoding=%s&frontUrl=%s&merId=%s&orderId=%s&payTimeout=%s&signMethod=%s&txnAmt=%s&txnSubType=%s&txnTime=%s&txnType=%s&version=%s",accessType,backUrl,bizType,certId,channelType,currencyCode,encoding,frontUrl,merId,orderId,payTimeout,signMethod,txnAmt,txnSubType,txnTime,txnType,version);
    
    len = 0;
    //"360d9f5272fce05908375f25a5c398c747eccea87bd1f485105fa2a6b3f504c9"
    //strcpy(sha,sha256Abstract("accessType=0&backUrl=http://www.specialUrl.com&bizType=000201&certId=68759663125&channelType=08&currencyCode=156&encoding=utf-8&frontUrl=http://api.mysxlive.com/&merId=777290058183095156&orderId=SJ20200902094006&payTimeout=20200902094506&signMethod=01&txnAmt=22&txnSubType=01&txnTime=20200902094006&txnType=01&version=5.1.0"));
    //strcpy(sha,"360d9f5272fce05908375f25a5c398c747eccea87bd1f485105fa2a6b3f504c9");
    strcpy(sha,sha256Abstract(buf));
    msg = sha;
    
    //有點蛋疼的互動介面,php$params_str = createLinkString ( $params, true, false );不需要$value = https://www.cnblogs.com/yfii/p/urlencode ( $value );的!...
    strcpy(encoding,"utf%2d8");
    strcpy(backUrl,"http%3a%2f%2fwww%2especialUrl%2ecom");
    strcpy(frontUrl,"http%3a%2f%2fapi%2emysxlive%2ecom%2f");
    sprintf(buf,"accessType=%s&backUrl=%s&bizType=%s&certId=%s&channelType=%s&currencyCode=%s&encoding=%s&frontUrl=%s&merId=%s&orderId=%s&payTimeout=%s&signMethod=%s&txnAmt=%s&txnSubType=%s&txnTime=%s&txnType=%s&version=%s",accessType,backUrl,bizType,certId,channelType,currencyCode,encoding,frontUrl,merId,orderId,payTimeout,signMethod,txnAmt,txnSubType,txnTime,txnType,version);
    
    printf("===============000================\n");
    EVP_MD_CTX *mdctx;        //摘要演算法背景關系變數
    EVP_PKEY *evpKey=NULL,*evpubkey=NULL;        //EVP KEY結構體變數
    
    mdctx = EVP_MD_CTX_create();
        
    evpKey = EVP_PKEY_new();//新建一個EVP_PKEY變數
    if(evpKey == NULL)
    {
        printf("EVP_PKEY_new err\n");
        goto endPayment;
    }
    if(EVP_PKEY_set1_RSA(evpKey,prikey) != 1)    //保存prikey結構體到EVP_PKEY結構體
    {
        printf("EVP_PKEY_set1_RSA err\n");
        EVP_PKEY_free(evpKey);
        goto endPayment;
    }
    //以下是計算簽名代碼
    EVP_MD_CTX_init(mdctx);//初始化摘要背景關系
    printf("===============001================\n");
    if(!EVP_SignInit_ex(mdctx, EVP_sha256(), NULL))//簽名初始化,設定摘要演算法EVP_md5()
    {
        printf("err\n");
        EVP_PKEY_free(evpKey);
        goto endPayment;
    }
    printf("===============002================\n");
    if(!EVP_SignUpdate(mdctx, msg, strlen(msg)))//計算簽名(摘要)Update
    {
        printf("err\n");
        EVP_PKEY_free(evpKey);
        goto endPayment;
    }
    printf("===============003================\n");
    if(!EVP_SignFinal(mdctx,signature,&len,evpKey))    //簽名輸出
    {
        printf("err\n");
        EVP_PKEY_free(evpKey);
        goto endPayment;
    }
    printf("===============004================\n");
    //printf("訊息\"%s\"的簽名值是: \n",mess1);
    for(i = 0; i < len; i++)
    {
        if(i%16==0)
            printf("\n%08xH: ",i);
        printf("%02x ", signature[i]);    
    }
    printf("\n");
    //EVP_MD_CTX_cleanup(&mdctx);
    /*if(RSA_sign(NID_sha256, msg, strlen(msg),signature,&len, prikey)!=1)
    {
        printf("RSA_sign err!\n");
        RSA_free(prikey);
        return -1;
    }*/
    
    //以下是驗證簽名代碼
    evpubkey = EVP_PKEY_new();//新建一個EVP_PKEY變數
    if(EVP_PKEY_set1_RSA(evpubkey,pubkey) != 1)    //保存prikey結構體到EVP_PKEY結構體
    {
        printf("EVP_PKEY_set1_RSA err\n");
        EVP_PKEY_free(evpubkey);
        goto endPayment;
    }
    EVP_MD_CTX_init(mdctx);//初始化摘要背景關系
    if(!EVP_VerifyInit_ex(mdctx, EVP_sha256(), NULL))//驗證初始化,設定摘要演算法,
    {
        printf("EVP_VerifyInit_ex err\n");
        EVP_PKEY_free(evpubkey);
        goto endPayment;
    }
    if(!EVP_VerifyUpdate(mdctx, msg, strlen(msg)))//驗證簽名(摘要)Update
    {
        printf("err\n");
        EVP_PKEY_free(evpubkey);
        goto endPayment;
    }    
    if(!EVP_VerifyFinal(mdctx,signature,len,evpubkey))//驗證簽名
    {
        printf("verify err\n");
        EVP_PKEY_free(evpubkey);
        goto endPayment;
    }
    else
    {
        printf("Verify that the signature is correct.\n");
    }

#if 0
    if(RSA_sign(NID_sha256,msg,strlen(msg),signature,&len,prikey)!=1)
    {
        printf("RSA_sign err!\n");
        goto endPayment;
    }
    for(i = 0; i < len; i++)
    {
        if(i%16==0)
            printf("\n%08xH: ",i);
        printf("%02x ", signature[i]);    
    }
#endif
    printf("[[strlen(buf)=%d]][len=%d]\n",strlen(buf),len);
    char outstr[4096];
    int outlen = sizeof(outstr);
    
    //https://blog.csdn.net/lell3538/article/details/59137414?utm_source=blogxgwz2
    Base64Encode(signature, len, outstr, &outlen);
    //base64_encode(signature,len,outstr);
    
    printf("[[outlen=%d]]|%s\n",outlen,"go in");
    printf("\n[[%s]]\n\n",outstr);
    ptr = &buf[strlen(buf)];
    sprintf(ptr,"&signature=%s",urlencorder(outstr));//urlencorder 有bug.
    printf("[len=%d][outlen=%d][[%s]]\n",len,outlen,buf);
    //int vret = RSA_verify(NID_sha1, msg, strlen(msg), sinDat, sinLen, pubkey);
    //printf("[%s]|sinLen=%d|sign_verify=%d\n",sinDat,sinLen,vret);
    
    len = strlen(buf);
    
    sprintf(temp,"POST /gateway/api/frontTransReq.do HTTP/1.1\n\
Host: gateway.test.95516.com\n\
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0\n\
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\n\
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2\n\
Accept-Encoding: gzip, deflate\n\
Content-Type: application/x-www-form-urlencoded\n\
Content-Length: %d\n\
Connection: keep-alive\n\
Upgrade-Insecure-Requests: 1\n\n",len);

    int clen = SSL_write(fd,temp,strlen(temp));
    if (clen < 0)
    {
        printf("message send fail!error code is %d,error info'%s'\n",errno, strerror(errno));
        exit(0);
    }
    clen = SSL_write(fd,buf,len);
    if (clen < 0)
    {
        printf("message send fail!error code is %d,error info'%s'\n",errno, strerror(errno));
        exit(0);
    }
    //接識訓傳資料
    //...
    int nfile=open("./zresult.txt",O_WRONLY|O_TRUNC|O_CREAT,00700);
        if(nfile==-1)exit( 1 );
    do
    {
        len = SSL_read(fd, buf, 4096);
        buf[len] = 0;
        if(len)printf("[len=%d][\n%s]\n",len,buf);
        //for(i=0;i<len;i++)putc(buf[i],stdout);
        if(len)write(nfile,buf,len);//debug
    }while(0);
    close(nfile);
    //提取驗簽,其實也可以不驗簽直接處理結果即可!
    //...

endPayment:
    EVP_MD_CTX_destroy(mdctx);
    RSA_free(pubkey);
    BIO_free(pubio);
    RSA_free(prikey);
    BIO_free(priio);
    return buf;
}
#if 0
//ConsumeuUndo
{
    char version[] = "6.0.0";//版本號
    char encoding[] = "utf-8";//編碼方式
    char txnType[] = "31";//交易型別
    char txnSubType[] = "00";//交易子類
    char bizType[] = "000201";//業務型別
    char backUrl[] = "http://www.specialUrl.com";//后臺通知地址 可以固定上送http://www.specialUrl.com
    char signMethod[32];//簽名方法 RSA-SHA256:表示采用RSA簽名,摘要演算法用SHA256
    char signature[1024];//報文簽名
    char channelType[] = "08";//渠道型別,07-PC,08-手機
    char accessType[] = "0";//接入型別
    char merId[15] = "123456789";//商戶代碼 僅支持數字和字母
    char orderId[40] = "SJ20200827170201";//商戶訂單號 僅支持數字和字母
    char origQryId[] = "";//原消費的queryId,可以從查詢介面或者通知介面中獲取
    char txnTime[] = "20200827170201";//訂單發送時間,格式為YYYYMMDDhhmmss,取北京時間
    char txnAmt[] = "";//交易金額,單位分
    
}
//如果回傳處理中,還需要定時重繪查詢狀態,如果狀態未知還要進行沖正操作,
//Query
{
    char version[] = "6.0.0";//版本號
    char encoding[] = "utf-8";//編碼方式
    char txnType[] = "00";//交易型別
    char txnSubType[] = "00";//交易子類
    char bizType[] = "000000";//業務型別
    char backUrl[] = "http://www.specialUrl.com";//后臺通知地址 可以固定上送http://www.specialUrl.com
    char signMethod[32];//簽名方法 RSA-SHA256:表示采用RSA簽名,摘要演算法用SHA256
    char signature[1024];//報文簽名
    char channelType[] = "08";//渠道型別,07-PC,08-手機
    char accessType[] = "0";//接入型別
    char merId[15] = "123456789";//商戶代碼 僅支持數字和字母
    char orderId[40] = "SJ20200827170201";//商戶訂單號 僅支持數字和字母
    char txnTime[] = "20200827170201";//訂單發送時間,格式為YYYYMMDDhhmmss,取北京時間
    
}
#endif
void testRsa()
{
    /*BIO *priio,*pubio;
    RSA *pubkey = RSA_new();
    RSA *prikey = RSA_new();
    
    priio = BIO_new_file("./acp_test_sign_pkcs8.key", "rb");
    prikey = PEM_read_bio_RSAPrivateKey(priio, &prikey, NULL, NULL);
    
    pubio = BIO_new_file("./acp_test_public_sign_pkcs8.key", "rb");
    pubkey = PEM_read_bio_RSAPublicKey(pubio, &pubkey, NULL, NULL);
    
    RSA_print_fp(stdout, pubkey, 0);
    printf("====================================\n");
    RSA_print_fp(stdout, prikey, 0);

    RSA_free(pubkey);
    BIO_free(pubio);
    RSA_free(prikey);
    BIO_free(priio);*/
    
    FILE *prif,*pubf;
    RSA *pubkey = RSA_new();
    RSA *prikey = RSA_new();
    
    prif = fopen("./acp_test_sign.key", "rb");
    prikey = PEM_read_RSAPrivateKey(prif, &prikey, NULL, NULL);
    
    pubf = fopen("./acp_test_public_sign.key", "rb");
    pubkey = PEM_read_RSAPublicKey(pubf, &pubkey, NULL, NULL);
    
    RSA_print_fp(stdout, pubkey, 0);
    printf("====================================\n");
    RSA_print_fp(stdout, prikey, 0);

    fclose(pubf);
    fclose(prif);
    RSA_free(pubkey);
    RSA_free(prikey);
}

#if 0
int send_headers(SSL *fd,int len)
{
    char buf[1024];
    
    sprintf(buf,"POST /Monitor HTTP/1.1\n\
Host: 110.87.159.245:443\n\
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0\n\
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\n\
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2\n\
Accept-Encoding: gzip, deflate\n\
Content-Type: application/x-www-form-urlencoded\n\
Content-Length: %d\n\
Connection: keep-alive\n\
Upgrade-Insecure-Requests: 1\n\n",len);

    return SSL_write(fd,buf,strlen(buf));//send(fd, buf, strlen(buf), 0);
}
#endif
//https://www.cnblogs.com/cocoajin/p/10510574.html
//https://blog.csdn.net/xiangguiwang/article/details/79821220
//https://www.cnblogs.com/cocoajin/p/6126099.html
//https://blog.csdn.net/weixin_43836778/article/details/100114212
//110.87.159.245
#if 0
int main(int argc, char * argv[])
{
    //testRsa();
    /*RSA *prikey,*pubkey;
    char *msg = "0123456789";
    char *sinDat = malloc(4096);
    int sinLen = 0;
    
    //prikey = getRSAPrivateKey("./acp_test_sign.key");
    prikey = getRSAPrivateKey("./acp_test_sign_pkcs8.key");
    pubkey = getRSAPublicKey("./acp_test_public_sign.key");
    //pubkey = getRSAPublicKey("./acp_test_public_sign_pkcs8.key");
    
    RSA_sign(NID_sha1, msg,strlen(msg),sinDat,&sinLen, prikey);
    
    int vret = RSA_verify(NID_sha1, msg, strlen(msg), sinDat, sinLen, pubkey);
    printf("[%s]|sinLen=%d|sign_verify=%d\n",sinDat,sinLen,vret);
    
    RSA_free(pubkey);
    RSA_free(prikey);*/
    
    //sha256Abstract("my name is samuel...");
    int tp;
    char *pemCert;
    struct stat fst;
    X509 *x509;
    EVP_PKEY *pkey;
    RSA *pubkey;
    
    tp=open("./server.crt",O_RDONLY|O_BINARY,00700);
    if(tp==-1)
    {
        return printf("open file error!\n");
    }
    fstat( tp, &fst );
    lseek( tp, 0, SEEK_SET );//再定位檔案指標到檔案頭
    pemCert = malloc(fst.st_size);
    read(tp,pemCert,fst.st_size);
    close(tp);
    
    printf("\n[%s]\n=======================================\n",pemCert);
    //BIO *b = BIO_new_mem_buf(pemCert, fst.st_size);
    BIO *b = BIO_new_file("./server.crt", "r");
    if (NULL == b){
        return -1001;
    }
    printf("\n=====0==================================\n");
    x509 = PEM_read_bio_X509(b, NULL, NULL, NULL);
    if (NULL == x509){
        BIO_free(b), b=NULL;
        X509_free(x509), x509=NULL;
        ERR_print_errors_fp(stderr);
        exit(1);
    }
    printf("\n=====1==================================\n");
    /* Get public key - eay */
    pkey=X509_get_pubkey(x509);
    if (pkey == NULL) {
        ERR_print_errors_fp (stderr);
        exit (1);
    }
    printf("\n=====2==================================\n");
    
    pubkey = EVP_PKEY_get1_RSA(pkey);
    
    int i,len;
    EVP_MD_CTX *mdctx;        //摘要演算法背景關系變數
    EVP_PKEY *evpubkey=NULL;        //EVP KEY結構體變數
    char signature[4096],*msg = "360d9f5272fce05908375f25a5c398c747eccea87bd1f485105fa2a6b3f504c9";
    
    /*evpubkey = EVP_PKEY_new();//新建一個EVP_PKEY變數
    if(EVP_PKEY_set1_RSA(evpubkey,pubkey) != 1)    //保存prikey結構體到EVP_PKEY結構體
    {
        printf("EVP_PKEY_set1_RSA err\n");
        EVP_PKEY_free(evpubkey);
        exit(1);
    }
    
    //以下是計算簽名代碼
    mdctx = EVP_MD_CTX_create();
    EVP_MD_CTX_init(mdctx);//初始化摘要背景關系
    printf("===============001================\n");
    if(!EVP_SignInit_ex(mdctx, EVP_sha256(), NULL))//簽名初始化,設定摘要演算法EVP_md5()
    {
        printf("err\n");
        EVP_PKEY_free(evpubkey);
        exit(1);
    }
    printf("===============002================\n");
    if(!EVP_SignUpdate(mdctx, msg, strlen(msg)))//計算簽名(摘要)Update
    {
        printf("err\n");
        EVP_PKEY_free(evpubkey);
        exit(1);
    }
    printf("===============003================\n");
    if(!EVP_SignFinal(mdctx,signature,&len,evpubkey))    //簽名輸出
    {
        printf("err\n");
        EVP_PKEY_free(evpubkey);
        exit(1);
    }
    printf("===============004================\n");*/
    printf("\n=====2.5==================================\n");
    if(RSA_sign(NID_sha256, msg, strlen(msg),signature,&len, pubkey)!=1)
    {
        printf("RSA_sign err!\n");
        RSA_free(pubkey);
        return -1;
    }
    //printf("訊息\"%s\"的簽名值是: \n",mess1);
    for(i = 0; i < len; i++)
    {
        if(i%16==0)
            printf("\n%08xH: ",i);
        printf("%02x ", signature[i]);    
    }
    printf("\n=====3==================================\n");
    
    
    
    RSA_print_fp(stdout, pubkey, 0);
    
    printf("\n=====4==================================\n");
    
    X509 *cert;
    char *line;
    
    cert = x509;
        //cert = SSL_get_peer_certificate(ssl);
    
        if (cert != NULL) 
        {
            printf("數字證書資訊:\n");
            
            
            //line = X509_NAME_oneline(X509_get_serialNumber(cert), 0, 0);
            //printf("證書: %s\n", line);
            
            ASN1_INTEGER *bs = NULL;
            char *res = NULL;
            BIGNUM     *bn = NULL;
            bs = X509_get_serialNumber(cert);
            if (bs->length == 0) {
                printf("X509_get_serialNumber()  length=0 error!\n");
                return -1;
            }
            bn = ASN1_INTEGER_to_BN(bs, NULL);
            res = BN_bn2hex(bn);
            printf("serial = %s\n", res);
            OPENSSL_free(res);
            res = NULL;
            BN_free(bn);
            bn = NULL;
            
            
            line = X509_NAME_oneline(X509_get_subject_name(cert), 0, 0);
            printf("證書: %s\n", line);
            OPENSSL_free(line);
            line = X509_NAME_oneline(X509_get_issuer_name(cert), 0, 0);
            printf("頒發者: %s\n", line);
            OPENSSL_free(line);
            X509_free(cert);
        }
    
    free(pemCert);
    return 1;
}
#endif


int main(int argc, char * argv[])
{
    WSADATA wsaData;
    int sockfd,len,ret;
    struct sockaddr_in dest;
    char buffer[10240];
    //這里用了服務端一樣的證書和KEY所以連接不成功的
    //char *certificate_file="./3453137_classify.mysxlive.com.pem";
    //char *PrivateKey_file="./3453137_classify.mysxlive.com.key";
    SSL_CTX *ctx;
    SSL *ssl;

    /* SSL 庫初始化,參看 ssl-server.c 代碼 */
    SSL_library_init();
    OpenSSL_add_all_algorithms();
    SSL_load_error_strings();
    ctx = SSL_CTX_new(TLSv1_2_client_method());
    if (ctx == NULL) {
        ERR_print_errors_fp(stdout);
        exit(1);
    }
#if 0
    // 雙向驗證
    // SSL_VERIFY_PEER---要求對證書進行認證,沒有證書也會放行
    // SSL_VERIFY_FAIL_IF_NO_PEER_CERT---要求客戶端需要提供證書,但驗證發現單獨使用沒有證書也會放行
    SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT, NULL);
    
    // 設定信任根證書
    if (SSL_CTX_load_verify_locations(ctx, "./ca.cer",NULL)<=0){
        printf("Failed to load CA digital certificate\n");
        return -1;
    }

    /* 載入用戶的數字證書, 此證書用來發送給客戶端, 證書里包含有公鑰 */
    if (SSL_CTX_use_certificate_file(ctx, certificate_file, SSL_FILETYPE_PEM) <= 0) {
        ERR_print_errors_fp(stdout);
        exit(1);
    }
    /* 載入用戶私鑰 */
    if (SSL_CTX_use_PrivateKey_file(ctx, PrivateKey_file, SSL_FILETYPE_PEM) <= 0) {
        ERR_print_errors_fp(stdout);
        exit(1);
    }
    /* 檢查用戶私鑰是否正確 */
    if (!SSL_CTX_check_private_key(ctx)) {
        ERR_print_errors_fp(stdout);
        exit(1);
    }
#endif
    //MAKEWORD(1, 1)1.1版只支持TCP/IP協議MAKEWORD(2, 2)2.2版只支持TCP/IP協議
    if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0)
    {
        printf("WSAStartup failed\n");
        return -1;
    }
    /* 創建一個 socket 用于 tcp 通信 */
    if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
        perror("Socket");
        exit(errno);
    }
    printf("socket created\n");

    /* 初始化服務器端(對方)的地址和埠資訊 */
    memset(&dest,0, sizeof(dest));
    dest.sin_family = AF_INET;
    dest.sin_port = htons(443);
    dest.sin_addr.S_un.S_addr = inet_addr("58.220.73.190");//先向我們自己的https服務器發送測驗請求106.122.254.99 118.123.233.174 42.81.147.159 58.220.73.190 112.47.14.66 23.217.207.13 150.138.170.33
    
    printf("address created\n");

    /* 連接服務器 */
    if (connect(sockfd, (struct sockaddr *) &dest, sizeof(dest)) != 0) {
        perror("Connect ");
        exit(errno);
    }
    printf("server connected\n");

    /* 基于 ctx 產生一個新的 SSL */
    ssl = SSL_new(ctx);
    SSL_set_fd(ssl, sockfd);
    /* 建立 SSL 連接 */
    if (SSL_connect(ssl) == -1)
        ERR_print_errors_fp(stderr);
    else {
        printf("Connected with %s encryption\n", SSL_get_cipher(ssl));
        //ShowCerts(ssl);//客戶端驗證證書...
        X509 *cert;
        char *line;
        cert = SSL_get_peer_certificate(ssl);
        if (cert != NULL) 
        {
            printf("數字證書資訊:\n");
            
            
            //line = X509_NAME_oneline(X509_get_serialNumber(cert), 0, 0);
            //printf("證書: %s\n", line);
            
            ASN1_INTEGER *bs = NULL;
            char *res = NULL;
            BIGNUM     *bn = NULL;
            bs = X509_get_serialNumber(cert);
            if (bs->length == 0) {
                printf("X509_get_serialNumber()  length=0 error!\n");
                return -1;
            }
            bn = ASN1_INTEGER_to_BN(bs, NULL);
            res = BN_bn2hex(bn);
            printf("serial = %s\n", res);
            OPENSSL_free(res);
            res = NULL;
            BN_free(bn);
            bn = NULL;
            
            
            line = X509_NAME_oneline(X509_get_subject_name(cert), 0, 0);
            printf("證書: %s\n", line);
            OPENSSL_free(line);
            line = X509_NAME_oneline(X509_get_issuer_name(cert), 0, 0);
            printf("頒發者: %s\n", line);
            OPENSSL_free(line);
            X509_free(cert);
        }
        //x509.get_serial_number
        
            /*int  x509_get_serial_num(X509 *x)
        {
            ASN1_INTEGER *bs = NULL;
            char *res = NULL;
            BIGNUM     *bn = NULL;
            bs = X509_get_serialNumber(x);
            if (bs->length == 0) {
                printf("X509_get_serialNumber()  length=0 error!\n");
                return -1;
            }
            bn = ASN1_INTEGER_to_BN(bs, NULL);
            res = BN_bn2hex(bn);
            printf("serial = %s\n", res);
            OPENSSL_free(res);
            res = NULL;
            BN_free(bn);
            bn = NULL;
            return 0 ;
        }*/
    }
    
    Payment(ssl);

#if 0
    //發送一個GET/POST請求
    memset(buffer,0, MAXBUF);
    strcpy(buffer, "GET /web/index.html HTTP/1.1\n"
"Host: 127.0.0.1\n"
"User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0\n"
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\n"
"Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2\n"
"Accept-Encoding: gzip, deflate\n"
"Connection: keep-alive\n"
"Cookie: Hm_lvt_fe3b7a223fc08c795f0f4b6350703e6f=1582005872,1582069091\n"
"Upgrade-Insecure-Requests: 1\n"
"Cache-Control: max-age=0\n\n");
    /* 發訊息給服務器 */
    len = SSL_write(ssl, buffer, strlen(buffer));
    if (len < 0)
    {
        printf
            ("message'%s'send fail!error code is %d,error info'%s'\n",
             buffer, errno, strerror(errno));
        exit(0);//要退出否則會一直與服務器保持while SSL_read,服務端要超時踢出設定,不然埠占完就拒絕服務了!試一下服務器有沒有超時踢并關閉釋放埠,另外是不是客戶端這邊自己死回圈了,
    }
    else
        printf("message'%s'send success,A total of %d bit!\n",
               buffer, len);

    /* 接收對方發過來的訊息,最多接收 MAXBUF 個位元組 */
    memset(buffer,0, MAXBUF);
    //簡單的HTTPS爬蟲模型!
    /* 接收服務器來的訊息 ,可以用回圈因為服務器回復完資料后就會把埠關閉,所以這個回圈就會立即退出,這樣看來客戶端獲取的包與上傳到服務端上的包還不一樣,如果不回圈資料就讀一點 就沒有下文了!*/
    while(SSL_read(ssl, buffer, MAXBUF))
    {
        printf(buffer);
        memset(buffer,0, MAXBUF);
    }
#endif
    /*len = SSL_read(ssl, buffer, MAXBUF);
    if (len > 0)
        printf("reve message success :'%s',total %d bit data\n",
               buffer, len);
    else {
        printf
            ("message rev faill!error code%d,error info'%s'\n",
             errno, strerror(errno));
        goto finish;
    }*/
printf("out ....\n");
  finish:
    /* 關閉連接 */
    SSL_shutdown(ssl);
    SSL_free(ssl);
    close(sockfd);
    SSL_CTX_free(ctx);
    WSACleanup();
    return 0;
}

 

 

最后會有一個 Location: https://cashier.test.95516.com/b2c/api/unifiedOrder.action?.......的302地址調轉,轉到銀聯的支付平臺......,

代碼下載: unionpay.zip

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/507.html

標籤:其他

上一篇:spotbugs~lombok生成的Date屬性引起的EI_EXPOSE_REP問題

下一篇:GP80系列列印機驅動 V17下載地址

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • 網閘典型架構簡述

    網閘架構一般分為兩種:三主機的三系統架構網閘和雙主機的2+1架構網閘。 三主機架構分別為內端機、外端機和仲裁機。三機無論從軟體和硬體上均各自獨立。首先從硬體上來看,三機都用各自獨立的主板、記憶體及存盤設備。從軟體上來看,三機有各自獨立的作業系統。這樣能達到完全的三機獨立。對于“2+1”系統,“2”分為 ......

    uj5u.com 2020-09-10 02:00:44 more
  • 如何從xshell上傳檔案到centos linux虛擬機里

    如何從xshell上傳檔案到centos linux虛擬機里及:虛擬機CentOs下執行 yum -y install lrzsz命令,出現錯誤:鏡像無法找到軟體包 前言 一、安裝lrzsz步驟 二、上傳檔案 三、遇到的問題及解決方案 總結 前言 提示:其實很簡單,往虛擬機上安裝一個上傳檔案的工具 ......

    uj5u.com 2020-09-10 02:00:47 more
  • 一、SQLMAP入門

    一、SQLMAP入門 1、判斷是否存在注入 sqlmap.py -u 網址/id=1 id=1不可缺少。當注入點后面的引數大于兩個時。需要加雙引號, sqlmap.py -u "網址/id=1&uid=1" 2、判斷文本中的請求是否存在注入 從文本中加載http請求,SQLMAP可以從一個文本檔案中 ......

    uj5u.com 2020-09-10 02:00:50 more
  • Metasploit 簡單使用教程

    metasploit 簡單使用教程 浩先生, 2020-08-28 16:18:25 分類專欄: kail 網路安全 linux 文章標簽: linux資訊安全 編輯 著作權 metasploit 使用教程 前言 一、Metasploit是什么? 二、準備作業 三、具體步驟 前言 Msfconsole ......

    uj5u.com 2020-09-10 02:00:53 more
  • 游戲逆向之驅動層與用戶層通訊

    驅動層代碼: #pragma once #include <ntifs.h> #define add_code CTL_CODE(FILE_DEVICE_UNKNOWN,0x800,METHOD_BUFFERED,FILE_ANY_ACCESS) /* 更多游戲逆向視頻www.yxfzedu.com ......

    uj5u.com 2020-09-10 02:00:56 more
  • 北斗電力時鐘(北斗授時服務器)讓網路資料更精準

    北斗電力時鐘(北斗授時服務器)讓網路資料更精準 北斗電力時鐘(北斗授時服務器)讓網路資料更精準 京準電子科技官微——ahjzsz 近幾年,資訊技術的得了快速發展,互聯網在逐漸普及,其在人們生活和生產中都得到了廣泛應用,并且取得了不錯的應用效果。計算機網路資訊在電力系統中的應用,一方面使電力系統的運行 ......

    uj5u.com 2020-09-10 02:01:03 more
  • 【CTF】CTFHub 技能樹 彩蛋 writeup

    ?碎碎念 CTFHub:https://www.ctfhub.com/ 筆者入門CTF時時剛開始刷的是bugku的舊平臺,后來才有了CTFHub。 感覺不論是網頁UI設計,還是題目質量,賽事跟蹤,工具軟體都做得很不錯。 而且因為獨到的金幣制度的確讓人有一種想去刷題賺金幣的感覺。 個人還是非常喜歡這個 ......

    uj5u.com 2020-09-10 02:04:05 more
  • 02windows基礎操作

    我學到了一下幾點 Windows系統目錄結構與滲透的作用 常見Windows的服務詳解 Windows埠詳解 常用的Windows注冊表詳解 hacker DOS命令詳解(net user / type /md /rd/ dir /cd /net use copy、批處理 等) 利用dos命令制作 ......

    uj5u.com 2020-09-10 02:04:18 more
  • 03.Linux基礎操作

    我學到了以下幾點 01Linux系統介紹02系統安裝,密碼啊破解03Linux常用命令04LAMP 01LINUX windows: win03 8 12 16 19 配置不繁瑣 Linux:redhat,centos(紅帽社區版),Ubuntu server,suse unix:金融機構,證券,銀 ......

    uj5u.com 2020-09-10 02:04:30 more
  • 05HTML

    01HTML介紹 02頭部標簽講解03基礎標簽講解04表單標簽講解 HTML前段語言 js1.了解代碼2.根據代碼 懂得挖掘漏洞 (POST注入/XSS漏洞上傳)3.黑帽seo 白帽seo 客戶網站被黑帽植入劫持代碼如何處理4.熟悉html表單 <html><head><title>TDK標題,描述 ......

    uj5u.com 2020-09-10 02:04:36 more
最新发布
  • 2023年最新微信小程式抓包教程

    01 開門見山 隔一個月發一篇文章,不過分。 首先回顧一下《微信系結手機號資料庫被脫庫事件》,我也是第一時間得知了這個訊息,然后跟蹤了整件事情的經過。下面是這起事件的相關截圖以及近日流出的一萬條資料樣本: 個人認為這件事也沒什么,還不如關注一下之前45億快遞資料查詢渠道疑似在近日復活的訊息。 訊息是 ......

    uj5u.com 2023-04-20 08:48:24 more
  • web3 產品介紹:metamask 錢包 使用最多的瀏覽器插件錢包

    Metamask錢包是一種基于區塊鏈技術的數字貨幣錢包,它允許用戶在安全、便捷的環境下管理自己的加密資產。Metamask錢包是以太坊生態系統中最流行的錢包之一,它具有易于使用、安全性高和功能強大等優點。 本文將詳細介紹Metamask錢包的功能和使用方法。 一、 Metamask錢包的功能 數字資 ......

    uj5u.com 2023-04-20 08:47:46 more
  • vulnhub_Earth

    前言 靶機地址->>>vulnhub_Earth 攻擊機ip:192.168.20.121 靶機ip:192.168.20.122 參考文章 https://www.cnblogs.com/Jing-X/archive/2022/04/03/16097695.html https://www.cnb ......

    uj5u.com 2023-04-20 07:46:20 more
  • 從4k到42k,軟體測驗工程師的漲薪史,給我看哭了

    清明節一過,盲猜大家已經無心上班,在數著日子準備過五一,但一想到銀行卡里的余額……瞬間心情就不美麗了。最近,2023年高校畢業生就業調查顯示,本科畢業月平均起薪為5825元。調查一出,便有很多同學表示自己又被平均了。看著這一資料,不免讓人想到前不久中國青年報的一項調查:近六成大學生認為畢業10年內會 ......

    uj5u.com 2023-04-20 07:44:00 more
  • 最新版本 Stable Diffusion 開源 AI 繪畫工具之中文自動提詞篇

    🎈 標簽生成器 由于輸入正向提示詞 prompt 和反向提示詞 negative prompt 都是使用英文,所以對學習母語的我們非常不友好 使用網址:https://tinygeeker.github.io/p/ai-prompt-generator 這個網址是為了讓大家在使用 AI 繪畫的時候 ......

    uj5u.com 2023-04-20 07:43:36 more
  • 漫談前端自動化測驗演進之路及測驗工具分析

    隨著前端技術的不斷發展和應用程式的日益復雜,前端自動化測驗也在不斷演進。隨著 Web 應用程式變得越來越復雜,自動化測驗的需求也越來越高。如今,自動化測驗已經成為 Web 應用程式開發程序中不可或缺的一部分,它們可以幫助開發人員更快地發現和修復錯誤,提高應用程式的性能和可靠性。 ......

    uj5u.com 2023-04-20 07:43:16 more
  • CANN開發實踐:4個DVPP記憶體問題的典型案例解讀

    摘要:由于DVPP媒體資料處理功能對存放輸入、輸出資料的記憶體有更高的要求(例如,記憶體首地址128位元組對齊),因此需呼叫專用的記憶體申請介面,那么本期就分享幾個關于DVPP記憶體問題的典型案例,并給出原因分析及解決方法。 本文分享自華為云社區《FAQ_DVPP記憶體問題案例》,作者:昇騰CANN。 DVPP ......

    uj5u.com 2023-04-20 07:43:03 more
  • msf學習

    msf學習 以kali自帶的msf為例 一、msf核心模塊與功能 msf模塊都放在/usr/share/metasploit-framework/modules目錄下 1、auxiliary 輔助模塊,輔助滲透(埠掃描、登錄密碼爆破、漏洞驗證等) 2、encoders 編碼器模塊,主要包含各種編碼 ......

    uj5u.com 2023-04-20 07:42:59 more
  • Halcon軟體安裝與界面簡介

    1. 下載Halcon17版本到到本地 2. 雙擊安裝包后 3. 步驟如下 1.2 Halcon軟體安裝 界面分為四大塊 1. Halcon的五個助手 1) 影像采集助手:與相機連接,設定相機引數,采集影像 2) 標定助手:九點標定或是其它的標定,生成標定檔案及內參外參,可以將像素單位轉換為長度單位 ......

    uj5u.com 2023-04-20 07:42:17 more
  • 在MacOS下使用Unity3D開發游戲

    第一次發博客,先發一下我的游戲開發環境吧。 去年2月份買了一臺MacBookPro2021 M1pro(以下簡稱mbp),這一年來一直在用mbp開發游戲。我大致分享一下我的開發工具以及使用體驗。 1、Unity 官網鏈接: https://unity.cn/releases 我一般使用的Apple ......

    uj5u.com 2023-04-20 07:40:19 more