How to use decode_id method in devtools-proxy

Best Python code snippet using devtools-proxy_python

audio.py

Source:audio.py Github

copy

Full Screen

...21from .base import Field, StringField, IntField, BaseObject22from .date import DeltaField23from .file import CapFile, BaseFile24__all__ = ['BaseAudio', 'CapAudio']25def decode_id(decode_id):26 def wrapper(func):27 def inner(self, *args, **kwargs):28 arg = unicode(args[0])29 _id = decode_id(arg)30 if _id is None:31 return None32 new_args = [_id]33 new_args.extend(args[1:])34 return func(self, *new_args, **kwargs)35 return inner36 return wrapper37class Album(BaseObject):38 """39 Represent an album40 """41 title = StringField('album name')42 author = StringField('artist name')43 year = IntField('release year')44 thumbnail = Field('Image associated to the album', Thumbnail)45 tracks_list = Field('list of tracks', list)46 @classmethod47 def decode_id(cls, _id):48 if _id:49 m = re.match('^(album)\.(.*)', _id)50 if m:51 return m.group(2)52 return _id53class Playlist(BaseObject):54 """55 Represent a playlist56 """57 title = StringField('playlist name')58 tracks_list = Field('list of tracks', list)59 @classmethod60 def decode_id(cls, _id):61 if _id:62 m = re.match('^(playlist)\.(.*)', _id)63 if m:64 return m.group(2)65 return _id66class BaseAudio(BaseFile):67 """68 Represent an audio file69 """70 duration = DeltaField('file duration')71 bitrate = IntField('file bit rate in Kbps')72 format = StringField('file format')73 thumbnail = Field('Image associated to the file', Thumbnail)74 @classmethod75 def decode_id(cls, _id):76 if _id:77 m = re.match('^(audio)\.(.*)', _id)78 if m:79 return m.group(2)80 return _id81class CapAudio(CapFile):82 """83 Audio file provider84 """85 @classmethod86 def get_object_method(cls, _id):87 m = re.match('^(\w+)\.(.*)', _id)88 if m:89 if m.group(1) == 'album':90 return 'get_album'91 elif m.group(1) == 'playlist':92 return 'get_playlist'93 else:94 return 'get_audio'95 def search_audio(self, pattern, sortby=CapFile.SEARCH_RELEVANCE):96 """97 search for a audio file98 :param pattern: pattern to search on99 :type pattern: str100 :param sortby: sort by ...(use SEARCH_* constants)101 :rtype: iter[:class:`BaseAudio`]102 """103 return self.search_file(pattern, sortby)104 def search_album(self, pattern, sortby=CapFile.SEARCH_RELEVANCE):105 """106 search for an album107 :param pattern: pattern to search on108 :type pattern: str109 :rtype: iter[:class:`Album`]110 """111 raise NotImplementedError()112 def search_playlist(self, pattern, sortby=CapFile.SEARCH_RELEVANCE):113 """114 search for an album115 :param pattern: pattern to search on116 :type pattern: str117 :rtype: iter[:class:`Playlist`]118 """119 raise NotImplementedError()120 @decode_id(BaseAudio.decode_id)121 def get_audio(self, _id):122 """123 Get an audio file from an ID.124 :param id: audio file ID125 :type id: str126 :rtype: :class:`BaseAudio`]127 """128 return self.get_file(_id)129 @decode_id(Playlist.decode_id)130 def get_playlist(self, _id):131 """132 Get a playlist from an ID.133 :param id: playlist ID134 :type id: str135 :rtype: :class:`Playlist`]136 """137 raise NotImplementedError()138 @decode_id(Album.decode_id)139 def get_album(self, _id):140 """141 Get an album from an ID.142 :param id: album ID143 :type id: str144 :rtype: :class:`Album`]145 """...

Full Screen

Full Screen

6.py

Source:6.py Github

copy

Full Screen

