Sinisterly
Vulnerable Login System - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: Python (https://sinister.ly/Forum-Python)
+--- Thread: Vulnerable Login System (/Thread-Vulnerable-Login-System)



Vulnerable Login System - Adorapuff - 12-16-2013

I made this because I was bored, and will further secure it later, but if anyone wants to test their mad bruteforcing tools, this has no maximum tries per ip nor username. The only security implemented is the hashing and salting of passwords on input. Do with this as you please.

Reg.py
Code:
import hashlib username = raw_input("Username: ") key_string = raw_input("Password: ") salt = "1337ELITES4LTD4T1ZUNGEUSSABLE" hash = hashlib.md5( salt + key_string ).hexdigest() print "%s:%s" % (salt, hash) db = open("db.txt", "w+") db.write("%s:%s" % (username, hash))

Login.py
Code:
import hashlib username = raw_input("Username: ") key_string = raw_input("Password: ") salt = "1337ELITES4LTD4T1ZUNGEUSSABLE" hash = hashlib.md5( salt + key_string ).hexdigest() fin = str(username + ":" + hash) with open('db.txt', 'r') as searchfile: for line in searchfile: if fin in line: print "Login Success" else: print "Error"



RE: Vulnerable Login System - Llebacc - 12-21-2013

Neat. Also, this is trivial, but do you know of the str.format() method? It's being pushed as the new standard in Python3.

Instead of
Code:
string = "%s this %s that" % (foo, bar)

It's shifting to
Code:
string = "{0} this {1} that".format(foo, bar)

Pretty unrelated, I know, but I just thought I'd mention.


RE: Vulnerable Login System - Adorapuff - 12-22-2013

(12-21-2013, 06:50 PM)Llebacc Wrote: Neat. Also, this is trivial, but do you know of the str.format() method? It's being pushed as the new standard in Python3.

Instead of
Code:
string = "%s this %s that" % (foo, bar)

It's shifting to
Code:
string = "{0} this {1} that".format(foo, bar)

Pretty unrelated, I know, but I just thought I'd mention.

Thank you and fuck python 3


RE: Vulnerable Login System - Llebacc - 12-22-2013

(12-22-2013, 04:50 AM)Adorapuff Wrote: Thank you and fuck python 3

You're welcome.


RE: Vulnerable Login System - w00t - 12-22-2013

I've never seen someone do that, and that seems kind of backwards. Like, I know I can add two numbers with x.__add__(2), but I know x + 2 is a shorter and more readable way to do it.


RE: Vulnerable Login System - Llebacc - 12-22-2013

(12-22-2013, 06:27 PM)w00t Wrote: I've never seen someone do that, and that seems kind of backwards. Like, I know I can add two numbers with x.__add__(2), but I know x + 2 is a shorter and more readable way to do it.

Yeah, I'm not totally sure why the change is being made. I think it has to do with getting it lumped in with the rest of the string formatting tools in a more unionized way. I thought the previous way to do it was fine but whenever I write in Python3 I just do str.format. I'm sure the devs looked at the original and went "You know what? This isn't pythonic enough." and went for the change, like usual. That said, I don't really mind using str.format over the other form if I'm working with Python 3.