Why not?

此题地址:https://ringzer0team.com/challenges/34

在第一次看到我想要蛮力登录页面,并尝试一些用户和密码,但它是不可以的。接着首先看到页面的源代码,可以使用Ctrl+ U或F12键查看网页源代码,访问源后,我们会寻找脚本标记并试图理解源代码:

if(u == "administrator") {
                    for(i = 0; i < u.length; i++) {
                        if((u.charCodeAt(i) + p.charCodeAt(i) + i * 10) != k[i]) {
                            $("#cresponse").html("<div class='alert alert-danger'>Wrong password sorry.</div>");
                            t = false;
                            break;

简单分析:1.u.charCodeAt(i) + p.charCodeAt(i) + i * 10) = k[i] => p.charCodeAt(i) = k[i] - i * 10 - u.charCodeAt(i)

             2.u是用户名p密码

             3.String.charCodeAt() 函数详解   

charCodeAt()函数返回一个整数,该整数表示string对象索引处的字符的Unicode编码

 如:var str = "CodePlayer";   document.writeln( str.charCodeAt( 0 ) ); // 67

             4.大体的意思就是:我们如何想方设法把p得到,因为我没有把全部源码放出来,想学习的可以,进链接

记性不好,我写这个随笔的主要目的就是把我最后求p的python放出来

补充:

>>> help(ord)
Help on built-in function ord in module builtins:

ord(c, /)
    Return the Unicode code point for a one-character string.  #参数是长度为1的字符,返回它对应的整数
>>> s = ord('a')
>>> s
97

 轻巧方便,强大的python

k = [176, 214, 205, 246, 264, 255, 227, 237, 242, 244, 265, 270, 283]
u = "administrator"
p = ""
for i in range(len(u)):
    p+=(chr(k[i]-i*10-ord(u[i])))     
    print(p)



O
Oh
OhL
OhLo
OhLor
OhLord
OhLord4
OhLord43
OhLord430
OhLord4309
OhLord43091
OhLord430911
OhLord4309111

 

原文地址:https://www.cnblogs.com/Jdrops/p/5365785.html