hackthebox邀请码

不打算好好玩的麻烦不要瞎注册,大量的垃圾账号只会污染整个生态环境。

进入注册页面,观察页面js文件会找到以下内容:

eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('1 i(4){h 8={"4":4};$.9({a:"7",5:"6",g:8,b:\'/d/e/n\',c:1(0){3.2(0)},f:1(0){3.2(0)}})}1 j(){$.9({a:"7",5:"6",b:\'/d/e/k/l/m\',c:1(0){3.2(0)},f:1(0){3.2(0)}})}',24,24,'response|function|log|console|code|dataType|json|POST|formData|ajax|type|url|success|api|invite|error|data|var|verifyInviteCode|makeInviteCode|how|to|generate|verify'.split('|'),0,{}))

1、然后把这段代码放到 http://jsbeautifier.org/ 进行美化,得出:
2、

function verifyInviteCode(code) {
    var formData = {
        "code": code
    };
    $.ajax({
        type: "POST",
        dataType: "json",
        data: formData,
        url: '/api/invite/verify',
        success: function(response) {
            console.log(response)
        },
        error: function(response) {
            console.log(response)
        }
    })
}

function makeInviteCode() {
    $.ajax({
        type: "POST",
        dataType: "json",
        url: '/api/invite/how/to/generate',
        success: function(response) {
            console.log(response)
        },
        error: function(response) {
            console.log(response)
        }
    })
}

可以看出上述代码是让我们访问:https://www.hackthebox.eu/api/invite/generate
然后修改请求方式为post
于是就得到了:

{"success":1,"data":{"code":"VlJQS1QtQUNXRUstT0tYREwtQ0lZQVUtS0NZSlU=","format":"encoded"},"0":200}

将code进行base64解码,就得到了邀请码。

2018/12/13 15:28 下午 posted in  CTF