Secure Login System in Python

Sdílet
Vložit
  • čas přidán 2. 06. 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
  • Věda a technologie

Komentáře • 95

  • @hussainbabonji4207
    @hussainbabonji4207 Před rokem +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

  • @johnecott7429
    @johnecott7429 Před rokem +2

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

  • @alessandrog498
    @alessandrog498 Před 11 měsíci +2

    This channel deserves more subscribers!

  • @PaulSmith-zs5je
    @PaulSmith-zs5je Před rokem +2

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

  • @fredericoamigo
    @fredericoamigo Před 10 měsíci +4

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

  • @sherazmalik5155
    @sherazmalik5155 Před hodinou

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

  • @bsuarez3455
    @bsuarez3455 Před rokem

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

  • @sahilgarg94
    @sahilgarg94 Před rokem +2

    Always quality content

  • @paulthomas1052
    @paulthomas1052 Před rokem +1

    Great video, cheers.

  • @chrism6880
    @chrism6880 Před rokem +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 Před rokem +2

      That’s right 👍

    • @pobkuk
      @pobkuk Před rokem +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 Před 6 měsíci

      @@pobkuk nerd

    • @federalcheesegrater556
      @federalcheesegrater556 Před 6 měsíci +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...

  • @IlyesCodes
    @IlyesCodes Před rokem

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

  • @kushaldevkota3016
    @kushaldevkota3016 Před 11 měsíci +1

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

  • @AliHamza-en8cn
    @AliHamza-en8cn Před rokem +1

    I love your videos.

  • @user-lw9zp7er6r
    @user-lw9zp7er6r Před rokem +2

    Did you uploaded these project files to your github?

  • @dmitrykononenko6411
    @dmitrykononenko6411 Před rokem +1

    What do you think of password salt?

  • @servetbirgul9526
    @servetbirgul9526 Před rokem +1

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

    • @servetbirgul9526
      @servetbirgul9526 Před rokem

      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 Před rokem

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

  • @kellywalfgan8767
    @kellywalfgan8767 Před 9 měsíci

    Nice one bro

  • @craab9utube
    @craab9utube Před rokem

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

  • @youssefalkhodary
    @youssefalkhodary Před rokem +1

    you are awesome ❤️

  • @servetbirgul9526
    @servetbirgul9526 Před rokem

    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

  • @Tijnnnn
    @Tijnnnn Před rokem

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

  • @TBT_ZHV
    @TBT_ZHV Před rokem

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

  • @rougebarbu
    @rougebarbu Před rokem +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 Před rokem

      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 Před rokem +1

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

    • @dslnoob7140
      @dslnoob7140 Před rokem

      @@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.

  • @nickfikes7301
    @nickfikes7301 Před rokem +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 Před rokem

      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.

  • @sanunitwaibu529
    @sanunitwaibu529 Před 7 měsíci

    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.

  • @suntzu5376
    @suntzu5376 Před rokem

    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?

  • @okwuteizuchukwu7547
    @okwuteizuchukwu7547 Před 10 měsíci

    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?

  • @Mjuziks
    @Mjuziks Před rokem

    thank you

  • @jackfr0st486
    @jackfr0st486 Před rokem +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 Před rokem +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 Před rokem

      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 Před rokem

      @@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.

  • @cyb3ersounds
    @cyb3ersounds Před 4 dny

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

  • @bsmonkey6036
    @bsmonkey6036 Před 6 měsíci

    [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

  • @spiceplayz8035
    @spiceplayz8035 Před rokem +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 Před rokem

      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

  • @user-wn2se1fd9m
    @user-wn2se1fd9m Před 4 měsíci

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

  • @njanirudh
    @njanirudh Před rokem

    I would suggest a unique salt added to the passwords

  • @ttaylor9916
    @ttaylor9916 Před 9 měsíci +1

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

  • @MOVIESHORT854
    @MOVIESHORT854 Před rokem +1

    pythone is so simple in context

  • @georgebas1605
    @georgebas1605 Před rokem

    intro song name?

  • @tcgvsocg1458
    @tcgvsocg1458 Před rokem +1

    interesting

  • @mateusz7612
    @mateusz7612 Před rokem

    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 Před rokem

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

  • @trailerhighlights8349
    @trailerhighlights8349 Před rokem +1

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

    • @juleslevy3662
      @juleslevy3662 Před 2 měsíci

      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-so7gc3eu2d
    @user-so7gc3eu2d Před rokem

    even i type correct password and username login failed is shown

  • @mikepenprogrammer2652

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

  • @user-wc6be7ni4c
    @user-wc6be7ni4c Před rokem +1

    "Secure"
    SQL Injection laughing at the corner:

  • @Wavyrezzz
    @Wavyrezzz Před 11 měsíci

    How do we add this to our exe

  • @HingalshDealer
    @HingalshDealer Před 2 měsíci

    didn't get anything but thank ya)

  • @philtoa334
    @philtoa334 Před rokem +1

    Thx_.

  • @RayHorn5128088056
    @RayHorn5128088056 Před rokem +16

    Calling unsalted sha256 secure is a joke. Lol.

    • @amosrocha6793
      @amosrocha6793 Před 5 měsíci +1

      How Can I learn about this top more. ?

  • @essa88371
    @essa88371 Před rokem

    wow

  • @dhruvkumarpal2631
    @dhruvkumarpal2631 Před rokem

    It is showing error

  • @ChadDeveloper
    @ChadDeveloper Před 2 měsíci

    Hashlib was yanked bruh

  • @ironislife9857
    @ironislife9857 Před rokem

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

  • @HoboSquirrel12
    @HoboSquirrel12 Před rokem

    Would be safer to salt the password before hashing it

  • @manofqwerty
    @manofqwerty Před 9 měsíci

    It looks like hashlib has been deprecated now

  • @arielspalter7425
    @arielspalter7425 Před rokem

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

    • @temal32
      @temal32 Před rokem

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

    • @arielspalter7425
      @arielspalter7425 Před rokem

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

    • @samsepiol6052
      @samsepiol6052 Před rokem

      @@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.

  • @pobkuk
    @pobkuk Před rokem +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 Před rokem

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

  • @talalkhan7189
    @talalkhan7189 Před rokem +1

    1st one bro

  • @kanwaradnan4849
    @kanwaradnan4849 Před rokem

    Yes first😅

  • @kanwaradnan4849
    @kanwaradnan4849 Před rokem

    First?

  • @talalkhan7189
    @talalkhan7189 Před rokem

    1st comment

  • @dgh25
    @dgh25 Před 9 měsíci

    wtf just happened?

    • @alexlee3402
      @alexlee3402 Před měsícem

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

  • @franklynchukwu3480
    @franklynchukwu3480 Před 2 měsíci

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

  • @OldKing11100
    @OldKing11100 Před rokem +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 Před rokem

      @@__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 Před rokem

      @@__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 Před rokem

      ​@@__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 Před rokem

      @@__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 Před rokem

      @@__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.

  • @jackolantern6172
    @jackolantern6172 Před rokem

    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.