1# 문제2# <?php3# include "../../config.php";4# if($_GET['view_source']) view_source();5# if(!$_COOKIE['user']){6# $val_id="guest";7# $val_pw="123qwe";8# for($i=0;$i<20;$i++){9# $val_id=base64_encode($val_id);10# $val_pw=base64_encode($val_pw);11# }12# $val_id=str_replace("1","!",$val_id);13# $val_id=str_replace("2","@",$val_id);14# $val_id=str_replace("3","$",$val_id);15# $val_id=str_replace("4","^",$val_id);16# $val_id=str_replace("5","&",$val_id);17# $val_id=str_replace("6","*",$val_id);18# $val_id=str_replace("7","(",$val_id);19# $val_id=str_replace("8",")",$val_id);20# $val_pw=str_replace("1","!",$val_pw);21# $val_pw=str_replace("2","@",$val_pw);22# $val_pw=str_replace("3","$",$val_pw);23# $val_pw=str_replace("4","^",$val_pw);24# $val_pw=str_replace("5","&",$val_pw);25# $val_pw=str_replace("6","*",$val_pw);26# $val_pw=str_replace("7","(",$val_pw);27# $val_pw=str_replace("8",")",$val_pw);28# Setcookie("user",$val_id,time()+86400,"/challenge/web-06/");29# Setcookie("password",$val_pw,time()+86400,"/challenge/web-06/");30# echo("<meta http-equiv=refresh content=0>");31# exit;32# }33# ?>34# <html>35# <head>36# <title>Challenge 6</title>37# <style type="text/css">38# body { background:black; color:white; font-size:10pt; }39# </style>40# </head>41# <body>42# <?php43# $decode_id=$_COOKIE['user'];44# $decode_pw=$_COOKIE['password'];45# $decode_id=str_replace("!","1",$decode_id);46# $decode_id=str_replace("@","2",$decode_id);47# $decode_id=str_replace("$","3",$decode_id);48# $decode_id=str_replace("^","4",$decode_id);49# $decode_id=str_replace("&","5",$decode_id);50# $decode_id=str_replace("*","6",$decode_id);51# $decode_id=str_replace("(","7",$decode_id);52# $decode_id=str_replace(")","8",$decode_id);53# $decode_pw=str_replace("!","1",$decode_pw);54# $decode_pw=str_replace("@","2",$decode_pw);55# $decode_pw=str_replace("$","3",$decode_pw);56# $decode_pw=str_replace("^","4",$decode_pw);57# $decode_pw=str_replace("&","5",$decode_pw);58# $decode_pw=str_replace("*","6",$decode_pw);59# $decode_pw=str_replace("(","7",$decode_pw);60# $decode_pw=str_replace(")","8",$decode_pw);61# for($i=0;$i<20;$i++){62# $decode_id=base64_decode($decode_id);63# $decode_pw=base64_decode($decode_pw);64# }65# echo("<hr><a href=./?view_source=1 style=color:yellow;>view-source</a><br><br>");66# echo("ID : $decode_id<br>PW : $decode_pw<hr>");67# if($decode_id=="admin" && $decode_pw=="nimda"){68# solve(6);69# }70# ?>71# </body>72# </html>73# 해설74# 14 ~ 30 번 줄과 68 ~ 77 번 줄을보면75# admin을 20번 인코딩, 디코딩 한 후76# user 쿠키 값으로 설정한 후77# nimda를 20번 인코딩, 디코딩 한 후78# password 쿠키 값으로 설정한 후 새로고침 하면 79# 문제가 풀린다80# 풀이81import base6482str1 = 'admin' # nimda 로 변경후 한번 더 실행83i = 084while i < 20:85 i+=186 str1 = str1.encode('utf-8')87 str1 = base64.b64encode(str1)88 str1 = str1.decode('utf-8')89str1 = str1.replace("1","!")90str1 = str1.replace("2","@")91str1 = str1.replace("3","$")92str1 = str1.replace("4","^")93str1 = str1.replace("5","&")94str1 = str1.replace("6","*")95str1 = str1.replace("7","(")96str1 = str1.replace("8",")")...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run devtools-proxy automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful