diff --git a/utils/app.py b/utils/app.py index 8405084..41032a9 100644 --- a/utils/app.py +++ b/utils/app.py @@ -42,5 +42,17 @@ def port(): port = generate.generate_port() return render_template('port-gen.j2', result=port) +@app.route('/case', methods=['GET', 'POST']) +def case(): + if request.method == 'POST': + text = request.form['text'] + case = request.form['casing'] + if case == 'caps': + result = generate.uppercase(text) + if case == 'lowercase': + result = generate.lowercase(text) + return redirect(url_for('result', result=result, type='casing')) + return render_template('casing.j2') + if __name__ == '__main__': app.run(debug=True) \ No newline at end of file diff --git a/utils/generate.py b/utils/generate.py index a2b1a3a..9ed7fc5 100644 --- a/utils/generate.py +++ b/utils/generate.py @@ -19,4 +19,12 @@ def generate_ip(subnet, prefix): def generate_port(): port = randint(1025, 65535) - return str(port) \ No newline at end of file + return str(port) + +def lowercase(input): + output = input.lower() + return output + +def uppercase(input): + output = input.upper() + return output \ No newline at end of file diff --git a/utils/templates/casing.j2 b/utils/templates/casing.j2 new file mode 100644 index 0000000..8227d21 --- /dev/null +++ b/utils/templates/casing.j2 @@ -0,0 +1,24 @@ + + + + Utilities + + + + +

Text casing

+
+ +
+ caps + lowercase +
+ +
+ + + \ No newline at end of file diff --git a/utils/templates/index.j2 b/utils/templates/index.j2 index 25ab9ab..f623f17 100644 --- a/utils/templates/index.j2 +++ b/utils/templates/index.j2 @@ -6,6 +6,7 @@

Utilites

+

Networking stuff

+

Text casing

+