zoukankan      html  css  js  c++  java
  • simple js

    simple js

    题目描述:小宁发现了一个网页,但却一直输不对密码。(Flag格式为 Cyberpeace{xxxxxxxxx} )
    在这里插入图片描述
    打开题目后,有一个Enter password框,要求输入密码,随便输入“123”
    在这里插入图片描述
    输入“123”结果为
    在这里插入图片描述
    开发者工具F12查看页面源代码
    在这里插入图片描述
    将JS代码复制出来进行分析

       function dechiffre(pass_enc){
            var pass = "70,65,85,88,32,80,65,83,83,87,79,82,68,32,72,65,72,65"; 
            var tab  = pass_enc.split(',');
                    var tab2 = pass.split(',');var i,j,k,l=0,m,n,o,p = "";i = 0;j = tab.length;
                            k = j + (l) + (n=0);
                            n = tab2.length;
                            for(i = (o=0); i < (k = j = n); i++ ){o = tab[i-l];p += String.fromCharCode((o = tab2[i]));
                                    if(i == 5)break;}
                            for(i = (o=0); i < (k = j = n); i++ ){
                            o = tab[i-l];
                                    if(i > 5 && i < k-1)
                                            p += String.fromCharCode((o = tab2[i]));
                            }
            p += String.fromCharCode(tab2[17]);
            pass = p;return pass;
        }
        String["fromCharCode"](dechiffre("x35x35x2cx35x36x2cx35x34x2cx37x39x2cx31x31x35x2cx36x39x2cx31x31x34x2cx31x31x36x2cx31x30x37x2cx34x39x2cx35x30"));
    
        h = window.prompt('Enter password');
        alert( dechiffre(h) );
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20

    看到x35x35x2cx35x36x2cx35x34x2cx37x39x2cx31x31x35x2cx36x39x2cx31x31x34x2cx31x31x36x2cx31x30x37x2cx34x39x2cx35x30"想到把x转换为%,将字符串转换为URL编码,%35%35%2c%35%36%2c%35%34%2c%37%39%2c%31%31%35%2c%36%39%2c%31%31%34%2c%31%31%36%2c%31%30%37%2c%34%39%2c%35%30
    解码得:55,56,54,79,115,69,114,116,107,49,50
    在这里插入图片描述
    将这串数字进行ASCII码转换得:786OsErtk12
    根据提示flag格式为Cyberpeace{xxxxxxxxx} ,提交Cyberpeace{786OsErtk12}得到正确答案。

  • 相关阅读:
    [windows]清除访问共享的用户和密码信息
    Java架构搜集
    jsp、freemarker、velocity对比
    Spring MVC 了解WebApplicationContext中特殊的bean类型
    Web.xml配置详解之context-param
    <context:annotation-config/> 的理解
    使用@Controller注解为什么要配置<mvc:annotation-driven />
    web.xml配置之<context-param>详解
    @WebServlet
    正向代理与反向代理
  • 原文地址:https://www.cnblogs.com/lzkalislw/p/14049985.html
Copyright © 2011-2022 走看看