コード例 #1
0
ファイル: web_extract.py プロジェクト: zzzgoda/pbtk
                    pb_param,
                    'samples':
                    [GMapsAPIPrivate(pb_param, url).serialize_sample(qs)]
                })

            else:
                endpoints.append({
                    'transport':
                    'pburl_public',
                    'proto_path':
                    '',
                    'proto_msg':
                    '',
                    'url':
                    url,
                    'samples':
                    [GMapsAPIPublic(None, url).serialize_sample(qs)]
                })

            print('[Captured]', url, qs, data)
            if proto not in proto_to_urls:
                proto_to_urls[proto] = set()
            proto_to_urls[proto].add(url)
            return

    print('[Not captured]', url, data, '/', 'across', '=>', sent_msgs)


if __name__ == '__main__':
    extractor_main('pburl_extract')
コード例 #2
0
                        if fdefaultormsg in consts:
                            fdefaultormsg = consts[fdefaultormsg]

                        parse_default(field, ftype, fdefaultormsg)

                else:
                    fdefaultormsg = None

                    if ftype in ('group', 'message'):
                        ftype = 'bytes'

                field.type = type_consts[ftype]

                summary[int(fnumber)] = (flabel, ftype, fdefaultormsg)

        msg_path_to_obj[cls + '.' + var] = message
        print(summary)


type_consts = {
    k.split('_')[1].lower(): v
    for k, v in FieldDescriptorProto.Type.items()
}
label_consts = {
    k.split('_')[1].lower(): v
    for k, v in FieldDescriptorProto.Label.items()
}

if __name__ == '__main__':
    extractor_main('jar_extract')
コード例 #3
0
        
        # Search back for the (1, length-delimited) marker
        start = binr.rfind(b'\x0a', max(cursor - 128, 0), cursor)
        
        if start > 0 and binr[start - 1] == 0x0a == (cursor - start - 1):
            start -= 1
        
        if start == -1 or (cursor - start - 2) != binr[start + 1]:
            continue
        
        # Look just after for subsequent markers
        tags = b'\x12\x1a\x22\x2a\x32\x3a\x42\x4a\x50\x58\x62'
        if binr[cursor] not in tags:
            continue
        
        while cursor < len(binr) and binr[cursor] in tags:
            tags = tags[tags.index(binr[cursor]):]
            
            varint, end = _DecodeVarint(binr, cursor + 1)
            cursor = end + varint * (binr[cursor] & 0b111 == 2)
        
        # Parse descriptor
        proto = FileDescriptorProto()
        proto.ParseFromString(binr[start:cursor])
        
        # Convert to ascii
        yield descpb_to_proto(proto)

if __name__ == '__main__':
    extractor_main('from_binary')