<s> """<STR_LIT>""" <EOL> import codecs <EOL> import json <EOL> import os <EOL> import tempfile <EOL> import urlparse <EOL> from . context import context <EOL> from . elf import ELF <EOL> from . log import getLogger <EOL> from . util . fiddling import b64d <EOL> from . util . fiddling import hexdump <EOL> from . util . misc import read <EOL> from . util . misc import write <EOL> from . util . safeeval import const <EOL> from . util . web import wget <EOL> log = getLogger ( __name__ ) <EOL> cache_dir = os . path . join ( tempfile . gettempdir ( ) , '<STR_LIT>' ) <EOL> def search_by_build_id ( hex_encoded_id ) : <EOL> """<STR_LIT>""" <EOL> cache = cache_dir + '<STR_LIT>' + hex_encoded_id <EOL> if os . path . exists ( cache ) and read ( cache ) . startswith ( '<STR_LIT>' ) : <EOL> log . info_once ( "<STR_LIT>" % cache ) <EOL> return cache <EOL> log . info ( "<STR_LIT>" ) <EOL> url_base = "<STR_LIT>" <EOL> url = urlparse . urljoin ( url_base , hex_encoded_id ) <EOL> data = "<STR_LIT>" <EOL> while not data . startswith ( '<STR_LIT>' ) : <EOL> data = wget ( url ) <EOL> if not data : <EOL> return None <EOL> if data . startswith ( '<STR_LIT:..>' ) : <EOL> url = os . path . dirname ( url ) + '<STR_LIT:/>' <EOL> url = urlparse . urljoin ( url , data ) <EOL> write ( cache , data ) <EOL> return cache <EOL> def get_build_id_offsets ( ) : <EOL> """<STR_LIT>""" <EOL> return { <EOL> '<STR_LIT>' : [ <NUM_LIT> ] , <EOL> '<STR_LIT>' : [ <NUM_LIT> ] , <EOL> '<STR_LIT>' : [ <NUM_LIT> ] , <EOL> '<STR_LIT>' : [ <NUM_LIT> ] , <EOL> '<STR_LIT>' : [ <NUM_LIT> , <NUM_LIT> ] , <EOL> '<STR_LIT>' : [ <NUM_LIT> ] , <EOL> '<STR_LIT>' : [ <NUM_LIT> ] , <EOL> '<STR_LIT>' : [ <NUM_LIT> ] , <EOL> '<STR_LIT>' : [ <NUM_LIT> ] <EOL> } . get ( context . arch , [ ] ) <EOL> __all__ = [ '<STR_LIT>' , '<STR_LIT>' ] </s>
