-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3,673 changed files
with
876,741 additions
and
41 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
__pycache__ | ||
passhportd/config.pyc | ||
*.pyc | ||
*.py[cod] | ||
*$py.class | ||
*~ | ||
output-qemu | ||
packer_cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Add any directories, files, or patterns you don't want to be tracked by version control | ||
# Created by https://www.gitignore.io/api/python | ||
|
||
### Python ### | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from flask import Flask | ||
import config | ||
|
||
app = Flask(__name__) | ||
|
||
if config.FIRSTLAUNCH == True: | ||
from app import firstlaunch | ||
else: | ||
from flask_login import LoginManager | ||
from flask_login import login_required | ||
login_manager = LoginManager() | ||
login_manager.init_app(app) | ||
login_manager.login_view = "login" | ||
from app import views | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from flask import render_template, flash, redirect, session, url_for | ||
from app import app | ||
from app import forms as f | ||
from flask import request | ||
import requests | ||
import config | ||
|
||
### Routes ### | ||
@app.route('/') | ||
@app.route('/index') | ||
def genconfig(): | ||
# Cofiguration generation, | ||
form = f.ConfigForm() | ||
|
||
if request.method == "POST": | ||
#Prepare different files | ||
writeonfile(request.form["pubsshkey"], config.PUBSSH) | ||
writeonfile(request.form["privsshkey"], config.PRIVSSH) | ||
writeonfile(request.form["sslkey"], config.SSLKEY) | ||
writeonfile(request.form["sslcert"], config.SSLCERT) | ||
app.logger.error(request.form) | ||
return redirect(url_for('index')) | ||
|
||
# GET | ||
return render_template('pages/firstconfig.html', | ||
pagename = "Configuration", | ||
userid = "passhadmin", | ||
superadmin = True, | ||
form = form) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
from flask_wtf import FlaskForm | ||
from wtforms import StringField, BooleanField, SelectField, IntegerField | ||
from wtforms.validators import DataRequired, NumberRange, Optional | ||
from wtforms.widgets import TextArea | ||
import config | ||
|
||
class LoginForm(FlaskForm): | ||
email = StringField('email', validators=[DataRequired()]) | ||
password = StringField('password', validators=[DataRequired()]) | ||
remember_me = BooleanField('remember_me', default=False) | ||
|
||
|
||
class TargetForm(FlaskForm): | ||
name = StringField('name', validators=[DataRequired()]) | ||
if config.DBP: | ||
choices = [('ssh', 'SSH'), | ||
('mysql', 'MySQL'), | ||
('oracle', 'Oracle'), | ||
('postgresql', 'PostgreSQL')] | ||
else: | ||
choices = [('ssh', 'SSH')] | ||
targettype = SelectField('targettype', choices = choices, | ||
default = ("ssh", "SSH")) | ||
hostname = StringField('hostname', validators=[DataRequired()]) | ||
login = StringField('login', validators=[]) | ||
port = IntegerField('port', validators=[NumberRange(min=0, max=7200)]) | ||
sessiondur = IntegerField('sesssiondur', validators=[NumberRange(min=0, max=7200)]) | ||
options = StringField('options', validators=[]) | ||
comment = StringField('comment', validators=[]) | ||
changepwd = BooleanField('changepwd', default=False) | ||
|
||
|
||
class UserForm(FlaskForm): | ||
name = StringField('name', validators=[DataRequired()]) | ||
sshkey = StringField('sshkey', widget=TextArea(), | ||
validators=[DataRequired()]) | ||
comment = StringField('comment', validators=[]) | ||
logfilesize = IntegerField('logfilesize', validators=[NumberRange(min=0, max=65535), Optional()]) | ||
|
||
|
||
class UsergroupForm(FlaskForm): | ||
name = StringField('name', validators=[DataRequired()]) | ||
comment = StringField('comment', validators=[]) | ||
|
||
|
||
class TargetgroupForm(FlaskForm): | ||
name = StringField('name', validators=[DataRequired()]) | ||
comment = StringField('comment', validators=[]) | ||
|
||
|
||
class ConfigForm(FlaskForm): | ||
url = StringField('url', validators=[DataRequired()]) | ||
sslkey = StringField('sslkey', validators=[DataRequired()]) | ||
sslcert = StringField('sslcert', validators=[DataRequired()]) | ||
privsshkey = StringField('privsshkey', validators=[DataRequired()]) | ||
pubsshkey = StringField('pubsshkey', validators=[DataRequired()]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from flask_login import UserMixin | ||
|
||
class User(UserMixin): | ||
|
||
def __init__(self, username): | ||
self.id = username | ||
|
||
@property | ||
def is_authenticated(self): | ||
return True | ||
|
||
@property | ||
def is_active(self): | ||
return True | ||
|
||
@property | ||
def is_anonymous(self): | ||
return False | ||
|
||
def get_id(self): | ||
return str(self.id) # python 3 | ||
|
||
def get(id): | ||
return User(id) | ||
|
||
def __repr__(self): | ||
return '<User %r>' % (self.id) |
Oops, something went wrong.