Secure Login System in Python

Поделиться
HTML-код
  • Опубликовано: 31 янв 2025
  • НаукаНаука

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

  • @hussainbabonji4207
    @hussainbabonji4207 2 года назад +24

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

  • @chrism6880
    @chrism6880 2 года назад +30

    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 года назад +3

      That’s right 👍

    • @pobkuk
      @pobkuk 2 года назад +9

      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 Год назад +1

      @@pobkuk nerd

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

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

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

    This channel deserves more subscribers!

  • @sherazmalik5155
    @sherazmalik5155 8 месяцев назад +1

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

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

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

  • @johnecott7429
    @johnecott7429 2 года назад +3

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

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

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

  • @servetbirgul
    @servetbirgul 2 года назад +1

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

    • @servetbirgul
      @servetbirgul 2 года назад

      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

    • @servetbirgul
      @servetbirgul 2 года назад

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

  • @fredericoamigo
    @fredericoamigo Год назад +5

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

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

    Always quality content

  • @rougebarbu
    @rougebarbu 2 года назад +4

    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 2 года назад

      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 2 года назад +1

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

    • @dslnoob7140
      @dslnoob7140 2 года назад

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

  • @dmitrykononenko6411
    @dmitrykononenko6411 2 года назад +2

    What do you think of password salt?

  • @youssefalkhodary
    @youssefalkhodary 2 года назад +1

    you are awesome ❤️

  • @IlyesCodes
    @IlyesCodes 2 года назад

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

  • @paulthomas1052
    @paulthomas1052 2 года назад +1

    Great video, cheers.

  • @פלוניפלוני-צ2ט
    @פלוניפלוני-צ2ט 2 года назад +2

    Did you uploaded these project files to your github?

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

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

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

    I love your videos.

  • @tishajindal5684
    @tishajindal5684 6 месяцев назад +2

    how u implement the command in userdata.db at 5:09

  • @jackfr0st486
    @jackfr0st486 2 года назад +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 2 года назад +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 2 года назад

      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 2 года назад

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

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

    Nice one bro

  • @OldKing11100
    @OldKing11100 2 года назад +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 2 года назад

      @@__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 2 года назад

      @@__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 2 года назад

      ​@@__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 2 года назад

      @@__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 2 года назад

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

  • @NicksOnTheStyx
    @NicksOnTheStyx 2 года назад +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.

  • @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?

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

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

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

      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()

  • @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??

  • @craab9utube
    @craab9utube 2 года назад

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

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

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

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

    I would suggest a unique salt added to the passwords

  • @servetbirgul
    @servetbirgul 2 года назад

    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

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

    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.

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

    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?

  • @cyb3ersounds
    @cyb3ersounds 8 месяцев назад

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

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

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

  • @Mjuziks
    @Mjuziks 2 года назад

    thank you

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

  • @mikepenprogrammer2652
    @mikepenprogrammer2652 2 года назад

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

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

    [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

  • @MOVIESHORT854
    @MOVIESHORT854 2 года назад +1

    pythone is so simple in context

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

    "Secure"
    SQL Injection laughing at the corner:

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

    intro song name?

  • @ShreyasBhosle-y2k
    @ShreyasBhosle-y2k Год назад

    even i type correct password and username login failed is shown

  • @mateusz7612
    @mateusz7612 2 года назад

    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.

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

    How do we add this to our exe

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

    It is showing error

  • @TheWeiserhelge
    @TheWeiserhelge 4 месяца назад

    Nothing of this is actually working, thats sad and even that you dont tell what kind of extras we need to this is just..... i was joyfull coding and when i tried to run always problems appear and i did it same was as you ...

  • @RayHorn5128088056
    @RayHorn5128088056 2 года назад +20

    Calling unsalted sha256 secure is a joke. Lol.

  • @tcgvsocg1458
    @tcgvsocg1458 2 года назад +1

    interesting

  • @bigschweetie
    @bigschweetie 2 года назад

    Would be safer to salt the password before hashing it

    • @dslnoob7140
      @dslnoob7140 2 года назад

      The answer is definitely yes.

  • @pobkuk
    @pobkuk 2 года назад +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.

  • @arielspalter7425
    @arielspalter7425 2 года назад

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

    • @temal32
      @temal32 2 года назад

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

    • @arielspalter7425
      @arielspalter7425 2 года назад

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

    • @samsepiol6052
      @samsepiol6052 2 года назад

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

  • @ironislife9857
    @ironislife9857 2 года назад

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

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

    didn't get anything but thank ya)

  • @philtoa334
    @philtoa334 2 года назад +1

    Thx_.

  • @essa88371
    @essa88371 2 года назад

    wow

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

    It looks like hashlib has been deprecated now

  • @Dragonforge-Studios
    @Dragonforge-Studios 10 месяцев назад

    Hashlib was yanked bruh

  • @talalkhan7189
    @talalkhan7189 2 года назад +1

    1st one bro

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

    wtf just happened?

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

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

  • @kanwaradnan4849
    @kanwaradnan4849 2 года назад

    Yes first😅

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

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

  • @talalkhan7189
    @talalkhan7189 2 года назад

    1st comment

  • @kanwaradnan4849
    @kanwaradnan4849 2 года назад

    First?

  • @jackolantern6172
    @jackolantern6172 2 года назад

    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.