forked from rastapasta/pokemon-go-mitm
-
Notifications
You must be signed in to change notification settings - Fork 1
/
example.dumpRawTraffic.coffee
37 lines (29 loc) · 1.29 KB
/
example.dumpRawTraffic.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
###
Pokemon Go(c) MITM node proxy
by Michael Strassburger <[email protected]>
This example dumps all raw envelopes and signatures to separate files
###
PokemonGoMITM = require './lib/pokemon-go-mitm'
fs = require 'fs'
pcrypt = require 'pcrypt'
server = new PokemonGoMITM port: 8081, debug: true
.addRawRequestEnvelopeHandler (buffer) ->
timestamp = Date.now()
if decoded = @parseProtobuf buffer, 'POGOProtos.Networking.Envelopes.RequestEnvelope'
id = decoded.request_id
console.log "[#] Request Envelope", decoded
fs.writeFileSync "#{timestamp}.#{id}.request", buffer, 'binary'
# TODO: update once repeated field 6 is parsed
return false unless decoded?.unknown6[0]?.unknown2?.encrypted_signature
buffer = pcrypt.decrypt decoded.unknown6[0]?.unknown2?.encrypted_signature
decoded = @parseProtobuf buffer, 'POGOProtos.Networking.Envelopes.Signature'
console.log "[@] Request Envelope Signature", decoded
fs.writeFileSync "#{timestamp}.#{id}.signature", buffer, 'binary'
false
.addRawResponseEnvelopeHandler (buffer) ->
timestamp = Date.now()
if decoded = @parseProtobuf buffer, 'POGOProtos.Networking.Envelopes.ResponseEnvelope'
id = decoded.request_id
console.log "[#] Response Envelope", decoded
fs.writeFileSync "#{timestamp}.#{id}.response", buffer, 'binary'
false