summaryrefslogtreecommitdiff
path: root/server/piztor/prob.py
diff options
context:
space:
mode:
authorGoblin911 <goblinliu@gmail.com>2013-08-26 11:18:45 +0800
committerGoblin911 <goblinliu@gmail.com>2013-08-26 11:18:45 +0800
commit70dda8318c79e8c92659ab6be8750efd31b6c6b1 (patch)
treed27079a2d75b7402cbaff17b0f7839500591b4d7 /server/piztor/prob.py
parent686cf083c79fce3a032d229bb1b7ea8ed49046c0 (diff)
parent595d0a7826e2fdb9ee859f9cde90cfef844b0342 (diff)
Merge branch 'master' of ssh://github.com/Determinant/piztor
Diffstat (limited to 'server/piztor/prob.py')
-rw-r--r--server/piztor/prob.py28
1 files changed, 23 insertions, 5 deletions
diff --git a/server/piztor/prob.py b/server/piztor/prob.py
index 57ce2fe..0ed328f 100644
--- a/server/piztor/prob.py
+++ b/server/piztor/prob.py
@@ -9,11 +9,12 @@ host = "localhost"
port = 9990
def gen_auth(username, password):
- length = 4 + 1 + len(username) + 1 + len(password)
+ length = 4 + 1 + len(username) + 1 + len(password) + 1
data = pack("!LB", length, 0x00)
data += username
data += "\0"
data += password
+ data += "\0"
return data
def gen_update_location(token, username, lat, lng):
@@ -78,12 +79,29 @@ print "status: " + str(status)
resp = send(gen_request_location(token, username, gid))
print len(resp)
-pl, optcode, status, length = unpack("!LBBL", resp[:10])
+pl, optcode, status = unpack("!LBB", resp[:6])
print "size: " + str((pl, len(resp)))
-idx = 10
-print "length: " + str(len(resp[10:]))
-for i in xrange(length):
+idx = 6
+print "length: " + str(len(resp[6:]))
+while idx < pl:
print len(resp[idx:idx + 20])
uid, lat, lng = unpack("!Ldd", resp[idx:idx + 20])
idx += 20
print (uid, lat, lng)
+
+resp = send(gen_request_user_info(token, username, uid))
+pl, optcode, status = unpack("!LBB", resp[:6])
+print "size: " + str((pl, len(resp)))
+
+idx = 6
+while idx < pl:
+ info_key, = unpack("!B", resp[idx:idx + 1])
+ idx += 1
+ print info_key
+ if info_key == 0x00:
+ info_value, = unpack("!L", resp[idx:idx + 4])
+ idx += 4
+ elif info_key == 0x01:
+ info_value, = unpack("!B", resp[idx:idx + 1])
+ idx += 1
+ print (info_key, info_value)