MCPcopy
hub / github.com/r0ysue/r0capture / getSslSessionId

Function getSslSessionId

script.js:144–160  ·  view source on GitHub ↗

* Get the session_id of SSL object and return it as a hex string. * @param {!NativePointer} ssl A pointer to an SSL object. * @return {dict} A string representing the session_id of the SSL object's * SSL_SESSION. For example, * "59FD71B7B90202F359D89E66AE4E61247954E28431F6C6AC46625D472FF

(ssl)

Source from the content-addressed store, hash-verified

142 * "59FD71B7B90202F359D89E66AE4E61247954E28431F6C6AC46625D472FF76336".
143 */
144function getSslSessionId(ssl) {
145 var session = SSL_get_session(ssl);
146 if (session == 0) {
147 return 0;
148 }
149 var len = Memory.alloc(4);
150 var p = SSL_SESSION_get_id(session, len);
151 len = Memory.readU32(len);
152 var session_id = "";
153 for (var i = 0; i < len; i++) {
154 // Read a byte, convert it to a hex string (0xAB ==> "AB"), and append
155 // it to session_id.
156 session_id +=
157 ("0" + Memory.readU8(p.add(i)).toString(16).toUpperCase()).substr(-2);
158 }
159 return session_id;
160}
161
162Interceptor.attach(addresses["SSL_read"],
163 {

Callers 1

script.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected