mirror of
https://github.com/dbisu/pico-ducky.git
synced 2026-01-21 09:15:59 +00:00
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:
87
webapp.py
87
webapp.py
@@ -14,66 +14,75 @@ 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>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
edit_html = """<!DOCTYPE html>
|
edit_html = """<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Script Editor</title>
|
<title>Script Editor</title>
|
||||||
</head>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<body>
|
<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>
|
||||||
<form action="/write/{}" method="POST">
|
</head>
|
||||||
<textarea rows="5" cols="60" name="scriptData">{}</textarea>
|
<body>
|
||||||
<br/>
|
<form action="/write/{}" method="POST">
|
||||||
<input type="submit" value="submit"/>
|
<textarea rows="5" name="scriptData">{}</textarea><br/>
|
||||||
</form>
|
<input type="submit" value="submit"/>
|
||||||
<br>
|
</form>
|
||||||
<a href="/ducky">Home</a>
|
<br>
|
||||||
</body>
|
<a href="/ducky"><button>Home</button></a>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
new_html = """<!DOCTYPE html>
|
new_html = """<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>New Script</title>
|
<title>New Script</title>
|
||||||
</head>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<body>
|
<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>
|
||||||
<form action="/new" method="POST">
|
</head>
|
||||||
Script Name<br>
|
<body>
|
||||||
<textarea rows="1" cols="60" name="scriptName"></textarea>
|
<div class="main">
|
||||||
Script<br>
|
<form action="/new" method="POST">
|
||||||
<textarea rows="5" cols="60" name="scriptData"></textarea>
|
<p>New Script:</p>
|
||||||
<br/>
|
<textarea rows="1" name="scriptName" placeholder="script name"></textarea><br>
|
||||||
<input type="submit" value="submit"/>
|
<textarea id="ducky-input" rows="5" name="scriptData" placeholder="script"></textarea>
|
||||||
</form>
|
<br><input type="submit" value="Submit"/>
|
||||||
<br>
|
</form>
|
||||||
<a href="/ducky">Home</a>
|
<a href="/ducky"><button>Go Back</button></a>
|
||||||
</body>
|
</div>
|
||||||
|
</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):
|
||||||
|
|||||||
Reference in New Issue
Block a user