Module: Poke::API::Signature
- Extended by:
- Fiddle::Importer, Logging
- Defined in:
- lib/poke-api/signature.rb
Class Method Summary
collapse
Methods included from Logging
formatter=, log_level=, logger
Class Method Details
76
77
78
79
|
# File 'lib/poke-api/signature.rb', line 76
def self.add_optional_information(name, client_info)
info_class = POGOProtos::Networking::Envelopes::Signature.const_get(name)
info_class.new(client_info)
end
|
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/poke-api/signature.rb', line 65
def self.add_optional_signature_information(sig, api_client)
%i(android_gps_info sensor_info device_info activity_status location_fix).each do |i|
name = Helpers.camel_case_lower(i)
if api_client.send(i)
message = add_optional_information(name, api_client.send(i))
i == :location_fix ? (sig.send(i) << message) : sig.send("#{i.to_s}=", message)
end
end
end
|
.create_signature(req, req_client, api_client) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/poke-api/signature.rb', line 33
def self.create_signature(req, req_client, api_client)
signature = POGOProtos::Networking::Envelopes::Signature.new(
location_hash1: Helpers.generate_location_one(req.auth_ticket.to_proto, req_client.position),
location_hash2: Helpers.generate_location_two(req_client.position),
unknown25: -8537042734809897855,
timestamp: Helpers.fetch_time,
timestamp_since_start: Helpers.fetch_time - req_client.start_time
)
add_requests(req, signature)
add_optional_signature_information(signature, api_client)
logger.debug "[+] Generated Signature \r\n#{signature.inspect}"
logger.debug "[+] Generated Protobuf Signature \r\n#{signature.to_proto.inspect}"
add_unknown6(req, signature)
end
|
.generate_signature(signature) ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/poke-api/signature.rb', line 19
def self.generate_signature(signature)
output_size = Fiddle::Pointer.malloc(1)
iv = SecureRandom.random_bytes(32)
encrypt(signature, signature.length, iv, 32, nil, output_size)
output = Fiddle::Pointer.malloc(288)
encrypt(signature, signature.length, iv, 32, output, output_size)
logger.debug "[+] Generated Encrypted Signature \r\n#{output.to_str.inspect}"
output.to_str
end
|
.load_signature(client) ⇒ Object
10
11
12
13
14
15
16
17
|
# File 'lib/poke-api/signature.rb', line 10
def self.load_signature(client)
dlload client.sig_path
extern "int encrypt(const unsigned char *input, size_t input_size," \
" const unsigned char* iv, size_t iv_size, unsigned char* " \
"output, size_t * output_size)"
logger.info '[+] Loaded Signature module'
client.sig_loaded = true
end
|