Skip to content

Instantly share code, notes, and snippets.

@cnDelbert
Last active March 3, 2016 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cnDelbert/b4e920e1708816c7b1ef to your computer and use it in GitHub Desktop.
Save cnDelbert/b4e920e1708816c7b1ef to your computer and use it in GitHub Desktop.
WeChall_Python
# coding: utf-8
__author__ = 'Delbert'
# 20160303
# Original: https://www.wechall.net/challenge/training/encodings/ascii/
# Output: The solution is: dilsmeboeili
def main():
ascii_list = [84, 104, 101, 32, 115, 111, 108, 117, 116, 105, 111, 110, 32, 105, 115, 58, 32, 115, 105, 114, 101, 105, 98, 97, 101, 104, 101, 110, 97]
result = ascii_to_char(ascii_list)
print(result)
def ascii_to_char(ascii_list):
result_list = []
for c in ascii_list:
result_list.append(chr(int(c)))
return ''.join(result_list)
if __name__ == '__main__':
main()
# coding: utf-8
import urllib.parse as up
__author__ = 'Delbert'
# 20160303
# Original: https://www.wechall.net/challenge/training/encodings/ascii/
# Output: Yippeh! Your URL is challenge/training/encodings/url/saw_lotion.php?p=sgfalenrhbsi&cid=52#password=fibre_optics Very well done!
# Tips: `import urllib` is rather senseless in Python 3.x, since all the functionality is in the submodules and these are not imported by the toplevel module.
def main():
original_url = '%59%69%70%70%65%68%21%20%59%6F%75%72%20%55%52%4C%20%69%73%20%63%68%61%6C%6C%65%6E%67%65%2F%74%72%61%69%6E%69%6E%67%2F%65%6E%63%6F%64%69%6E%67%73%2F%75%72%6C%2F%73%61%77%5F%6C%6F%74%69%6F%6E%2E%70%68%70%3F%70%3D%73%67%66%61%6C%65%6E%72%68%62%73%69%26%63%69%64%3D%35%32%23%70%61%73%73%77%6F%72%64%3D%66%69%62%72%65%5F%6F%70%74%69%63%73%20%56%65%72%79%20%77%65%6C%6C%20%64%6F%6E%65%21'
print(up.unquote(original_url))
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment