From 5625e3e2ce3f7183b6f85fe1a2794722e0679c23 Mon Sep 17 00:00:00 2001 From: gashapwn Date: Thu, 26 Nov 2020 06:53:20 +0000 Subject: [PATCH] added user_list.txt code --- .gitignore | 1 + app.py | 8 +++++++- perl-script/create-user.pl | 7 +------ templates/index.html | 5 +++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index e42ecb7..2208975 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ test_*.txt */p0.pl */p1.pl */p2.pl +user_list.txt diff --git a/app.py b/app.py index b9d80cf..7f0291f 100644 --- a/app.py +++ b/app.py @@ -5,7 +5,13 @@ app=Flask(__name__) @app.route("/") def home(): app.route('/') - return render_template("index.html") + + u_list = []; + with open("user_list.txt") as u_file: + for line in u_file: + u_list.append(line); + + return render_template("index.html", u_list=u_list) def home2(name): # app.route('/home2/') diff --git a/perl-script/create-user.pl b/perl-script/create-user.pl index 22820e9..95155cc 100644 --- a/perl-script/create-user.pl +++ b/perl-script/create-user.pl @@ -53,16 +53,11 @@ sub create($){ } system($cmd); - #system("mkdir /home/$username/.ssh"); - #system("chmod 700 /home/$username/.ssh"); system("cat $FULL_PATH/$id.pub > /home/$username/.ssh/authorized_keys"); - #system("mv $FULL_PATH/$id.pub /home/$username/.ssh/authorized_keys"); - #system("chmod 600 /home/$username/.ssh/authorized_keys"); system("chmod 711 /home/$username"); - #system("chown $username:$username /home/$username/.ssh"); - #system("chown $username:$username /home/$username/.ssh/authorized_keys"); system("rm $FULL_PATH/$id.ident"); system("rm $FULL_PATH/$id.pub"); + system("echo $username >> user_list.txt"); } close FILE; } diff --git a/templates/index.html b/templates/index.html index ea90b06..1a46c2c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -9,8 +9,9 @@

git

users

    -
  1. gashapwn
  2. -
  3. china probably
  4. + {% for user in u_list %} +
  5. {{user}}
  6. + {% endfor %}
{%endblock%}