Browse Source

added user_list.txt code

tags/release-00
gashapwn 3 years ago
parent
commit
5625e3e2ce
4 changed files with 12 additions and 9 deletions
  1. +1
    -0
      .gitignore
  2. +7
    -1
      app.py
  3. +1
    -6
      perl-script/create-user.pl
  4. +3
    -2
      templates/index.html

+ 1
- 0
.gitignore View File

@@ -5,3 +5,4 @@ test_*.txt
*/p0.pl
*/p1.pl
*/p2.pl
user_list.txt

+ 7
- 1
app.py View File

@@ -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/<name>')


+ 1
- 6
perl-script/create-user.pl View File

@@ -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;
}


+ 3
- 2
templates/index.html View File

@@ -9,8 +9,9 @@
<p>git</p>
<p>users</p>
<ol>
<li>gashapwn</li>
<li>china probably</li>
{% for user in u_list %}
<li><a href="~{{user}}">{{user}}</a></li>
{% endfor %}
</ol>
</div>
{%endblock%}

Loading…
Cancel
Save