Ramp 有点意思的题目

粗一看都不知道这个要干什么,这 B 装得不错。

Ramp 有点意思的题目_第1张图片

IyEvdXNyL2Jpbi9lbnYgcHl0aG9uMwoKJycnCktlZXAgdXMgb3V0IG9mIGdvb2dsZSBzZWFyY2ggcmVzdWx0cy4uCgokIG9kIC1kIC9kZXYvdXJhbmRvbSB8IGhlYWQKMDAwMDAwMCAgICAgNjAyMTUgICAyODc3OCAgIDI5MjI3ICAgMjg1NDggICA2MjY4NiAgIDQ1MTcxICAgIDc4MjYgICA0ODc2NgowMDAwMDIwICAgICAxNzExOCAgIDE1MjI1ICAgMTI4NTIgICAzNDc4MSAgIDMxOTU1ICAgMTkwODcgICAzOTU2MyAgIDQzNjE0CjAwMDAwNDAgICAgICA2NzEwICAgMzg1MTUgICAxNDU3MyAgIDY0MDg3ICAgMTcwMjYgICAyNTU5OCAgIDQyOTEzICAgMTQyMDkKMDAwMDA2MCAgICAgMTA3MjMgICAzMTMwNyAgIDE5MDcxICAgMTQ3OTggICAgMjQ2MiAgIDQ2MjUzICAgMzU2MjYgICAzMjQzNgowMDAwMTAwICAgICAgMTczOSAgIDI3NzEyICAgIDU2NjcgICAxMjIxMiAgIDQ3MDc3ICAgNDE3MjIgICA1NDQ1MiAgIDM4NDYxCjAwMDAxMjAgICAgICA0ODE2ICAgMTUwMTQgICAyODYyMyAgIDEwOTI4ICAgNTQwMjggICA2NDUyMyAgIDU0NjMyICAgNTQxODcKMDAwMDE0MCAgICAgNjE2MzEgICA1NDQ5OSAgIDE4MzA3ICAgIDU1MTQgICA1MDc0MyAgIDUwNTkxICAgMjUxNzIgICA1NDAxOAowMDAwMTYwICAgICAzMTk5MCAgIDI2MjQ4ICAgIDQzODMgICA0NjQ1MiAgIDQyMTU2ICAgNjIzMjAgICA1MTA1MiAgIDI4NjIxCjAwMDAyMDAgICAgIDI3MjI2ICAgNjUyOTYgICA1NjMwNSAgIDMzMzc1ICAgIDQ4MTMgICA0MjI4MyAgIDE5OTgwICAgIDE5MjIK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HNlZWQpLCBlbmNvZGluZz0idXRmLTgiKQogICAgcmV0dXJuIGYie3Rva2VufS17c2VlZH0iCgoKaWYgX19uYW1lX18gPT0gIl9fbWFpbl9fIjoKICAgIHN5cy5zdGRvdXQud3JpdGUoCiAgICAgICAgZiJQbGVhc2UgaGVhZCB0byBodHRwczovL3JhbXAuY29tL2NhcmVlcnMgYW5kIHVzZSB0aGlzIHNlY3JldCB3aGVuICIKICAgICAgICBmInlvdSBhcHBseToge2dlbmVyYXRlX3NlY3JldCgpfVxuIgogICAgKQoKCg==

其实看一下就知道这个应该是 Base 64 加密的,随便拉个工具用 Base64 解密下的结果是:

#!/usr/bin/env python3

'''
Keep us out of google search results..

$ od -d /dev/urandom | head
0000000     60215   28778   29227   28548   62686   45171    7826   48766
0000020     17118   15225   12852   34781   31955   19087   39563   43614
0000040      6710   38515   14573   64087   17026   25598   42913   14209
0000060     10723   31307   19071   14798    2462   46253   35626   32436
0000100      1739   27712    5667   12212   47077   41722   54452   38461
0000120      4816   15014   28623   10928   54028   64523   54632   54187
0000140     61631   54499   18307    5514   50743   50591   25172   54018
0000160     31990   26248    4383   46452   42156   62320   51052   28621
0000200     27226   65296   56305   33375    4813   42283   19980    1922
0000220     57061   29322   27073   64986   15219   26234   24100   21204
'''

'''
Copy this file and run `pbpaste | base64` to generate challenge text. Copious
white space is at the bottom of the file to ensure trailing `==` and hint at
base64.
'''

import codecs
import string
import sys
import time

from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.hashes import SHA1
from cryptography.hazmat.primitives.twofactor.totp import TOTP


ONE_WEEK_IN_SECONDS = 604_800


def generate_secret():
    totp = TOTP(
        key=codecs.encode(string.ascii_letters, encoding="utf-8"),
        length=8,
        algorithm=SHA1(),
        time_step=ONE_WEEK_IN_SECONDS,
        backend=default_backend(),
    )
    seed = int(time.time())
    token = codecs.decode(totp.generate(seed), encoding="utf-8")
    return f"{token}-{seed}"


if __name__ == "__main__":
    sys.stdout.write(
        f"Please head to https://ramp.com/careers and use this secret when "
        f"you apply: {generate_secret()}\n"
    )

上面的代码是 Python 的,然后你把上面的代码拷贝到你的计算机跑一下,应该可以看到下面的结果:

Ramp 有点意思的题目_第2张图片

下面的字符串就是你在申请的时候需要填入的字符串了。

另外,你需要在你的 python 环境中安装 pip install cryptography 。

Ramp 有点意思的题目_第3张图片

简单来说,就是上面的代码需要访问服务器,生成一个字符串,类似数据校验的意思。

这个还是在申请的时候第一次遇到,有点意思。

Ramp 有点意思的题目 - 求职路上 - OSSEZ

你可能感兴趣的:(python,开发语言)