From a1c1ee03ec186ac9b13093f163c955452b35ad69 Mon Sep 17 00:00:00 2001 From: jiangsir <1463310682@qq.com> Date: Thu, 12 Sep 2024 19:12:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20=5Ffiles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _files/flag.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 _files/flag.sh diff --git a/_files/flag.sh b/_files/flag.sh new file mode 100644 index 0000000..54321c0 --- /dev/null +++ b/_files/flag.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# Create database and user +# mysql -e "create database ctfhub;" -uroot -proot +# mysql -e "grant select,insert,update,delete on ctfhub.* to ctfhub@'127.0.0.1' identified by 'ctfhub';" -uroot + +# Set dynamic FLAG + +#sed -i "s#FLAGFLAGFLAG#$GZCTF_FLAG#" /var/www/html/flag.php || true + +# mysql -e "USE $FLAG_SCHEMA;ALTER TABLE FLAG_TABLE CHANGE FLAG_COLUMN $FLAG_COLUMN CHAR(128) NOT NULL DEFAULT 'not_flag';ALTER TABLE FLAG_TABLE RENAME $FLAG_TABLE;INSERT $FLAG_TABLE VALUES('$FLAG');" -uroot -proot +mysql -e "USE students;UPDATE information SET password='$GZCTF_FLAG' where password='FLAGFLAGFLAG'" -uroot -proot + +#mysql -uroot -proot -e "update \`students\`.\`information\` set password=MD5(ROUND(RAND()*10000000));" + +# Reset mysql root's passwors as random string +mysql -uroot -proot -e "UPDATE mysql.user SET Password=PASSWORD(substring(MD5(RAND()),1,20)) WHERE user='root';" + +export FLAG=not_flag +FLAG=not_flag + +rm -f /flag.sh \ No newline at end of file