def Resolve(vid): headers = { 'User-Agent': 'Mozilla/5.0 (Linux; Android 7.1.1; Pixel Build/NMF26O) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.91 Mobile Safari/537.36', 'Origin': 'https://www.dailymotion.com', 'Referer': 'https://www.dailymotion.com/' } cookie = {'lang': 'en_US', 'ff': 'off'} session = common.GetSession() content = common.OpenURL( "https://www.dailymotion.com/player/metadata/video/{0}".format(vid), session=session, headers=headers, cookies=cookie, responseMethod='json') if content.get('error') is not None: return '' else: cc = content['qualities'] cc = list(cc.items()) cc = sorted(cc, key=s, reverse=True) for source, json_source in cc: for item in json_source: m_url = item.get('url', None) if m_url: m_url = m_url.replace('dvr=true&', '') if '.m3u8?sec' in m_url: text = common.OpenURL( m_url, headers=headers, cookies=session.cookies.get_dict()) mb = re.findall('NAME="([^"]+)"\n(.+)', text) mb = sorted(mb, key=s, reverse=True) for quality, strurl in mb: quality = quality.split("@")[0] if not strurl.startswith('http'): strurl1 = re.findall('(.+/)', m_url)[0] strurl = strurl1 + strurl strurl = '{0}|{1}'.format( strurl.split('#cell')[0], common.urlencode(headers)) return strurl
def payload(self, place=None, parameter=None, value=None, newValue=None, where=None, addValue=None): """ This method replaces the affected parameter with the SQL injection statement to request """ retVal = "" paramString = place['paramstring'] paramDict = place['paramdict'] origValue = paramDict[parameter]#getUnicode(paramDict[parameter]) randstr = "" if addValue is not None: value = origValue newValue = "%s%s" % (value, addValue) newValue = urlencode(newValue, '%', False, 'GET' != 'URI') else: if value is None: if all(c in "0123456789.+-" for c in parameter): randstr = str(randomInt()) else: randstr = randomStr() return randstr # """ # if where == PAYLOAD.WHERE.ORIGINAL: # value = origValue # elif where == PAYLOAD.WHERE.NEGATIVE: # if conf.invalidLogical: # match = re.search(r'\A[^ ]+', newValue) # newValue = newValue[len(match.group() if match else ""):] # _ = randomInt(2) # value = "%s%s AND %s=%s" % (origValue, match.group() if # match else "", _, _ + 1) # elif conf.invalidBignum: # value = randomInt(6) # elif conf.invalidString: # value = randomStr(6) # else: # if newValue.startswith("-"): # value = "" # else: # value = "-%s" % randomInt() # """ if False: pass else: def _(pattern, repl, string): retVal = string match = None for match in re.finditer(pattern, string): pass if match: while True: _ = re.search(r"\\g<([^>]+)>", repl) if _: try: repl = repl.replace(_.group(0), match.group(int(_.group(1)) if _.group(1).isdigit() else _.group(1))) except IndexError: break else: break retVal = string[:match.start()] + repl + string[match.end():] return retVal if origValue: regex = r"(\A|\b)%s=%s%s" % (re.escape(parameter), re.escape(origValue), r"(\Z|\b)" if origValue[-1].isalnum() else "") retVal = _(regex, "%s=%s" % (parameter, self.addPayloadDelimiters(newValue.replace("\\", "\\\\"))), paramString) """ else: retVal = _(r"(\A|\b)%s=%s(\Z|%s|%s|\s)" % (re.escape(parameter), re.escape(origValue), DEFAULT_GET_POST_DELIMITER, DEFAULT_COOKIE_DELIMITER), "%s=%s\g<2>" % (parameter, self.addPayloadDelimiters(newValue.replace("\\", "\\\\"))), paramString) if retVal == paramString and urlencode(parameter) != parameter: retVal = _(r"(\A|\b)%s=%s" % (re.escape(urlencode(parameter)), re.escape(origValue)), "%s=%s" % (urlencode(parameter), self.addPayloadDelimiters(newValue.replace("\\", "\\\\"))), paramString) """ if retVal: retVal = retVal.replace(BOUNDARY_BACKSLASH_MARKER, '\\') return retVal
def payload_t(self, paramDict, parameters=None, place=None, parameter=None, value=None, newValue=None, where=None): """ This method replaces the affected parameter with the SQL injection statement to request """ retVal = "" paramString = parameters[place] paramDict = paramDict[place] origValue = getUnicode(paramDict[parameter]) #如果参数值为空则生成个值 if value is None: if where == PAYLOAD.WHERE.ORIGINAL: value = origValue elif where == PAYLOAD.WHERE.NEGATIVE: # if conf.invalidLogical: # match = re.search(r'\A[^ ]+', newValue) # newValue = newValue[len(match.group() if match else ""):] # _ = randomInt(2) # value = "%s%s AND %s=%s" % (origValue, match.group() if match else "", _, _ + 1) # elif conf.invalidBignum: # value = randomInt(6) # elif conf.invalidString: # value = randomStr(6) # else: if newValue.startswith("-"): value = "" else: value = "-%s" % randomInt() elif where == PAYLOAD.WHERE.REPLACE: value = "" else: value = origValue newValue = "%s%s" % (value, newValue) newValue = self.cleanupPayload(newValue, origValue) #支持修改http中各种请求的参数 if place in (PLACE.URI, PLACE.CUSTOM_POST, PLACE.CUSTOM_HEADER): pass elif place in (PLACE.USER_AGENT, PLACE.REFERER, PLACE.HOST): pass else: def _(pattern, repl, string): retVal = string match = None for match in re.finditer(pattern, string): pass if match: while True: _ = re.search(r"\\g<([^>]+)>", repl) if _: try: repl = repl.replace(_.group(0), match.group(int(_.group(1)) if _.group(1).isdigit() else _.group(1))) except IndexError: break else: break retVal = string[:match.start()] + repl + string[match.end():] return retVal if origValue: regex = r"(\A|\b)%s=%s%s" % (re.escape(parameter), re.escape(origValue), r"(\Z|\b)" if origValue[-1].isalnum() else "") retVal = _(regex, "%s=%s" % (parameter, self.addPayloadDelimiters(newValue.replace("\\", "\\\\"))), paramString) else: retVal = _(r"(\A|\b)%s=%s(\Z|%s|%s|\s)" % (re.escape(parameter), re.escape(origValue), DEFAULT_GET_POST_DELIMITER, DEFAULT_COOKIE_DELIMITER), "%s=%s\g<2>" % (parameter, self.addPayloadDelimiters(newValue.replace("\\", "\\\\"))), paramString) if retVal == paramString and urlencode(parameter) != parameter: pass retVal = _(r"(\A|\b)%s=%s" % (re.escape(urlencode(parameter)), re.escape(origValue)), "%s=%s" % (urlencode(parameter), self.addPayloadDelimiters(newValue.replace("\\", "\\\\"))), paramString) if retVal: retVal = retVal.replace(BOUNDARY_BACKSLASH_MARKER, '\\') return retVal