def connect(url, port): import socket import re if url[:7] == "http://": url = url[7:] pattern = re.compile(r'[a-zA-Z0-9.-]+') if pattern.match(url): ip = str(socket.gethostbyname(url)) html(make_page(name, content_head + result.format(url, ip, port))) else: html("Invalid Domain/IP")
form = " \ <form method='POST' style='display: inline;'> \ <pre style='display: inline;'>Username:\t</pre> \ <input type='text' name='username' value='{}'>{}<br> \ <pre style='display: inline;'>Password:\t\t</pre> \ <input type='password' name='password'>{}<br><br> \ <input type=submit value='Register'> \ </form> \ " username_inuse = "<pre class='error' style='display: inline;'> Username already used</pre>" invalid_pass = "******" if "username" in _USER: html(redirect("Home", '/')) exit() if "username" not in _POST and "password" not in _POST: html(make_page(name, content_head + form.format("", "", ""))) exit() if "password" not in _POST: html( make_page( name, content_head + form.format(_POST["username"], "", invalid_pass))) exit() user = db.get_user_by_username(_POST["username"]) if user is None:
import sys sys.path.insert(0, '/data/niekserver/lib') from http import html from http import java from general import redirect html(redirect("Home", '/')) java("action=logout")
<ul class='terminal'> \ <li><form> \ <input class='terminal' type='text' name='command', value=''> \ </form></li> \ <li>Test</li> \ </ul> \ " def connect(url, port): import socket import re if url[:7] == "http://": url = url[7:] pattern = re.compile(r'[a-zA-Z0-9.-]+') if pattern.match(url): ip = str(socket.gethostbyname(url)) html(make_page(name, content_head + result.format(url, ip, port))) else: html("Invalid Domain/IP") if "username" not in _USER: html(redirect("Login", '/py/login.py')) elif "url" not in _POST or "port" not in _POST: html(make_page(name, content_head + form)) else: connect(unquote(_POST["url"]), _POST["port"])
form = " \ <form method='POST' style='display: inline;'> \ {} \ <pre style='display: inline;'>Username:\t</pre> \ <input type='text' name='username' value='{}'><br> \ <pre style='display: inline;'>Password:\t\t</pre> \ <input type='password' name='password'><br><br> \ <input type=submit value='Login'> \ </form> \ " invalid_login = "******" if "username" in _USER: html(redirect("Home", '/')) exit() if "username" not in _POST and "password" not in _POST: html(make_page(name, content_head + form.format("<br>", ""))) exit() if "password" not in _POST: html(make_page(name, content_head + form.format(invalid_login, _POST["username"]))) exit() user = db.get_user_by_username(_POST["username"]) if user is None: html(make_page(name, content_head + form.format(invalid_login, _POST["username"]))) exit() elif not user.check_hash(_POST["password"]):