Added html files#3
Conversation
I create the directory web. But I don't create new html file.
kolayne
left a comment
There was a problem hiding this comment.
Hello, Vladimir! Thank you for your Pull Request. Sorry for such a long delay.
The code quality got much better, however, I have found some issues which I ask you to fix. Besides what I have mentioned in the files, here is what I want to ask/mention additionally:
- Why can/should we not use
static_filefor serving HTML files? I have googled a bit, and found several StackOverflow answers suggesting to do exactly that. - You might want to review your commits history and give your commits appropriate names and descriptions. If you don't, I will have to squash all your changes into one commit.
| <link rel="stylesheet" type="text/css" href="/styles.css"> | ||
| <link rel="preconnect" href="https://fonts.gstatic.com"> | ||
| <link href="https://fonts.googleapis.com/css2?family=Comfortaa:wght@300&display=swap" rel="stylesheet"> | ||
| <link href="https://fonts.googleapis.com/css2?family=Balsamiq+Sans:ital@1&display=swap" rel="stylesheet"> |
There was a problem hiding this comment.
These should be in the <head>: https://www.w3schools.com/tags/tag_link.asp (same for the other HTML files)
| <link href="https://fonts.googleapis.com/css2?family=Comfortaa:wght@300&display=swap" rel="stylesheet"> | ||
| <link href="https://fonts.googleapis.com/css2?family=Balsamiq+Sans:ital@1&display=swap" rel="stylesheet"> | ||
| </body> | ||
| </html> No newline at end of file |
There was a problem hiding this comment.
Please, let's keep empty lines at the end of files (same for the other files!)
| <body> | ||
| <h1>Jake is so lonely!</h1> | ||
| <p>To get the password, send the letter to Jake by POST.</p1> | ||
| <br></br> |
There was a problem hiding this comment.
The <br> tag should not be closed: https://www.w3schools.com/tags/tag_br.asp
| <br></br> | |
| <br> |
(same for other HTML files!)
| <title>Cookies Tasks</title> | ||
| </head> | ||
| <body> | ||
| <h1 class=".header1">Select a task or check flag:</h1> |
There was a problem hiding this comment.
I think the dot in the tag's class name is a typo
| background: #91ff7a; | ||
| border: none; | ||
| border-radius: 4px; | ||
| cursor: pointer; | ||
| padding: 12px 12px; | ||
| font-family: 'Comfortaa', cursive, bold; | ||
| font-size: 16px; | ||
| font-weight: bold; |
| if request.get_cookie("is_admin") == "no": | ||
| f = open('./Pages/Task1/Task1GUEST.html') | ||
| return f.read() | ||
| elif request.get_cookie("is_admin") == "yes": | ||
| f = open('./Pages/Task1/Task1ADMIN.html') | ||
| return f.read() |
There was a problem hiding this comment.
And what happens if the cookie is neither yes nor no? The server just doesn't send a response? Tell me if you have done this on purpose, and that's part of the task, but I assume you always want the server to send at least some response.
There are multiple ways to implement this, the simplest way I see is to return the Task1ADMIN.html page if the cookie is set to "yes", and return the guest page in any other case. By the way, I can see that you're already doing a similar thing in task 2. So why not do it here?
| response.set_cookie("Jake_is_fun", | ||
| "35eae3ea7fe1598f7f8ffa2806229068074bac921b2d235ed02660c6009eba9d40b09e2f5bfa099c8e66235d89d2bd3771941741a02a181aba9dcb027acca465", | ||
| path='/') |
There was a problem hiding this comment.
That's strange formatting. I don't mind having very long lines, because it's a CTF task source, not a production code or something, but this one's really strange
| if request.get_cookie( | ||
| "Jake_is_fun") == "7d357b285f1744c3af09312e2c2e3c577fec5d0a091cb26e3089624890a31aad4d78165cb696d796f10eb81a568bcfa165a2e54771ad5bfb8f6451e48d3c1159": |
There was a problem hiding this comment.
This piece has strange formatting too, btw. Maybe put these two lines on one?
|
|
||
| run(host='localhost', port=8080, debug=True) |
There was a problem hiding this comment.
| run(host='localhost', port=8080, debug=True) | |
| if __name__ == "__main__": | |
| run(host='0.0.0.0', port=8080, debug=False) |
Tell me if you don't understand something here and this needs comments
| input[type=submit] { | ||
| background: #91ff7a; | ||
| border: none; | ||
| border-radius: 4px; | ||
| cursor: pointer; | ||
| padding: 12px 12px; | ||
| font-family: 'Comfortaa', cursive, bold; | ||
| font-size: 16; | ||
| font-weight: bold; | ||
| } |
|
By the way, @Dzambek, should we accept tasks with flags containing apostrophes (')? |
Hello, Nikolay! I have translated the pages into html files as you requested. And made some changes to the code. I couldn't use the static _file method because that's not what it is for, but instead I used normal file manipulation.