当前位置:网站首页>uploads-labs靶场(附源码分析)(更新中)
uploads-labs靶场(附源码分析)(更新中)
2022-07-03 15:53:00 【MUNG东隅】
pass-01
存在前端验证

onsubmit:当提交表单时执行一段 JavaScript。它只认true或者false.如果不返回值,则默认为true

写一个图片马,后缀是图片后缀,然后bp抓包改就行了

蚁剑连接

源码分析
前端:

checkile()函数
function checkFile() {
var file = document.getElementsByName('upload_file')[0].value;
if (file == null || file == "") {
alert("请选择要上传的文件!");
return false;
}
//定义允许上传的文件类型
var allow_ext = ".jpg|.png|.gif";
//提取上传文件的类型
var ext_name = file.substring(file.lastIndexOf("."));
//判断上传文件类型是否允许上传
if (allow_ext.indexOf(ext_name + "|") == -1) {
var errMsg = "该文件不允许上传,请上传" + allow_ext + "类型的文件,当前文件类型为:" + ext_name;
alert(errMsg);
return false;
}
}首先通过getElementsByName获得表单元素,它获得的也是类数组,如果想准确得到某一个元素,可以使用数组下标的方式获取,那么这里document.getElementsByName('upload_file')[0].value;就获得了文件名。
后面if语句判断上传文件是否为空
substring() 方法用于提取字符串中介于两个指定下标之间的字符。
实例:
var str="Hello world!";
document.write(str.substring(3)+"<br>");
document.write(str.substring(3,7));
---------------------------------------------------------------------
lo world!
lo w indexOf() 方法可返回某个指定的字符串值在字符串中首次出现的位置。 lastIndexOf() 方法获取后缀名 返回指定值在调用该方法的字符串中最后出现的位置,如果没找到则返回 -1。从该字符串的后面向前查找,从 fromIndex 处开始。 字符串中的字符被从左向右索引。首字符的索引(index)是 0,最后一个字符的索引是 stringName.length - 1。 例子:
String name = "upload.doc";
// 获取后缀名
String sname = name.substring(name.lastIndexOf("."));
//获得upload部分
String fileName=name.substring(0,name.lastIndexOf("."));if (allow_ext.indexOf(ext_name + "|") == -1) ,在允许上传的后缀名里查找刚刚提取出的后缀名,如果找不到indexOf()函数会返回-1,这样就判断出了
边栏推荐
- Tensorflow realizes verification code recognition (II)
- [combinatorial mathematics] binomial theorem and combinatorial identity (binomial theorem | three combinatorial identities | recursive formula 1 | recursive formula 2 | recursive formula 3 Pascal / Ya
- 关于网页中的文本选择以及统计选中文本长度
- Three dimensional reconstruction of deep learning
- 函数栈帧的创建和销毁
- Popular understanding of linear regression (II)
- Win10 enterprise 2016 long term service activation tutorial
- Brush questions -- sword finger offer
- Go语言自学系列 | golang中的if else if语句
- 半监督学习
猜你喜欢
![[系统安全] 四十三.Powershell恶意代码检测系列 (5)抽象语法树自动提取万字详解](/img/cd/00954b9c592c253d42e6a3b8298999.jpg)
[系统安全] 四十三.Powershell恶意代码检测系列 (5)抽象语法树自动提取万字详解

Download and install common programs using AUR

Digital image processing -- popular understanding of corrosion and expansion

VS2017通过IP调试驱动(双机调试)

找映射关系
![[system safety] 43 PowerShell malicious code detection series (5) automatic extraction of ten thousand words from abstract syntax tree](/img/cd/00954b9c592c253d42e6a3b8298999.jpg)
[system safety] 43 PowerShell malicious code detection series (5) automatic extraction of ten thousand words from abstract syntax tree

MongoDB 的安装和基本操作

App移动端测试【3】ADB命令

《微服务设计》读书笔记(下)

Automatic generation of client code from flask server code -- Introduction to flask native stubs Library
随机推荐
Break through 1million, sword finger 2million!
Popular understanding of gradient descent
Unity功能——Unity离线文档下载及使用
Detailed explanation of string function and string function with unlimited length
CString getbuffer and releasebuffer instructions
Large CSV split and merge
Salary 3000, monthly income 40000 by "video editing": people who can make money never rely on hard work!
Halcon and WinForm study section 1
About text selection in web pages and counting the length of selected text
[combinatorial mathematics] binomial theorem and combinatorial identity (binomial theorem | three combinatorial identities | recursive formula 1 | recursive formula 2 | recursive formula 3 Pascal / Ya
Unity function - unity offline document download and use
Summary of JVM knowledge points
do{}while()的妙用
Location of software installation information and system services in the registry
Microservice API gateway
The wonderful use of do{}while()
Jvm-03-runtime data area PC, stack, local method stack
软件安装信息、系统服务在注册表中的位置
关于网页中的文本选择以及统计选中文本长度
Wechat payment -jsapi: code implementation (payment asynchronous callback, Chinese parameter solution)