rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
props[section][key] = Array(val, signature=signature) | if key in ['dns']: props[section][key] = Array(val, signature='u') else: props[section][key] = Array(val, signature=signature) | def patch_list_signature(props, signature='au'): """ Patches empty list signature in ``props`` with ``signature`` :param props: Dictionary with connection options :type props: dict :param signature: The signature to use in empty lists :rtype: dict """ for section in props: for key, val in props[section].iteritems(): i... |
def get_network_mode_cb(resp): gsm = int(resp[0].group('gsm')) umts = int(resp[0].group('umts')) if gsm == ERINFO_2G_GPRS: return consts.MM_NETWORK_MODE_GPRS elif gsm == ERINFO_2G_EGPRS: return consts.MM_NETWORK_MODE_EDGE elif umts == ERINFO_3G_UMTS: return consts.MM_NETWORK_MODE_UMTS elif umts == ERINFO_3G_HSDPA: ret... | ERICSSON_CONN_DICT_REV = revert_dict(ERICSSON_CONN_DICT) def get_network_mode_cb(mode): if mode in ERICSSON_CONN_DICT_REV: return ERICSSON_CONN_DICT_REV[mode] raise E.GenericError("unknown network mode: %d" % mode) d = self.get_radio_status() | def get_network_mode(self): |
def setUpClass(self): | def setUp(self): return self.setUpOnce() def setUpOnce(self): global device, numtests if device: self.device = device return defer.succeed(True) if numtests is None: numtests = len([m for m in dir(self) if m.startswith('test_')]) | def setUpClass(self): # setUpClass is meant to be deprecated, and setUp should be # used instead, however setUp's behaviour doesn't replicates # setUpClass' one, so for now we're going to use this # Twisted deprecated function d = defer.Deferred() self.device = None |
self.device = bus.get_object(MM_SERVICE, opaths[0]) | self.device = device = bus.get_object(MM_SERVICE, opaths[0]) | def get_device_from_opath(opaths): if not len(opaths): raise unittest.SkipTest("Can't run this test without devices") |
def tearDownClass(self): | def tearDown(self): global numtests if numtests == 1: numtests = None return self.tearDownOnce() else: numtests -= 1 return defer.succeed(True) def tearDownOnce(self): global device | def tearDownClass(self): # disable device at the end of the test self.device.Enable(False, dbus_interface=MDM_INTFACE) |
name, number = u"中华人民共和国", "+43544311113" | name, number = u"中华人民共和", "+43544311113" | def test_ContactsAdd_UTF8_name(self): """Test for Contacts.Add""" name, number = u"中华人民共和国", "+43544311113" # add a contact with UTF8 data index = self.device.Add(name, number, dbus_interface=CTS_INTFACE) # get the object via DBus and check that its data is correct _index, _name, _number = self.device.Get(index, dbus_i... |
self.failUnlessIn(MM_NETWORK_MODE_ANY, get_network_modes(modes)) | self.failIfIn(MM_NETWORK_MODE_ANY, get_network_modes(modes)) | def test_CardSupportedModesProperty(self): """Test for Card.SupportedModes property""" modes = self.device.Get(CRD_INTFACE, 'SupportedModes', dbus_interface=dbus.PROPERTIES_IFACE) if not modes: raise unittest.SkipTest("Cannot be tested") |
if self.sim is None or self.sim.size is None: self.sim = self.sim_klass(self.sconn) d = self.sim.initialize() else: d = defer.succeed(self.sim.size) d.addCallback(on_init) return d | self.sim = self.sim_klass(self.sconn) return self.sim.initialize() | def initialize_sim(_): if self.sim is None or self.sim.size is None: self.sim = self.sim_klass(self.sconn) d = self.sim.initialize() else: d = defer.succeed(self.sim.size) |
sms.status_request = self.status_request | sms.request_status = self.status_request | def to_pdu(self, store=False): """Returns the PDU representation of this message""" sms = SmsSubmit(self.number, self.text) |
modes.pop(MM_NETWORK_BAND_ANY) | modes.pop(MM_NETWORK_MODE_ANY) | def get_network_modes(self): """Returns the supported network modes""" modes = self.custom.conn_dict.keys() if MM_NETWORK_MODE_ANY in modes: modes.pop(MM_NETWORK_BAND_ANY) # cast it to UInt32 return defer.succeed(dbus.UInt32(sum(modes))) |
for key, val in headers: | for key, val in headers.items(): | def dbus_data_to_mms(headers, data_parts): """Returns a `MMSMessage` out of ``dbus_data``""" mms = MMSMessage() content_type = '' for key, val in headers: if key == 'Content-Type': content_type = val else: mms.headers[key] = val mms.content_type = content_type # add data parts for data_part in data_parts: content_ty... |
self.name = gk.get_default_keyring_sync() | self.name = self.gk.get_default_keyring_sync() | def _setup_keyring(self): # import it here so importing this backend on a non GNOME # system doesn't fails import gnomekeyring as gk self.gk = gk self.name = gk.get_default_keyring_sync() |
gk.set_default_keyring_sync(self.name) | self.gk.set_default_keyring_sync(self.name) | def _setup_keyring(self): # import it here so importing this backend on a non GNOME # system doesn't fails import gnomekeyring as gk self.gk = gk self.name = gk.get_default_keyring_sync() |
gk.create_sync(self.name, None) except gnomekeyring.AlreadyExistsError: | self.gk.create_sync(self.name, None) except self.gk.AlreadyExistsError: | def _setup_keyring(self): # import it here so importing this backend on a non GNOME # system doesn't fails import gnomekeyring as gk self.gk = gk self.name = gk.get_default_keyring_sync() |
ret = buf.getvalue().split('\r\n\r\n')[1] | _, data = buf.getvalue().split('\r\n\r\n') | def do_get_payload(url, extra_info): host, port = extra_info['wap2'].split(':') s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, int(port))) s.send("GET %s HTTP/1.0\r\n\r\n" % url) buf = StringIO() while True: data = s.recv(4096) if not data: break buf.write(data) s.close() ret = buf.getvalue... |
return array("B", ret) | return array("B", data) | def do_get_payload(url, extra_info): host, port = extra_info['wap2'].split(':') s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, int(port))) s.send("GET %s HTTP/1.0\r\n\r\n" % url) buf = StringIO() while True: data = s.recv(4096) if not data: break buf.write(data) s.close() ret = buf.getvalue... |
ret = buf.getvalue().split('\r\n\r\n')[1] | _, data = buf.getvalue().split('\r\n\r\n') | def do_post_payload(extra_info, payload): host, port = extra_info['wap2'].split(':') mmsc = extra_info['mmsc'] s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, int(port))) s.send("POST %s HTTP/1.0\r\n\r\n" % mmsc) s.send("Content-type: application/vnd.wap.mms-message\r\n") s.send("Content-Length:... |
return array("B", ret) | return array("B", data) | def do_post_payload(extra_info, payload): host, port = extra_info['wap2'].split(':') mmsc = extra_info['mmsc'] s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, int(port))) s.send("POST %s HTTP/1.0\r\n\r\n" % mmsc) s.send("Content-type: application/vnd.wap.mms-message\r\n") s.send("Content-Length:... |
message = MMSMessage() message.headers['Transaction-Id'] = tx_id message.headers['Message-Type'] = 'm-notifyresp-ind' message.headers['Status'] = 'Retrieved' | mms = MMSMessage() mms.headers['Transaction-Id'] = tx_id mms.headers['Message-Type'] = 'm-notifyresp-ind' mms.headers['Status'] = 'Retrieved' | def send_m_notifyresp_ind(extra_info, tx_id): message = MMSMessage() message.headers['Transaction-Id'] = tx_id message.headers['Message-Type'] = 'm-notifyresp-ind' message.headers['Status'] = 'Retrieved' return post_payload(extra_info, message.encode()) |
return post_payload(extra_info, message.encode()) | return post_payload(extra_info, mms.encode()) | def send_m_notifyresp_ind(extra_info, tx_id): message = MMSMessage() message.headers['Transaction-Id'] = tx_id message.headers['Message-Type'] = 'm-notifyresp-ind' message.headers['Status'] = 'Retrieved' return post_payload(extra_info, message.encode()) |
return props | return dict(props) | def transpose_from_NM(oldprops): # call on read props = copy.deepcopy(oldprops) if 'gsm' in props: # map to Modem manager constants, default to ANY if not 'network-type' in props['gsm']: props['gsm']['network-type'] = MM_ALLOWED_MODE_ANY else: nm_val = props['gsm'].get('network-type') props['gsm']['network-type'] = NM... |
map(self._on_new_nm_profile, self.nm_manager.ListConnections()) | def _init_nm_manager(self): obj = self.bus.get_object(NM_USER_SETTINGS, NM_SYSTEM_SETTINGS_OBJ) self.nm_manager = dbus.Interface(obj, NM_SYSTEM_SETTINGS) # cache existing profiles map(self._on_new_nm_profile, self.nm_manager.ListConnections()) | |
nm_obj = self.nm_profiles[props['connection']['uuid']] return NMProfile(self.get_next_dbus_opath(), nm_obj, gconf_path, dict(props), self) | uuid = props['connection']['uuid'] try: return NMProfile(self.get_next_dbus_opath(), self.nm_profiles[uuid], gconf_path, props, self) except KeyError: raise ex.ProfileNotFoundError("Profile '%s' could not " "be found" % uuid) | def _get_profile_from_gconf_path(self, gconf_path): props = defaultdict(dict) for path in self.helper.client.all_dirs(gconf_path): for entry in self.helper.client.all_entries(path): section, key = entry.get_key().split('/')[-2:] value = entry.get_value() if value is not None: props[section][key] = self.helper.get_value... |
raise KeyError("Unknown network mode %s" % tech) | raise KeyError("Unknown network mode %s" % _mode) | def get_network_mode_cb(resp): _mode = int(resp[0].group('mode')) ICERA_MODE_DICT_REV = revert_dict(ICERA_MODE_DICT) if _mode in ICERA_MODE_DICT_REV: return ICERA_MODE_DICT_REV[_mode] |
if 'tty' in device: return True if 'hso' in device: return True if 'usb' in device: return True | for name in ['tty', 'hso', 'usb']: if name in device: return True return False | def check_if_valid_device(device): # Huawei, Novatel, ZTE, Old options, etc. if 'tty' in device: return True # HSO devices if 'hso' in device: return True # MBM devices if 'usb' in device: return True |
ret['n'] = 180.0*(lat+1-(1<<(lat_length-1)))/(1<<lat_length) ret['s'] = 180.0*(lat-(1<<(lat_length-1)))/(1<<lat_length) ret['e'] = 360.0*(lon+1-(1<<(lon_length-1)))/(1<<lon_length) ret['w'] = 360.0*(lon-(1<<(lon_length-1)))/(1<<lon_length) | if lat_length: ret['n'] = 180.0*(lat+1-(1<<(lat_length-1)))/(1<<lat_length) ret['s'] = 180.0*(lat-(1<<(lat_length-1)))/(1<<lat_length) else: ret['n'] = 90.0 ret['s'] = -90.0 if lon_length: ret['e'] = 360.0*(lon+1-(1<<(lon_length-1)))/(1<<lon_length) ret['w'] = 360.0*(lon-(1<<(lon_length-1)))/(1<<lon_length) else: ret[... | def bbox(hashcode): ''' decode a hashcode and get north, south, east and west border. ''' if _geohash: (lat,lon,lat_bits,lon_bits) = _geohash.decode(hashcode) latitude_delta = 180.0/(1<<lat_bits) longitude_delta = 360.0/(1<<lon_bits) return {'s':lat,'w':lon,'n':lat+latitude_delta,'e':lon+longitude_delta} (lat,lon,lat_... |
return {'s':lat,'e':lon,'n':lat+latitude_delta,'w':lon+longitude_delta} | return {'s':lat,'w':lon,'n':lat+latitude_delta,'e':lon+longitude_delta} | def bbox(hashcode): ''' decode a hashcode and get north, south, east and west border. ''' if _geohash: (lat,lon,lat_bits,lon_bits) = _geohash.decode(hashcode) latitude_delta = 180.0/(1<<lat_bits) longitude_delta = 360.0/(1<<lon_bits) return {'s':lat,'e':lon,'n':lat+latitude_delta,'w':lon+longitude_delta} (lat,lon,lat_... |
if _geohash and len(treecode)<=64: | if _geohash and len(treecode)<64: | def decode(treecode, delta=False): if _geohash and len(treecode)<=64: unit = _geohash.intunit/2 treecode += "3" # generate center coordinate args = [] for i in range(len(treecode)/unit): t = 0 for j in range(unit): t = (t<<2) + {"0":0,"1":2,"2":1,"3":3}[treecode[i*unit+j]] args.append(t) if len(treecode)%unit: t = 0 ... |
precision=(lat_length+lon_length)/5 | precision = int((lat_length+lon_length)/5) | def _encode_i2c(lat,lon,lat_length,lon_length): precision=(lat_length+lon_length)/5 if lat_length < lon_length: a = lon b = lat else: a = lat b = lon boost = (0,1,4,5,16,17,20,21) ret = '' for i in range(precision): ret+=_base32[(boost[a&7]+(boost[b&3]<<1))&0x1F] t = a>>3 a = b>>2 b = t return ret[::-1] |
lat_length=lon_length=xprecision*5/2 | lat_length = lon_length = int(xprecision*5/2) | def encode(latitude, longitude, precision=12): if latitude >= 90.0 or latitude < -90.0: raise Exception("invalid latitude.") while longitude < -180.0: longitude += 360.0 while longitude >= 180.0: longitude -= 360.0 if _geohash: basecode=_geohash.encode(latitude,longitude) if len(basecode)>precision: return basecode[0:... |
ret.append(_encode_i2c(tlat,tlon,lat_length,lon_length)) | code = _encode_i2c(tlat,tlon,lat_length,lon_length) if code: ret.append(code) | def neighbors(hashcode): if _geohash and len(hashcode)<25: return _geohash.neighbors(hashcode) (lat,lon,lat_length,lon_length) = _decode_c2i(hashcode) ret = [] tlat = lat for tlon in (lon-1, lon+1): ret.append(_encode_i2c(tlat,tlon,lat_length,lon_length)) tlat = lat+1 if not tlat >> lat_length: for tlon in (lon-1, lon... |
print(method, terrain, slot, monkey.encounters) | def reduce_encounters(root): # Here's what happens: # 1. We group by method (since different methods have different slots, # encounters cannot reasonably be compared across methods). # 2. We group by terrain (since we can't collapse terrains). # 3. We group by slot. Each slot will be individually examined for # r... | |
else: print (condition_set) | def reduce_encounters(root): # Here's what happens: # 1. We group by method (since different methods have different slots, # encounters cannot reasonably be compared across methods). # 2. We group by terrain (since we can't collapse terrains). # 3. We group by slot. Each slot will be individually examined for # r... | |
def add_encounter(session, context, xml_encounter): ctx = context a = xml_encounter.attrib slot = int(a['slot']) | def insert_encounters(session, ctx, encounters): for e in encounters: encounter = make_encounter(e, ctx) session.add(encounter) session.flush() def make_encounter(obj, ctx): """Make an db.Encounter object from a dict""" def get_terrain_id(terrain): return session.query(EncounterTerrain.id).filter_by(identifier=terra... | def add_encounter(session, context, xml_encounter): ctx = context a = xml_encounter.attrib slot = int(a['slot']) e = Encounter() e.pokemon_id = int(a['pokemon_id']) #e.form_id = int(a['form_id']) e.slot = int(a['slot']) e.version_id = ctx['version_id'] e.terrain_id = ctx['terrain_id'] e.method_id = ctx['method_id'] ... |
e.pokemon_id = int(a['pokemon_id']) e.slot = int(a['slot']) e.version_id = ctx['version_id'] e.terrain_id = ctx['terrain_id'] e.method_id = ctx['method_id'] session.add(e) | e.pokemon_id = obj['pokemon_id'] e.version_id = ctx['version'].id if obj['terrain'] is not None: terrain_id = get_terrain_id(obj['terrain']) else: terrain_id = None method_id = get_method_id(obj['method']) e.slot = get_or_create_encounter_slot( slot = obj['slot'], version_group_id = ctx['version'].version_group_id,... | def add_encounter(session, context, xml_encounter): ctx = context a = xml_encounter.attrib slot = int(a['slot']) e = Encounter() e.pokemon_id = int(a['pokemon_id']) #e.form_id = int(a['form_id']) e.slot = int(a['slot']) e.version_id = ctx['version_id'] e.terrain_id = ctx['terrain_id'] e.method_id = ctx['method_id'] ... |
version = get_version(game.get('version')) version_group_id = version.version_group_id generation_id = version.version_group.generation_id | ctx['version'] = get_version(game.get('version')) ctx['region'] = ctx['version'].version_group.generation.main_region | def main(): engine = create_engine('sqlite:///test.sqlite') session.bind = engine load_conditions() load_versions() with open(sys.argv[1], "rb") as f: # Although the documentation for lxml discourages passing # unicode, that seem to be the only way to get it to use # unicode strings in the tree. xml = parse_xml(f) f... |
ctx['location'] = get_or_create_location(session, loc, ctx) | def main(): engine = create_engine('sqlite:///test.sqlite') session.bind = engine load_conditions() load_versions() with open(sys.argv[1], "rb") as f: # Although the documentation for lxml discourages passing # unicode, that seem to be the only way to get it to use # unicode strings in the tree. xml = parse_xml(f) f... | |
context = { "loc": loc.get('name'), "area": area.get('name'), } print context | ctx['area'] = create_area(session, area, ctx) if area.get('name', ''): print loc.get('name') + "/" + area.get('name') else: print loc.get('name') | def main(): engine = create_engine('sqlite:///test.sqlite') session.bind = engine load_conditions() load_versions() with open(sys.argv[1], "rb") as f: # Although the documentation for lxml discourages passing # unicode, that seem to be the only way to get it to use # unicode strings in the tree. xml = parse_xml(f) f... |
for e in sorted(encounters, key=itemgetter('method', 'terrain')): print e | insert_encounters(session, ctx, encounters) session.commit() | def main(): engine = create_engine('sqlite:///test.sqlite') session.bind = engine load_conditions() load_versions() with open(sys.argv[1], "rb") as f: # Although the documentation for lxml discourages passing # unicode, that seem to be the only way to get it to use # unicode strings in the tree. xml = parse_xml(f) f... |
url = "http://unconfounded.appspot.com/landing/" + str(key) | url = '%s/landing/%s' % (self.request.host_url, str(key)) | def get(self, raw_resource): resource = str(urllib.unquote(raw_resource)) blob_reader = blobstore.BlobReader(resource) d = yaml.load(blob_reader) connection = mturk_connection(d) experiment = Experiment() experiment.url = d['external_hit_url'] key = experiment.put() # gets primary key from datastore url = "http://uncon... |
if worker_id is None: self.bad_request('No workerId') elif assignment_id is None: | if assignment_id is None: | def get(self): worker_id = self.request.GET.get('workerId', None) |
self.render('templates/info.htm', {'message': 'You need to accept the HIT'}) | self.render('templates/info.htm', {'message': 'Please accept the HIT'}) | def get(self): worker_id = self.request.GET.get('workerId', None) |
response = create_hit(self.connection, question, self.data) | response = mturk.create_hit(self.connection, question, self.data) | def post(self): experiment = Experiment() experiment.owner = users.get_current_user() experiment.params = self.reader.blob_info.key() experiment.url = self.data['external_hit_url'] |
pieces = [ theline[i:j] for i, j in zip([0]+cuts, cuts) ] | pieces = [ theline[i:j].strip() for i, j in zip([0]+cuts, cuts) ] | def split_at(theline, cuts, lastfield=True): pieces = [ theline[i:j] for i, j in zip([0]+cuts, cuts) ] if lastfield: pieces.append(theline[cuts[-1]:]) return pieces |
pieces.append(theline[cuts[-1]:]) | pieces.append(theline[cuts[-1]:].strip()) | def split_at(theline, cuts, lastfield=True): pieces = [ theline[i:j] for i, j in zip([0]+cuts, cuts) ] if lastfield: pieces.append(theline[cuts[-1]:]) return pieces |
uname_cmd = item.generatePayload(xml2config.getKernelCode()) | uname_cmd = item.generatePayload(xml2config.getKernelCode(isUnix)) | def start(self): domain = self.chooseDomains() vuln = self.chooseVuln(domain.getAttribute("hostname")) |
for k,v in headDict.items(): self._log(" Header: '%s' -> %s"%(k, v), self.LOG_DEBUG) | for ck,v in headDict.items(): self._log(" Header: '%s' -> %s"%(ck, v), self.LOG_DEBUG) | def analyzeURL(self, result, k, v, post=None, haxMode=0, header=None, headerKey=None): tmpurl = self.Target_URL tmppost = post headDict = header rndStr = self.getRandomStr() if (haxMode == 0): tmpurl = tmpurl.replace("%s=%s"%(k,v), "%s=%s"%(k, rndStr)) elif (haxMode == 1): tmppost = tmppost.replace("%s=%s"%(k,v), "%s=... |
self._log("Possible local file disclosure found! -> '%s' with Parameter '%s'. (%s)"%(tmpurl, k), self.LOG_ALWAYS, lang) | self._log("Possible local file disclosure found! -> '%s' with Parameter '%s'. (%s)"%(tmpurl, k, lang), self.LOG_ALWAYS) | def analyzeURL(self, result, k, v, post=None, isPost=False): tmpurl = self.Target_URL tmppost = post rndStr = self.getRandomStr() if (not isPost): tmpurl = tmpurl.replace("%s=%s"%(k,v), "%s=%s"%(k, rndStr)) else: tmppost = tmppost.replace("%s=%s"%(k,v), "%s=%s"%(k, rndStr)) code = None if (post==None): self._log("Reque... |
self._log("Possible local file disclosure found! -> '%s' with POST-Parameter '%s'. (%s)"%(tmpurl, k), self.LOG_ALWAYS, lang) | self._log("Possible local file disclosure found! -> '%s' with POST-Parameter '%s'. (%s)"%(tmpurl, k, lang), self.LOG_ALWAYS) | def analyzeURL(self, result, k, v, post=None, isPost=False): tmpurl = self.Target_URL tmppost = post rndStr = self.getRandomStr() if (not isPost): tmpurl = tmpurl.replace("%s=%s"%(k,v), "%s=%s"%(k, rndStr)) else: tmppost = tmppost.replace("%s=%s"%(k,v), "%s=%s"%(k, rndStr)) code = None if (post==None): self._log("Reque... |
rep = self.identifyVuln(self.Target_URL, self.params, k, blindmode=("/.." * i, True)) | rep = self.identifyVuln(self.Target_URL, self.params, k, post, isPost, blindmode=("/.." * i, True)) | def analyzeURLblindly(self, i, testfile, k, v, find, post=None, isPost=False): tmpurl = self.Target_URL tmppost = post rep = None doBreak = False if (not isPost): tmpurl = tmpurl.replace("%s=%s"%(k,v), "%s=%s"%(k, testfile)) else: tmppost = tmppost.replace("%s=%s"%(k,v), "%s=%s"%(k, testfile)) if (post != None and p... |
print diff | def startGoogleScan(self): print "Querying Google Search: '%s' with max pages %d..."%(self.config["p_query"], self.config["p_pages"]) | |
MAX_VALUE = 1000000 | def get_results(self): """ Gets a page of results """ if self.eor: return [] | |
search_info = self._extract_info(page) | results = self._extract_results(page) search_info = {'from': self.results_per_page*self._page, 'to': self.results_per_page*self._page + len(results), 'total': MAX_VALUE} | def get_results(self): """ Gets a page of results """ if self.eor: return [] |
results = self._extract_results(page) | if self.num_results == 0: self.eor = True return [] | def get_results(self): """ Gets a page of results """ if self.eor: return [] |
if (r.isUnix and self.config["p_dot_trunc_only_win"]): | if (r.isUnix() and self.config["p_dot_trunc_only_win"]): | def identifyVuln(self, URL, Params, VulnParam, PostData, Language, isPost=False, blindmode=None, isUnix=None): xml2config = self.config["XML2CONFIG"] if (blindmode == None): |
if (diff < self.cooldown): | print diff if (diff <= self.cooldown): | def startGoogleScan(self): print "Querying Google Search: '%s' with max pages %d..."%(self.config["p_query"], self.config["p_pages"]) |
for head in headers: if head[0] in ("set-cookie", "set-cookie2"): cookie = head[1] c = Cookie.SimpleCookie() c.load(cookie) for k,v in c.items(): extHeader += "%s=%s; " %(k, c[k].value) | def scan(self): print "Requesting '%s'..." %(self.URL) extHeader = "" code, headers = self.doRequest(self.URL, self.config["p_useragent"], self.config["p_post"], self.config["header"], self.config["p_ttl"]) for head in headers: if head[0] in ("set-cookie", "set-cookie2"): cookie = head[1] c = Cookie.SimpleCookie() c.l... | |
up = self.FTPuploadFile(settings["php_info"][0], rep.getAppendix()) | up = self.FTPuploadFile(quiz, rep.getAppendix()) | def readFiles(self, rep): xml2config = self.config["XML2CONFIG"] langClass = None if rep.isLanguageSet(): langClass = xml2config.getAllLangSets()[rep.getLanguage()] else: if (self.config["p_autolang"]): self._log("Unknown language - Autodetecting...", self.LOG_WARN) if (rep.autoDetectLanguageByExtention(xml2config.getA... |
up = self.putLocalPayload(settings["php_info"][0], rep.getAppendix()) | up = self.putLocalPayload(quiz, rep.getAppendix()) | def readFiles(self, rep): xml2config = self.config["XML2CONFIG"] langClass = None if rep.isLanguageSet(): langClass = xml2config.getAllLangSets()[rep.getLanguage()] else: if (self.config["p_autolang"]): self._log("Unknown language - Autodetecting...", self.LOG_WARN) if (rep.autoDetectLanguageByExtention(xml2config.getA... |
if (self.readFile(rep, up["http"], settings["php_info"][1], True)): | if (self.readFile(rep, up["http"], answer, True)): | def readFiles(self, rep): xml2config = self.config["XML2CONFIG"] langClass = None if rep.isLanguageSet(): langClass = xml2config.getAllLangSets()[rep.getLanguage()] else: if (self.config["p_autolang"]): self._log("Unknown language - Autodetecting...", self.LOG_WARN) if (rep.autoDetectLanguageByExtention(xml2config.getA... |
self.kernelversion_code = kernel_node.getAttribute("source") | self.kernelversion_code = str(kernel_node.getAttribute("source")) | def __init_xmlresult(self): xmlfile = self.xmlfile if (os.path.exists(xmlfile)): self.XML_Generic = xml.dom.minidom.parse(xmlfile) self.XML_Rootitem = self.XML_Generic.firstChild rel_node = getXMLNode(self.XML_Rootitem, "relative_files") rel_files = getXMLNodes(rel_node, "file") for f in rel_files: self.relative_files... |
langname = c.getAttribute("name") langfile = c.getAttribute("langfile") | langname = str(c.getAttribute("name")) langfile = str(c.getAttribute("langfile")) | def __loadLanguageSets(self): langnodes = getXMLNode(self.XML_Rootitem, "languagesets") for c in langnodes.childNodes: if (c.nodeName == "language"): langname = c.getAttribute("name") langfile = c.getAttribute("langfile") langClass = baseLanguage(langname, langfile, self.config) self.langsets[langname] = langClass self... |
self.sniper_regex = getXMLNode(self.XML_Rootitem, "snipe").getAttribute("regex") | self.sniper_regex = str(getXMLNode(self.XML_Rootitem, "snipe").getAttribute("regex")) | def __populate(self): self.XMLRevision = int(self.XML_Rootitem.getAttribute("revision")) self.XMLAutor = self.XML_Rootitem.getAttribute("autor") self.do_force_inclusion_test = self.XML_Rootitem.getAttribute("force_inclusion_test") == "1" rel_node = getXMLNode(self.XML_Rootitem, "rel... |
self.quiz_function = quiz_code | self.quiz_function = str(quiz_code) | def __populate(self): self.XMLRevision = int(self.XML_Rootitem.getAttribute("revision")) self.XMLAutor = self.XML_Rootitem.getAttribute("autor") self.do_force_inclusion_test = self.XML_Rootitem.getAttribute("force_inclusion_test") == "1" rel_node = getXMLNode(self.XML_Rootitem, "rel... |
self.print_function = print_code | self.print_function = str(print_code) | def __populate(self): self.XMLRevision = int(self.XML_Rootitem.getAttribute("revision")) self.XMLAutor = self.XML_Rootitem.getAttribute("autor") self.do_force_inclusion_test = self.XML_Rootitem.getAttribute("force_inclusion_test") == "1" rel_node = getXMLNode(self.XML_Rootitem, "rel... |
self.eval_kickstarter = eval_code | self.eval_kickstarter = str(eval_code) | def __populate(self): self.XMLRevision = int(self.XML_Rootitem.getAttribute("revision")) self.XMLAutor = self.XML_Rootitem.getAttribute("autor") self.do_force_inclusion_test = self.XML_Rootitem.getAttribute("force_inclusion_test") == "1" rel_node = getXMLNode(self.XML_Rootitem, "rel... |
self.detector_include.append(f.getAttribute("regex")) | self.detector_include.append(str(f.getAttribute("regex"))) | def __populate(self): self.XMLRevision = int(self.XML_Rootitem.getAttribute("revision")) self.XMLAutor = self.XML_Rootitem.getAttribute("autor") self.do_force_inclusion_test = self.XML_Rootitem.getAttribute("force_inclusion_test") == "1" rel_node = getXMLNode(self.XML_Rootitem, "rel... |
self.source = getXMLNode(xmlPayload, "code").getAttribute("source") | self.source = str(getXMLNode(xmlPayload, "code").getAttribute("source")) | def __init__(self, xmlPayload, config, ParentName): self.initLog(config) self.name = xmlPayload.getAttribute("name") self.doBase64 = (xmlPayload.getAttribute("dobase64") == "1") self.inshell = (xmlPayload.getAttribute("inshell") == "1") self.inputlist = getXMLNodes(xmlPayload, "input") self.source = getXMLNode(xmlPayl... |
self.filepath = xmlFile.getAttribute("path") self.postdata = xmlFile.getAttribute("post") self.findstr = xmlFile.getAttribute("find") self.flags = xmlFile.getAttribute("flags") | self.filepath = str(xmlFile.getAttribute("path")) self.postdata = str(xmlFile.getAttribute("post")) self.findstr = str(xmlFile.getAttribute("find")) self.flags = str(xmlFile.getAttribute("flags")) | def __init__(self, xmlFile, config): self.initLog(config) self.filepath = xmlFile.getAttribute("path") self.postdata = xmlFile.getAttribute("post") self.findstr = xmlFile.getAttribute("find") self.flags = xmlFile.getAttribute("flags") self._log("fimap FileObject loaded: %s" %(self.filepath), self.LOG_DEVEL) |
if (doRemoteWarn): print "WARNING: Some domains may be not listed here because dynamic_rfi is not configured! " | def chooseDomains(self, OnlyExploitable=True): choose = {} nodes = self.getDomainNodes() idx = 1 header = ":: List of Domains ::" textarr = [] for n in nodes: host = n.getAttribute("hostname") kernel = n.getAttribute("kernel") if (kernel == ""): kernel = None showit = False for child in self.getNodesOfDomain(host): mod... | |
if self.num_results == 0: self.eor = True return [] | def get_results(self): """ Gets a page of results """ if self.eor: return [] | |
def test_reset_results(self): | def disabled_test_reset_results(self): | def test_reset_results(self): file_list = [] original_open = codecs.open try: # Test that we update expectations in place. If the expectation # is missing, update the expected generic location. file_list = [] codecs.open = _mocked_open(original_open, file_list) passing_run(['--pixel-tests', '--reset-results', 'passes/i... |
'resource_type': func.name[3:-1].lower() | 'resource_type': func.name[3:-1].lower(), 'count_name': func.GetOriginalArgs()[0].name, | def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" code = """%(return_type)s %(name)s(%(typed_args)s) { |
file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" %s_id_handler_->FreeIds(%s);\n" % (func.name[6:-1].lower(), func.MakeOriginalArgString(""))) file.Write(" helper_->%sImmediate(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n")... | code = """%(return_type)s %(name)s(%(typed_args)s) { if (%(count_name)s < 0) { SetGLError(GL_INVALID_VALUE, "gl%(name)s: n < 0"); return; } %(resource_type)s_id_handler_->FreeIds(%(args)s); helper_->%(name)sImmediate(%(args)s); } """ file.Write(code % { 'return_type': func.return_type, 'name': func.original_name, 'typ... | def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" impl_decl = func.GetInfo('impl_decl') if impl_decl == None or impl_decl == True: file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" %s_id_handler_->FreeIds(%s);\n... |
GLsizei num_values = util_.GLGetNumValuesReturned(pname); if (num_values == 0) { SetGLError(GL_INVALID_ENUM, "gl%(func_name)s: invalid enum"); return error::kNoError; } | GLsizei num_values = GetNumValuesReturnedForGLGet(pname, &num_values); | code = """ typedef %(func_name)s::Result Result; |
keys = self.data_keys self.data_keys = [] | keys = self.new_data_keys self.new_data_keys = [] | def save_data(self, data): if not data: logging.warning("No data to save.") return False |
key = keys.pop(0) | key = keys[0] | def save_data(self, data): if not data: logging.warning("No data to save.") return False |
data_entry.put() | try: data_entry.put() except Exception, err: logging.error("Failed to save data store entry: %s", err) if keys: self.delete_data(keys) return False | def save_data(self, data): if not data: logging.warning("No data to save.") return False |
self.data_keys.append(data_entry.key()) | self.new_data_keys.append(data_entry.key()) if keys: keys.pop(0) | def save_data(self, data): if not data: logging.warning("No data to save.") return False |
self._meter.update("Testing: %d ran as expected, %d didn't, %d left" % (result_summary.expected, result_summary.unexpected, result_summary.remaining)) | percent_complete = 100 * (result_summary.expected + result_summary.unexpected) / result_summary.total self._meter.update("Testing (%d%%): %d ran as expected, %d didn't, %d left" % (percent_complete, result_summary.expected, result_summary.unexpected, result_summary.remaining)) | def _display_one_line_progress(self, result_summary): """Displays the progress through the test run.""" self._meter.update("Testing: %d ran as expected, %d didn't, %d left" % (result_summary.expected, result_summary.unexpected, result_summary.remaining)) |
meter.update("Clobbering old results in %s" % options.results_directory) layout_tests_dir = path_utils.layout_tests_dir() possible_dirs = os.listdir(layout_tests_dir) for dirname in possible_dirs: if os.path.isdir(os.path.join(layout_tests_dir, dirname)): shutil.rmtree(os.path.join(options.results_directory, dirname), ... | path = os.path.join(options.results_directory, 'LayoutTests') if os.path.exists(path): shutil.rmtree(path) | def main(options, args): """Run the tests. Will call sys.exit when complete. Args: options: a dictionary of command line options args: a list of sub directories or files to test """ if options.sources: options.verbose = True # Set up our logging format. meter = metered_stream.MeteredStream(options.verbose, sys.stde... |
url = self.GetFileURLForPath(os.path.join(self.DataDir(), 'title2.html')) | url = self.GetFileURLForDataPath('title2.html') | def testHistoryResult(self): """Verify that omnibox can fetch items from history.""" url = self.GetFileURLForPath(os.path.join(self.DataDir(), 'title2.html')) title = 'Title Of Awesomeness' self.AppendTab(pyauto.GURL(url)) def _VerifyHistoryResult(query_list, description, windex=0): """Verify result matching given desc... |
url1 = self.GetFileURLForPath(os.path.join(self.DataDir(), 'title2.html')) url2 = self.GetFileURLForPath(os.path.join(self.DataDir(), 'title1.html')) | url1 = self.GetFileURLForDataPath('title2.html') url2 = self.GetFileURLForDataPath('title1.html') | def testSelect(self): """Verify omnibox popup selection.""" url1 = self.GetFileURLForPath(os.path.join(self.DataDir(), 'title2.html')) url2 = self.GetFileURLForPath(os.path.join(self.DataDir(), 'title1.html')) title1 = 'Title Of Awesomeness' self.NavigateToURL(url1) self.NavigateToURL(url2) matches = self._GetOmniboxMa... |
matches = self._GetOmniboxMatchesFor('google') | matches = self._GetOmniboxMatchesFor(search_string) | def testDifferentTypesOfResults(self): """Verify different types of results from omnibox. |
search_string = 'apple' | def testSuggestPref(self): """Verify omnibox suggest-service enable/disable pref.""" self.assertTrue(self.GetPrefsInfo().Prefs(pyauto.kSearchSuggestEnabled)) matches = self._GetOmniboxMatchesFor('apple') self.assertTrue(matches) self.assertTrue([x for x in matches if x['type'] == 'search-suggest']) # Disable suggest-se... | |
matches = self._GetOmniboxMatchesFor('apple') | matches = self._GetOmniboxMatchesFor(search_string) | def testSuggestPref(self): """Verify omnibox suggest-service enable/disable pref.""" self.assertTrue(self.GetPrefsInfo().Prefs(pyauto.kSearchSuggestEnabled)) matches = self._GetOmniboxMatchesFor('apple') self.assertTrue(matches) self.assertTrue([x for x in matches if x['type'] == 'search-suggest']) # Disable suggest-se... |
"Cond", "Free", "Leak", "Overlap", "Param", | "Cond", "Free", "Jump", "Leak", "Overlap", "Param", | def ReadSuppressions(lines, supp_descriptor): """Given a list of lines, returns a list of suppressions. Args: lines: a list of lines containing suppressions. supp_descriptor: should typically be a filename. Used only when parsing errors happen. """ result = [] cur_descr = '' cur_type = '' cur_stack = [] in_suppression... |
os.path.splitext(path)[1].lower() in PE_FILE_EXTENSIONS) | os.path.splitext(path)[1].lower() in PE_FILE_EXTENSIONS and os.path.basename(path) not in EXCLUDED_FILES) | def IsPEFile(path): return (os.path.isfile(path) and os.path.splitext(path)[1].lower() in PE_FILE_EXTENSIONS) |
sys.exit(0) | sys.exit(1) | def main(options, args): directory = args[0] pe_total = 0 pe_passed = 0 for file in os.listdir(directory): path = os.path.abspath(os.path.join(directory, file)) if not IsPEFile(path): continue pe = pefile.PE(path, fast_load=True) pe_total = pe_total + 1 success = True # Check for /DYNAMICBASE. if pe.OPTIONAL_HEADER.D... |
func.AddCmdArg(Argument('data_size', 'uint32')) | func.AddCmdArg(DataSizeArgument('data_size')) | def InitFunction(self, func): """Add or adjust anything type specific for this function.""" if func.GetInfo('needs_size'): func.AddCmdArg(Argument('data_size', 'uint32')) |
EXPECT_EQ(0, result->size);%(gl_error_test)s | EXPECT_EQ(0u, result->size);%(gl_error_test)s | typedef %(name)s::Result Result; |
class GLcharHandler(TypeHandler): | class GLcharHandler(CustomHandler): | def WriteImmediateFormatTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) file.Write(" const int kSomeBaseValueToTestWith = 51;\n") file.Write(" static %s data[] = {\n" % func.info.data_type) for v in range(0, func.info.count * 2): file.Write(" stati... |
TypeHandler.__init__(self) def InitFunction(self, func): """Overrriden from TypeHandler.""" func.AddCmdArg(Argument('data_size', 'uint32')) def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("// TODO(gman): %s\n\n" % func.name) def WriteImmediateServiceUnitTest(self, func, file... | CustomHandler.__init__(self) | def __init__(self): TypeHandler.__init__(self) |
class GetGLcharHandler(GLcharHandler): """Handler for glGetAttibLoc, glGetUniformLoc.""" def __init__(self): GLcharHandler.__init__(self) def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("// TODO(gman): %s\n\n" % func.name) def WriteImmediateServiceUnitTest(self, func, file):... | def WriteImmediateFormatTest(self, func, file): """Overrriden from TypeHandler.""" init_code = [] check_code = [] all_but_last_arg = func.GetCmdArgs()[:-1] value = 11 for arg in all_but_last_arg: init_code.append(" static_cast<%s>(%d)," % (arg.type, value)) value += 1 value = 11 for arg in all_but_last_arg: check_... | |
self.type_handler.InitFunction(self) | def __init__(self, original_name, name, info, return_type, original_args, args_for_cmds, cmd_args, init_args, num_pointer_args): self.name = name self.original_name = original_name self.info = info self.type_handler = info.type_handler self.return_type = return_type self.original_args = original_args self.num_pointer_a... | |
'GetGLchar': GetGLcharHandler(), | def __init__(self, verbose): self.original_functions = [] self.functions = [] self.verbose = verbose self.errors = 0 self._function_info = {} self._empty_type_handler = TypeHandler() self._empty_function_info = FunctionInfo({}, self._empty_type_handler) | |
("OP(%s)" % func.name, _CMD_ID_TABLE[func.name])) | ("OP(%s)" % by_id[id].name, id)) | def WriteCommandIds(self, filename): """Writes the command buffer format""" file = CHeaderWriter(filename) file.Write("#define GLES2_COMMAND_LIST(OP) \\\n") for func in self.functions: if not func.name in _CMD_ID_TABLE: self.Error("Command %s not in _CMD_ID_TABLE" % func.name) file.Write(" %-60s /* %d */ \\\n" % ("OP(... |
pdf_files_path = os.path.join(self.DataDir(), 'plugin', 'pdf') | pdf_files_path = os.path.join(self.DataDir(), 'pyauto_private', 'pdf') | def testPDFRunner(self): """Navigate to pdf files and verify that browser doesn't crash""" # bail out if not a branded build properties = self.GetBrowserInfo()['properties'] if properties['branding'] != 'Google Chrome': return pdf_files_path = os.path.join(self.DataDir(), 'plugin', 'pdf') pdf_files = glob.glob(os.path.... |
O3D_PLUGIN_MIME_TYPE = FLAGS.set_mimetype | O3D_PLUGIN_NPAPI_FILENAME = FLAGS.set_npapi_filename O3D_PLUGIN_NPAPI_MIMETYPE = FLAGS.set_npapi_mimetype O3D_PLUGIN_ACTIVEX_HOSTCONTROL_CLSID = FLAGS.set_activex_hostcontrol_clsid O3D_PLUGIN_ACTIVEX_TYPELIB_CLSID = FLAGS.set_activex_typelib_clsid O3D_PLUGIN_ACTIVEX_HOSTCONTROL_NAME = FLAGS.set_activex_hostcontrol_name... | def main(argv): try: files = FLAGS(argv) # Parse flags except gflags.FlagsError, e: print '%s.\nUsage: %s [<options>] [<input_file> <output_file>]\n%s' % \ (e, sys.argv[0], FLAGS) sys.exit(1) # Strip off argv[0] files = files[1:] # Get version string from o3d_version.py o3d_version_vars = {} if FLAGS.kill_switch: ex... |
('@@@PluginMimeType@@@', O3D_PLUGIN_MIME_TYPE), | ('@@@PluginNpapiFilename@@@', O3D_PLUGIN_NPAPI_FILENAME), ('@@@PluginNpapiMimeType@@@', O3D_PLUGIN_NPAPI_MIMETYPE), ('@@@PluginActiveXHostControlClsid@@@', O3D_PLUGIN_ACTIVEX_HOSTCONTROL_CLSID), ('@@@PluginActiveXTypeLibClsid@@@', O3D_PLUGIN_ACTIVEX_TYPELIB_CLSID), ('@@@PluginActiveXHostControlName@@@', O3D_PLUGIN_ACTI... | def main(argv): try: files = FLAGS(argv) # Parse flags except gflags.FlagsError, e: print '%s.\nUsage: %s [<options>] [<input_file> <output_file>]\n%s' % \ (e, sys.argv[0], FLAGS) sys.exit(1) # Strip off argv[0] files = files[1:] # Get version string from o3d_version.py o3d_version_vars = {} if FLAGS.kill_switch: ex... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.