Skip to content

Commit 83fdc84

Browse files
committed
Finished SQL injection example
1 parent 5f11be8 commit 83fdc84

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

main.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def home():
1515

1616
transaction = "INSERT INTO messages VALUES ('{}', '{}')".format(
1717
request.remote_addr,
18-
request.form['content'],
18+
request.form['content'].replace('\'',''),
1919
)
2020
c.execute(transaction)
2121
conn.commit()
@@ -35,7 +35,7 @@ def home():
3535
3636
<h2>Messages</h2>
3737
"""
38-
38+
3939
for m in c.execute("SELECT * FROM messages"):
4040
body += """
4141
<div class="message">
@@ -45,10 +45,9 @@ def home():
4545

4646
c.close()
4747

48-
return body
48+
return body
4949

5050

5151
if __name__ == "__main__":
5252
port = int(os.environ.get("PORT", 6779))
5353
app.run(host='0.0.0.0', port=port)
54-

0 commit comments

Comments
 (0)