Advertisement
Guest User

Untitled

a guest
Oct 18th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.87 KB | None | 0 0
  1. import sys
  2. import realtime_bidding_pb2
  3. import base64
  4. import binascii
  5. import math
  6. from geopy.distance import vincenty as geodist
  7.  
  8. from realtime_bidding_pb2 import BidRequest
  9.  
  10. num = 0
  11. all_r = 0
  12. app_r = 0
  13. matched_r = 0
  14. for line in open(sys.argv[1], 'r'):
  15.  
  16.     try:
  17.         line1 = line.strip()#.split('POST ')[1]
  18.         s = ''
  19.  
  20.         pos = 0
  21.  
  22.         while pos < len(line1):
  23.             if line1[pos] == '\\' and line1[pos + 1] == 'x':
  24.                 h = line1[pos + 2:pos + 4]
  25.                 pos += 4
  26.                 s += chr(int(h, 16))
  27.             else:
  28.                 s += line1[pos]
  29.                 pos += 1
  30.                  
  31.         br = BidRequest()
  32.         br.ParseFromString(s)
  33.         if br.HasField('video') and 7 in br.video.protocols:
  34.           print br.video.protocols
  35.        
  36.     except Exception as e:
  37.         print e
  38.         continue
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement