summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeddy <[email protected]>2013-08-26 17:33:09 +0800
committerTeddy <[email protected]>2013-08-26 17:33:09 +0800
commiteb303ea6f1f6aa3e9a0cd4b00ef3fda6b06f0027 (patch)
treec31405d213ba7b142d3c756a89535379ffdf3c0e
parentaa937f1bee0c46cf4eb5442fdddd5ca5e24a217a (diff)
...
-rw-r--r--server/piztor/prob.py89
1 files changed, 46 insertions, 43 deletions
diff --git a/server/piztor/prob.py b/server/piztor/prob.py
index 17e7972..20b6779 100644
--- a/server/piztor/prob.py
+++ b/server/piztor/prob.py
@@ -65,47 +65,50 @@ if len(argv) == 2:
if len(argv) == 3:
username = argv[1]
- password = arv[2]
-
-resp = send(gen_auth(username, password))
-pl, optcode, status, uid, token = unpack("!LBBL32s", resp)
-print "size: " + str((pl, len(resp)))
-print "opt: " + str(optcode)
-print "status: " + str(status)
-print "uid: " + str(uid)
-print "token: " + get_hex(token)
-
-resp = send(gen_update_location(token, username, random(), random()))
-pl, optcode, status = unpack("!LBB", resp)
-print "size: " + str((pl, len(resp)))
-print "opt: " + str(optcode)
-print "status: " + str(status)
-
-resp = send(gen_request_location(token, username, gid))
-print len(resp)
-pl, optcode, status = unpack("!LBB", resp[:6])
-print "size: " + str((pl, len(resp)))
-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])
+ password = argv[2]
+
+for i in xrange(10):
+ resp = send(gen_auth(username, password))
+ pl, optcode, status, uid, token = unpack("!LBBL32s", resp)
+ print "size: " + str((pl, len(resp)))
+ print "opt: " + str(optcode)
+ print "status: " + str(status)
+ print "uid: " + str(uid)
+ print "token: " + get_hex(token)
+
+ resp = send(gen_update_location(token, username, random(), random()))
+ pl, optcode, status = unpack("!LBB", resp)
+ print "size: " + str((pl, len(resp)))
+ print "opt: " + str(optcode)
+ print "status: " + str(status)
+
+ resp = send(gen_request_location(token, username, gid))
+ print len(resp)
+ pl, optcode, status = unpack("!LBB", resp[:6])
+ print "size: " + str((pl, len(resp)))
+ 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, info_value)
+ 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)
+ from time import sleep
+ sleep(10)