share it! Micro-letter domain name intercept implement the principle of detection interface

background

Due to more stringent restrictions micro-channel, the domain name is determined to be accidentally induced sharing. Therefore, the company decided to research a stable, fast, correct rate of detection of micro-letter domain name intercepted query interface.

Development team try Google search for some time, I found little to share out the source and principle. Later we explored a few days, and finally solve the problem.

Domain Name Monitoring Interface Source

366-Domain Name Checking

principle

Use Wireshark packet capture obtain micro-letter domain interception query interface.

There are several domain name status:

A. normal domain access (not micro-channel interception)

B. The domain was blocked micro letter

C. Non micro-channel official website, to continue to access the phone will be converted into preview mode (in the background to add a number of public domain to the domain name business in general can solve this problem)

D. According to customer complaints and safety Tencent Security Center Web site detect the fraudulent Web page that contains malicious content, for the maintenance of green online environment, has stopped access

E. page contains inducing sharing, attention and other behavior inducing content, is more than a complaint, for the maintenance of green online environment, has stopped access

Demo

// your API Token, the user can query the center to 
$ apiToken = "********************************" ; 
// need to detect addresses or domain names 
$ reqURL = "www.qq.com"; 
$ url = sprintf ( "HTTPS: //r8date.cn_url=%s", $ apiToken, $ reqURL); 
$ curl_init CH = ( $ url); 
curl_setopt ($ CH, CURLOPT_RETURNTRANSFER, to true); 
curl_setopt ($ CH, CURLOPT_BINARYTRANSFER, to true); 
$ responseBody = curl_exec ($ CH); 
$ responseArr = json_decode ($ responseBody, to true); 
IF (json_last_error ()! JSON_ERROR_NONE =) { 
    echo "the JSON analytical results Interface error \ n-"; 
    return; 
} 
IF (isset ($ responseArr [ 'code']) && responseArr $ [ 'code'] == 0) { 
    // return the correct interfaces 
    // $ responseArr [ 'data'] [ 'status'] Ranges: OK, blocked 
    // OK indicates normal, blocked blocked represents
    printf ( "test address (% s) of status:% s \ n", $ reqURL, $ responseArr [ 'Data'] [ 'Status']); 
} the else { 
    printf ( "Interface Exception:% s \ n" , var_export ($ responseArr, to true)); 
}
# - * - Coding: UTF-8 - * - 
Import json, urllib 
from urllib Import urlencode 
DEF main (): 
    # your API Token, the user can query the center 
    apiToken = "********** *********** " 
    URL =" https://r8date.cn " 
    the params = { 
        " req_url ":" www.qq.com ", # necessary to detect addresses or domain names 
        " api_token ": apiToken , 
    } 
    the params = urlencode (the params) 
    F = urllib.urlopen ( "% S% S?"% (URL, the params)) 
    Content reached, f.read = () 
    RES = json.loads (Content) 
    IF RES: 
        code = RES [ "code"] 
        IF code == 0: 
            # successful request 
            Print RES [ "the Result"] 
        the else:]
            print "%s: %s" % (res["code"],res["msg"])
    else:
        print "request api error"
if __name__ == '__main__':
    main()

 

Guess you like

Origin www.cnblogs.com/qxdalaoxz/p/11370072.html