Update webapp.py / web ui (#144)

* Update webapp.py

PS: Font will work on most devices (preinstalled), else it doesn't really matter

* Update webapp.py
This commit is contained in:
Linusx
2026-01-10 18:57:08 +01:00
committed by GitHub
parent 10bc8b9489
commit 986c919616

View File

@@ -14,13 +14,16 @@ import wifi
from duckyinpython import * from duckyinpython import *
payload_html = """<!DOCTYPE html> payload_html = """<html>
<html> <head>
<head> <title>Pico W Ducky</title> </head> <title>Pico W Ducky</title>
<body> <h1>Pico W Ducky</h1> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<table border="1"> <tr><th>Payload</th><th>Actions</th></tr> {} </table> <style>button{{margin:0.2em}}html{{font-family:'Open Sans', sans-serif;margin:2%}}table{{width:30%;max-width:20vh;margin-bottom:1em;border-collapse:collapse}}</style>
<br> </head>
<a href="/new">New Script</a> <body>
<h1>Pico W Ducky</h1>
<table border="1"><tr><th>Payload</th><th>Actions</th></tr>{}</table><br>
<a href="/new"><button>New Script</button></a>
</body> </body>
</html> </html>
""" """
@@ -29,15 +32,16 @@ edit_html = """<!DOCTYPE html>
<html> <html>
<head> <head>
<title>Script Editor</title> <title>Script Editor</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>button{{margin-top:1em}}.main{{font-family:'Open Sans', sans-serif;margin:2%}}textarea{{width:100%;max-width:80vh;margin-bottom:1em;height:50vh}}</style>
</head> </head>
<body> <body>
<form action="/write/{}" method="POST"> <form action="/write/{}" method="POST">
<textarea rows="5" cols="60" name="scriptData">{}</textarea> <textarea rows="5" name="scriptData">{}</textarea><br/>
<br/>
<input type="submit" value="submit"/> <input type="submit" value="submit"/>
</form> </form>
<br> <br>
<a href="/ducky">Home</a> <a href="/ducky"><button>Home</button></a>
</body> </body>
</html> </html>
""" """
@@ -46,34 +50,39 @@ new_html = """<!DOCTYPE html>
<html> <html>
<head> <head>
<title>New Script</title> <title>New Script</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>button{margin-top:1em}.main{font-family:'Open Sans', sans-serif;margin:2%}textarea{width:100%;max-width:80vh;margin-bottom:1em}#ducky-input{height:50vh}</style>
</head> </head>
<body> <body>
<div class="main">
<form action="/new" method="POST"> <form action="/new" method="POST">
Script Name<br> <p>New Script:</p>
<textarea rows="1" cols="60" name="scriptName"></textarea> <textarea rows="1" name="scriptName" placeholder="script name"></textarea><br>
Script<br> <textarea id="ducky-input" rows="5" name="scriptData" placeholder="script"></textarea>
<textarea rows="5" cols="60" name="scriptData"></textarea> <br><input type="submit" value="Submit"/>
<br/>
<input type="submit" value="submit"/>
</form> </form>
<br> <a href="/ducky"><button>Go Back</button></a>
<a href="/ducky">Home</a> </div>
</body> </body>
</html> </html>
""" """
response_html = """<!DOCTYPE html> response_html = """<!DOCTYPE html>
<html> <html>
<head> <title>Pico W Ducky</title> </head> <head>
<body> <h1>Pico W Ducky</h1> <title>Pico W Ducky</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>button{{margin-top:1em}}body{{font-family:'Open Sans', sans-serif;margin:2%}}</style>
</head>
<body>
<h1>Pico W Ducky</h1>
{} {}
<br> <br><a href="/ducky"><button>Home</button></a>
<a href="/ducky">Home</a>
</body> </body>
</html> </html>
""" """
newrow_html = "<tr><td>{}</td><td><a href='/edit/{}'>Edit</a> / <a href='/run/{}'>Run</a></tr>" newrow_html = "<tr><td>{}</td><td><a href='/edit/{}'><button>Edit</button></a><a href='/run/{}'><button>Run</button></a></tr>"
def setPayload(payload_number): def setPayload(payload_number):
if(payload_number == 1): if(payload_number == 1):