MoeCTFWP

由 ssnhy13 发布

MoeCTF

这个比赛是很早的了去年的了西电的比赛那天想到了就想着做一点,下周继续今天开始的有点晚了就做了一点点。

Web

http


打开以后题目是这个1是get传参2是post传参3直接将cookie的character改成admin
先修改的character
得到flag因为是本地所以没有设置flag直接设置的none
1./?UwU=u 2. Luv=u 3.character:admin 4.X-Forwarded-For: 127.0.0.1 5.user-agent :MoEbrowser

Cookie

打开以后是这个

题目给了附件内容如下

就是需要注册一个账号然后在用这个账号登陆获取flag
那就注册然后登陆

注册以后登陆然后看能不能拿到flag
可以登陆上

登陆成功以后右边有一个base64编码的解码以后如下
{"username": "xinyi", "password": "123456", "role": "user"}

需要把user改成admin才可以得到flag

cookie修改成这样可以得到flagCookie: character=admin;token=eyJ1c2VybmFtZSI6ICJ4aW55aSIsICJwYXNzd29yZCI6ICIxMjM0NTYiLCAicm9sZSI6ICJhZG1pbiJ9=

gasgasgas

这个题目直接用脚本解决

脚本如下

#include <string.h>
#include <curl/curl.h>

int main() {
    CURL *curl;
    CURLcode res;

    curl = curl_easy_init();
    if(curl) {
        char url[] = "http://127.0.0.1:80/";
        curl_easy_setopt(curl, CURLOPT_URL, url);

        for(int i=1; i<99; i++) {
            char math[100] = "";

            curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "driver=Leafzzz&steering_control=0&throttle=0");
            res = curl_easy_perform(curl);

            char resTest[1000];
            strcpy(resTest, curl_easy_getinfo(curl, CURLINFO_CONTENT));

            int ym, fx;

            if(strstr(resTest, "太大") != NULL) {
                ym = 2;
            } else if(strstr(resTest, "太小") != NULL) {
                ym = 0;
            } else {
                ym = 1;
            }

            if(strstr(resTest, "向左") != NULL) {
                fx = 1;
            } else if(strstr(resTest, "向右") != NULL) {
                fx = -1;
            } else {
                fx = 0;
            }

            char myData[100];
            sprintf(myData, "driver=Leafzzz&steering_control=%d&throttle=%d", fx, ym);

            curl_easy_setopt(curl, CURLOPT_POSTFIELDS, myData);
            res = curl_easy_perform(curl);

            printf("%s\n", curl_easy_getinfo(curl, CURLINFO_CONTENT));

            if(strstr(resTest, "moectf{") != NULL) {
                printf("Flaggggggggg!!!: %s\n", resTest);
                break;
            }
        }
        curl_easy_cleanup(curl);
    }
    return 0;
}

今天就先写到这里下周继续


0条评论

评论已关闭