Secure Login System in Python

Поделиться
HTML-код
  • Опубликовано: 19 июн 2024
  • In this video, we learn how to build a secure login system in Python.
    ◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
    📚 Programming Books & Merch 📚
    🐍 The Python Bible Book: www.neuralnine.com/books/
    💻 The Algorithm Bible Book: www.neuralnine.com/books/
    👕 Programming Merch: www.neuralnine.com/shop
    🌐 Social Media & Contact 🌐
    📱 Website: www.neuralnine.com/
    📷 Instagram: / neuralnine
    🐦 Twitter: / neuralnine
    🤵 LinkedIn: / neuralnine
    📁 GitHub: github.com/NeuralNine
    🎙 Discord: / discord
    🎵 Outro Music From: www.bensound.com/
    Timestamps:
    (0:00) Intro
    (0:16) Create Database
    (5:38) Build Login Server
    (10:55) Build Login Client
    (14:10) Outro
  • НаукаНаука

Комментарии • 96

  • @johnecott7429
    @johnecott7429 Год назад +2

    thanks for the video! I love all your content and you make python very fun to learn.

  • @hussainbabonji4207
    @hussainbabonji4207 Год назад +20

    I forgot to tell you that I started to love python more because of you thank you and keep going I love your projects

  • @PaulSmith-zs5je
    @PaulSmith-zs5je Год назад +2

    Enjoying the python content.. keep up the great work.

  • @fredericoamigo
    @fredericoamigo 11 месяцев назад +4

    Nice vid! How did you make your pycharm format the SQL?

  • @bsuarez3455
    @bsuarez3455 Год назад

    i love all these under 20 minutes projects. Lets you gets hands on quick

  • @sherazmalik5155
    @sherazmalik5155 17 дней назад

    your presentation of the code is amazing, learning a lot from your channel. Thanks.

  • @alessandrog498
    @alessandrog498 Год назад +2

    This channel deserves more subscribers!

  • @IlyesCodes
    @IlyesCodes Год назад

    Thanks for always teaching us useful stuff
    Please make a video about sys and subsystem modules

  • @chrism6880
    @chrism6880 Год назад +24

    You should be using something like bcrypt (or anything beyond a simple sha256 hash) for passwords. Sha is a general purpose hash, not the best for password hashing.

    • @HuskkM8
      @HuskkM8 Год назад +2

      That’s right 👍

    • @pobkuk
      @pobkuk Год назад +7

      Or doing it properly and using something like Passlib to manage the hashing... This is just negligent programming calling this car-crash "secure"

    • @vmajed7103
      @vmajed7103 7 месяцев назад

      @@pobkuk nerd

    • @federalcheesegrater556
      @federalcheesegrater556 6 месяцев назад +1

      This is just an example video though, if you're going to use this tutorial in any professional environment, you shouldn't be in your position...

  • @kushaldevkota3016
    @kushaldevkota3016 Год назад +1

    can we use sqlite 3 and hash libraries for our minor
    academic project?

  • @paulthomas1052
    @paulthomas1052 Год назад +1

    Great video, cheers.

  • @sahilgarg94
    @sahilgarg94 Год назад +2

    Always quality content

  • @AliHamza-en8cn
    @AliHamza-en8cn Год назад +1

    I love your videos.

  • @servetbirgul9526
    @servetbirgul9526 Год назад +1

    Hi I've been following you for a long time and I like all your videos

    • @servetbirgul9526
      @servetbirgul9526 Год назад

      I want to generate invoice with UBL 2.1 using python but there is nothing about it in python, can you help me with this please

    • @servetbirgul9526
      @servetbirgul9526 Год назад

      There is not much information about xml files, please help this follower

  • @user-lw9zp7er6r
    @user-lw9zp7er6r Год назад +2

    Did you uploaded these project files to your github?

  • @Mjuziks
    @Mjuziks Год назад

    thank you

  • @sanunitwaibu529
    @sanunitwaibu529 7 месяцев назад

    hello...your tutorials are extraordinary. can you please create a tutorial on python built-in functions(all built in functions there are 71). i hope you will work on it. thank you.

  • @dmitrykononenko6411
    @dmitrykononenko6411 Год назад +1

    What do you think of password salt?

  • @craab9utube
    @craab9utube Год назад

    what is the theme you have your pycharm set up with here

  • @youssefalkhodary
    @youssefalkhodary Год назад +1

    you are awesome ❤️

  • @kellywalfgan8767
    @kellywalfgan8767 9 месяцев назад

    Nice one bro

  • @Tijnnnn
    @Tijnnnn Год назад

    Could you add expiration system so after a specific amount of time the key becomes invalid?

  • @TBT_ZHV
    @TBT_ZHV Год назад

    how do you see all those functions etc even in strings??

  • @rougebarbu
    @rougebarbu Год назад +3

    You should build the hash from password AND username (for example username + password), not only password so the hashes would be different for 2 users having the same password.

    • @dslnoob7140
      @dslnoob7140 Год назад

      Or instead of building the salt from username and password, maybe just generate a random salt and store the hashed salted password in the DB along with the salt. Perhaps use bcrypt so as to generate the salt and save the salt in the same field as the password

    • @MnMEminem
      @MnMEminem Год назад +1

      @@dslnoob7140 you are mistaking hashing with encrypting, hashing is more secure for passwords

    • @dslnoob7140
      @dslnoob7140 Год назад

      @@MnMEminem nope. I am indeed talking about hashing and not encrypting. But with my strategy, even if two users share the same password, their hashes would still be different since we added salt to the password.

  • @servetbirgul9526
    @servetbirgul9526 Год назад

    I want to generate invoice with UBL 2.1 using python but there is nothing about it in python, can you help me with this please

  • @nickfikes7301
    @nickfikes7301 Год назад +1

    I can't get the username and password prompts to pop up in the terminal :/ I'm running the server first then the client and the server runs but client does nothing. Any idea what the issue could be?

    • @dazewaker262
      @dazewaker262 Год назад

      If you got any errors like no connection could be made,Change your port number as it could be used by another service. Change 9999 to something like 3000 or anything.

  • @jackfr0st486
    @jackfr0st486 Год назад +2

    How to encrypt the database itself?
    Like setting a password to username.db so that no one read it even if they somehow got to download the file(database) itself?

    • @photoballa
      @photoballa Год назад +1

      Hash the password, so that when the user enters the password you apply the hash function, check if that’s in the database, if it is for that user, let them in, if it’s wrong well you know. And this way since a hash function is only one way, they’ll know which username has which hash password but they can never figure out the password as it is hashed. Don’t store the password in the database, only person who’ll know password is person who enters it

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 Год назад

      The trouble with hashed passwords is that the authentication can only be one-way. If you are operating over an untrusted connection (e.g. the Internet), then you need authentication to be two-way: not only must the server be sure the client/user is genuine, but the client/user must also be sure the server is genuine.

    • @jackfr0st486
      @jackfr0st486 Год назад

      @@photoballa Thanks for the reply, but what i meant to ask was how do i set authentication for the sqlite3 database itself, like in mysql.

  • @okwuteizuchukwu7547
    @okwuteizuchukwu7547 11 месяцев назад

    I get as far as 5:10 but when I run it I get this error message ' sqlite3.OperationalError: table userdata has no column named password ' Does anyone have any solutions?

  • @spiceplayz8035
    @spiceplayz8035 Год назад +1

    how did you get that thing to show up for the database? ive never really used sql before and its saying that the file is not displayed in the editor because its either binary or an unsupported text encoding

    • @patriciomondragon-db5mb
      @patriciomondragon-db5mb Год назад

      Go to extensions, write SQlite, Install the extension, right click on the data base and click open database, An SQlite explorer button will appear on the bottom left, click it and it should show the database, click the name of the database it will show you the tables.
      If you want to do a query, right click it an select new query

  • @suntzu5376
    @suntzu5376 Год назад

    i'm learning python but instead of watching 6 hours of "print types" watching this. i don't really understand the whole thing but i wanna create something. am i doing good or should i go for beginners guide?

  • @njanirudh
    @njanirudh Год назад

    I would suggest a unique salt added to the passwords

  • @ttaylor9916
    @ttaylor9916 10 месяцев назад +1

    [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted

  • @cyb3ersounds
    @cyb3ersounds 21 день назад

    please i am having this error: cur.execute("""
    AttributeError: 'builtin_function_or_method' object has no attribute 'execute'

  • @philtoa334
    @philtoa334 Год назад +1

    Thx_.

  • @trailerhighlights8349
    @trailerhighlights8349 Год назад +1

    Can you make a #2 video that adds the function to create new accounts

    • @juleslevy3662
      @juleslevy3662 3 месяца назад

      hi he could have made a second video for that but its very simple thing just replace the username name 1 and password 1 from your sample.py by an input and make it a function with def ...(): and implement it like the login systeme or if you dont want a input in commmand line like me you can use PyQt5 to make an app and replace the input() by self.NAME OF TEXT BOX.text()

  • @user-wn2se1fd9m
    @user-wn2se1fd9m 5 месяцев назад

    but how to keep session, user logged in and transfer data? big data?

  • @bsmonkey6036
    @bsmonkey6036 6 месяцев назад

    [vscode-sqlite][ERROR] Failed to open database 'c:\...\...': file is not a database
    i dont know where to put my files so it finds the db

  • @tcgvsocg1458
    @tcgvsocg1458 Год назад +1

    interesting

  • @georgebas1605
    @georgebas1605 Год назад

    intro song name?

  • @essa88371
    @essa88371 Год назад

    wow

  • @mikepenprogrammer2652
    @mikepenprogrammer2652 Год назад

    You should have an entire book on login systems and databases. I'd buy it. EDIT: Already purchased some of your books.

  • @MOVIESHORT854
    @MOVIESHORT854 Год назад +1

    pythone is so simple in context

  • @mateusz7612
    @mateusz7612 Год назад

    Hello i did everything like in the video but in the end i have message ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it. I tried to find in on the internet but i couldn't :( maybe someone know how to fix it?

    • @dazewaker262
      @dazewaker262 Год назад

      Change your port number as it could be used by another service. Change 9999 to something like 3000 or anything.

  • @HingalshDealer
    @HingalshDealer 2 месяца назад

    didn't get anything but thank ya)

  • @Wavyrezzz
    @Wavyrezzz Год назад

    How do we add this to our exe

  • @user-so7gc3eu2d
    @user-so7gc3eu2d Год назад

    even i type correct password and username login failed is shown

  • @user-wc6be7ni4c
    @user-wc6be7ni4c Год назад +1

    "Secure"
    SQL Injection laughing at the corner:

  • @ironislife9857
    @ironislife9857 Год назад

    Can you show how to host a socket server for free?

  • @RayHorn5128088056
    @RayHorn5128088056 Год назад +16

    Calling unsalted sha256 secure is a joke. Lol.

    • @amosrocha6793
      @amosrocha6793 5 месяцев назад +1

      How Can I learn about this top more. ?

  • @dhruvkumarpal2631
    @dhruvkumarpal2631 Год назад

    It is showing error

  • @ChadDeveloper
    @ChadDeveloper 3 месяца назад

    Hashlib was yanked bruh

  • @HoboSquirrel12
    @HoboSquirrel12 Год назад

    Would be safer to salt the password before hashing it

    • @dslnoob7140
      @dslnoob7140 Год назад

      The answer is definitely yes.

  • @pobkuk
    @pobkuk Год назад +1

    Interesting. Comments critical of the security of the techniques posted to this video seem to disappear. Methinks the author is deleting said critical commentary.

    • @dazewaker262
      @dazewaker262 Год назад

      He isnt.They all are there.Revisit whole section.

  • @talalkhan7189
    @talalkhan7189 Год назад +1

    1st one bro

  • @manofqwerty
    @manofqwerty 10 месяцев назад

    It looks like hashlib has been deprecated now

  • @arielspalter7425
    @arielspalter7425 Год назад

    I couldn’t understand how server.py and client.py are related to each other…

    • @temal32
      @temal32 Год назад

      client.py sends the information to server.py, server.py then sends the information to the database.

    • @arielspalter7425
      @arielspalter7425 Год назад

      @@temal32 My confusion was that client.py was not imported into server.py and the connection is made through the tcp connection.

    • @samsepiol6052
      @samsepiol6052 Год назад

      @@arielspalter7425 It doesn't need to be. The point of networking is having 2 devices talk to each other. He is doing this, but the 2 computers are the same computer but different applications on the computer. And also, why would server.py need to import client.py? All the applications need to do is connect.

  • @OldKing11100
    @OldKing11100 Год назад +2

    I wouldn't use SHA256 or BLAKE3 for password encryption. The reason why we like to use those is that it's computationally inexpensive to check. This means that if your database gets compromised it won't take too long to break short unsalted SHA256 hashes. Still this is good for generating Cookies and Bearer Tokens because they are easy to verify on every request. bcrypt or argon2 is much better for generating passwords.

    • @OldKing11100
      @OldKing11100 Год назад

      @@__Brandon__ I agree with the TLS part which is standard, but not the client password hashing. It's perfectly fine sending a plaintext password over TLS v1.2 and up. If you are storing the argon2id password (which includes the salt) then the client would need to know what the argon2id scheme is before hand. You can actually cause a bigger issue since the client would know the pw + salt + hash which would all be captured with a bad clientside javascript library giving inside details into the server.

    • @OldKing11100
      @OldKing11100 Год назад

      @@__Brandon__ I'm essentially relying on TLS to be secure through AES-256 (ChaCha20) after the RSA handshake to receive the password then have the server store it with argon then decipher it with argon. If you can't trust TLS to be secure then any PII data sent is insecure. Your method makes it impossible to enforce any password complexity requirements at the API layer and you can't rely on the client to be honest.

    • @OldKing11100
      @OldKing11100 Год назад

      ​@@__Brandon__ I see what you're saying. Chances aren't that your DB gets compromised so much as your DNS or and ISPs BGP router gets changed to trick users in which case the attacker is still going to get the passwords anyway since their app won't hash anything. Still if the hacker get into the server they will still be able to see all JSON objects that pass through the server so what's the point of encrypting the password if they get your SSN, DOB, F/L, and all that good stuff anyway. All they have to do is send the has password anyway? It's kind of hard to shield users from leaking passwords if their computer is compromised also or click a bad link. I don't think the extra hash really helps to be honest. Maybe here is to hoping that passwordless implementations will be better?

    • @OldKing11100
      @OldKing11100 Год назад

      @@__Brandon__ You just now said that it's hard to forge a cert (MITM) yet you are trying to protect against it...?
      EDIT: You're standardizing your PW length and characters so it's still vulnerable to dictionary attacks and it really doesn't matter since the hash just becomes the password. Very little value add; just make your passwords passphrases with a 16 character minimum. Also don't quote standards to me if you don't tell me the standard like HIPAA FERPA COPPA. What industry standard are you referring to, CISPA?

    • @OldKing11100
      @OldKing11100 Год назад

      @@__Brandon__ I'm sorry I'm going to forward this to my Frontend SA. She is going to get a kick out of this in that she's trying to avoid the Discover hack. Take it easy my dude. We are arguing over the smallest thing.

  • @kanwaradnan4849
    @kanwaradnan4849 Год назад

    Yes first😅

  • @kanwaradnan4849
    @kanwaradnan4849 Год назад

    First?

  • @talalkhan7189
    @talalkhan7189 Год назад

    1st comment

  • @dgh25
    @dgh25 9 месяцев назад

    wtf just happened?

    • @alexlee3402
      @alexlee3402 Месяц назад

      This is what happened every time you use the website to register and later login.

  • @franklynchukwu3480
    @franklynchukwu3480 2 месяца назад

    It just seems like your teaching yourself..your a bad teacher

  • @jackolantern6172
    @jackolantern6172 Год назад

    Client didn’t work. Just says
    _AttributeError: module ‘socket’ has no attribute ‘connect’_
    Does it have something to do with the server number? I hate this computer ish for this very reason but I want to learn it so I’m not at such a disadvantage moving. I know once it clicks I’ll be golden.