Skip to content

Commit

Permalink
fix single quoting ids list for issue #20
Browse files Browse the repository at this point in the history
  • Loading branch information
biemster committed Nov 1, 2023
1 parent d122192 commit 8c2ce60
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
15 changes: 12 additions & 3 deletions FindMy_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,22 @@ def decode_tag(data):
names[hashed_adv] = name
else:
print("Couldn't find key pair in", keyfile)

data = '{"search": [{%s"ids": %s}]}' % ('' if args.map else '"startDate": 0, ', list(ids.keys()))
unixEpoch = int(datetime.datetime.now().strftime('%s'))
startdate = unixEpoch - 60 * 60 * 24 * 7
data = {
"search": [
{
"startDate": startdate *1000,
"endDate": unixEpoch *1000,
"ids": list(ids.keys())
}
]
}

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
sock.connect(('', 6176))
sock.sendall(bytes(data + '\n', encoding='ascii'))
sock.sendall(bytes(json.dumps(data) + '\n', encoding='ascii'))
response = b''
while True:
rdata = sock.recv(1024)
Expand Down
12 changes: 10 additions & 2 deletions request_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,19 @@ def getCurrentTimes():
print("Couldn't find key pair in", keyfile)

startdate = unixEpoch - 60 * 60 * args.hours
data = '{"search": [{"endDate": %d, "startDate": %d, "ids": %s}]}' % ((unixEpoch -978307200) *1000000, (startdate -978307200)*1000000, list(ids.keys()))
data = {
"search": [
{
"startDate": startdate *1000,
"endDate": unixEpoch *1000,
"ids": list(ids.keys())
}
]
}

# send out the whole thing
import requests
response = requests.post('https://gateway.icloud.com/acsnservice/fetch', headers=request_headers, data=data)
response = requests.post('https://gateway.icloud.com/acsnservice/fetch', headers=request_headers, json=data)
print(response.status_code, response.reason)
res = response.json()['results']
print('%d reports received.' % len(res))
Expand Down

0 comments on commit 8c2ce60

Please sign in to comment.