Summary of fast search and location encryption function skills in JS reverse engineering

1. Common keywords and descriptions of search encryption functions:

1、 MD5:

Search keywords: 1732584193, 271733879, 1732584194, 271733878, md5

Native MD5 encryption source code generation

2、SHA1:

Search keywords: 1732584193, 271733879, 1732584194, 271733878, 1009589776

SHA1 source code encryption source code generation

3、Base64:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 + /=

Often used in conjunction with other cryptographic functions

4、AES:

Search keywords: crypto, AES, encrypt

Often used in conjunction with other cryptographic functions

5、DES:

Search keywords: crypto, DES, encrypt, mode, padding

cryptoofficial website

6、RSA:

Search keywords: setPublicKey, rsa

jsencrypt official website

7、websocket:

Search keywords: onopen, onmessage, onsent, WebSocket

Protocol ws and wss, similar to http and https

8. JS code:

Search keywords: encodeURI, encodeURIComponent, btoa, escape

The first two methods are the most common

9. Encryption function export:

Search keywords: module.exports, exports

Common methods of exporting encryption functions

10. FROM form:

Search keywords: password, pwd, sign, userid. Encryption or non-encryption, keywords, search terms followed by a colon, an equal sign, and a dot in front, such as pwd:, pwd=, pwd =, .pwd

Search for the encrypted key in the key-value pair of the form, the form submission method is POST, and the search keywords are different for different forms

11. Hexadecimal:

Search keywords: 0123456789ABCDEF、0123456789abcdef

2. Main points of js reverse search encryption function:

1. To judge the encryption method, generally fill in 123456 in the input box as the password to judge, but the encrypted form is not necessarily the password, and may also be other keywords

2. More complex websites often use a mixture of encryption methods

3. Do more research on various encryption source codes. The encryption source codes have been provided in the following table

4. Passwords are not necessarily encrypted, and obfuscation techniques may be used to confuse encrypted functions, and some websites prohibit the use of browser debugging tools

3. Introduction to the main encryption and decryption algorithms:

1. Symmetric encryption algorithm: Symmetric encryption uses the same key for encryption and decryption ( AES, DES, 3DES )

2. Asymmetric algorithm: Asymmetric encryption means that encryption and decryption do not use the same key. Usually there are two keys, called public key and private key . They must be used in pairs, otherwise the encrypted file cannot be opened ( RSA, DSA, ECC )

3. Hash algorithm: Also known as hash function, it is a one-way encryption algorithm, irreversible, and currently cannot be decrypted ( MD5, SHA1, HMAC )

4. Base64: It is an encoding algorithm, usually used to encode binary data into writable character data, and encode the data content to be suitable for transmission. This is a reversible encoding method. The encoded data is a string, which contains characters: A - Z, a - z, 0 - 9, +, /, a total of 64 characters (26 + 26 + 10 + 1 + 1=64, actually 65 characters, "=" is a padding character ( HTTPS, HTTP + SSL layer )

3. Various encryption formats:

1. MD5 common 16, 32, 40 bits

123456 encryption (16 bits start with 49, 32 bits start with e10 or E10):

49BA59ABBE56E057
E10ADC3949BA59ABBE56E057F20F883E

2. SHA1 common 40, 64, 125 bits

123456 encryption (40 digits start with 7c):

7c4a8d09ca3762af61e59520943dc26494f8941b

3. HMAC
original message message, random key, hash algorithm, MD5 is used here, and the code for using hmac is as follows:

var message=b'Hello, world!'
# secret 密钥
var key=b'secret'
var h=hmac.new(key, message, digestmod='MD5')
# 如果消息很长,可以多次调用h.update(msg)
h.hexdigest()

4. AES
where data is a string, if it is an object, use JSON.stringify(data) to convert:

var CryptoJS=require("crypto-js");
var data='my message';
# secret密钥
var secret='secret key 123';
// Encrypt
var ciphertext=CryptoJS.AES.encrypt(data, secret).toString();
// Decrypt
var bytes=CryptoJS.AES.decrypt(ciphertext, 'secret key 123');
var originalText=bytes.toString(CryptoJS.enc.Utf8);

4、DES

var CryptoJS=require("crypto-js");
const secretKey='com.sevenlin.foo.key';
var afterEncrypt=CryptoJS.DES.encrypt('passwordtoecrypt', CryptoJS.enc.Utf8.parse(secretKey), {
    
    
        mode: CryptoJS.mode.ECB,
        padding: CryptoJS.pad.Pkcs7
}).toString()
# 解密
var afterDecrypt=CryptoJS.DES.decrypt(afterEncrypt, CryptoJS.enc.Utf8.parse(secretKey), {
    
    
        mode: CryptoJS.mode.ECB,
        padding: CryptoJS.pad.Pkcs7
}).toString(CryptoJS.enc.Utf8);

5、RSA

# Encrypt with the public key...
var encrypt=new JSEncrypt();
# 公钥 public_key 加密
encrypt.setPublicKey(public_key);
var encrypted=encrypt.encrypt("加密内容");
# Decrypt with the private key...
var decrypt=new JSEncrypt();
# 私钥 private_key 解密
decrypt.setPrivateKey(private_key);
var uncrypted=decrypt.decrypt(encrypted);

  Well, it's time to say goodbye to everyone here again. It's not easy to create, please give me a like before leaving. Your support is the driving force for my creation, and I hope to bring you more high-quality articles

Guess you like

Origin blog.csdn.net/qiulin_wu/article/details/132106681