Hacking & Security/Hacking

Web Application Security - xampp 실습

choideu 2022. 4. 22. 13:36
http://localhost/process_advertisement.php?username=choideu

1. xampp 설치

https://www.apachefriends.org/index.html

 

XAMPP Installers and Downloads for Apache Friends

What is XAMPP? XAMPP is the most popular PHP development environment XAMPP is a completely free, easy to install Apache distribution containing MariaDB, PHP, and Perl. The XAMPP open source package has been set up to be incredibly easy to install and to us

www.apachefriends.org

컴퓨터 운영체제 맞는 버전 클릭 후 설치 

 

2. xampp control panel

apache를 구동시킴

(XAMPP의 Apache 서버는 XAMPP가 설치되어 있는 폴더에서 'htdocs'폴더(설치 기본 경로 기준 C:\xampp\htdocs)를 기준으로 실행됨)  -> 웹페이지를 구성하는 html이나 php파일을 htdocs에 넣어주면 됨

 

*apache란?

https://m.blog.naver.com/sincc0715/221815775570

 

HTTP 아파치(Apache)란 무엇인가?

안녕하세요 즐코 시누 입니다. 오늘은 아파치의 대해서 알아보도록 하겠습니다. INSTA : 시작하면서 ...

blog.naver.com

 

 

3. URL에 localhost 입력

이런 창이 나오면 적상 작동

 

4. advertisement.php 창 실행

#!/usr/bin/php-cgi
<?php 

print "<form method=\"get\" action=\"process_advertisement.php\">";
print "<p>\n Please leave your uername for on-line store. </p>\n";
print "<p>\n We will select five users and give gift-cards to them. </p>\n";
print "<p>\n Thank you !!! </p>\n";
print "<p>Username:  <input type=\"text\" name=\"username\" /></p>\n";
print "<p><input type=\"submit\" value=\"Apply \" /></p>\n";
print "</form>";

?>

form의 method는 GET

action은 process_advertisement.php로 Apply를 누르면 text type의 username값이 넘어감

 

*process_adverisement.php 코드

#!/usr/bin/php-cgi
<?php

$username = $_GET['username'];
$comments = "Really Bad Site";

echo "Thank you. we have successfully received your username for on-line store.\n";
echo "We will contact you later.\n";
echo "Please click Exit button.\n";
echo $username; 
echo " 반갑습니다";

?>

 

결과창

GET 형식이기 때문에 URL에 parameter 형식으로 보내짐

http://localhost/process_advertisement.php?username=choideu