s.listen(1) MAX_LINE = 1024 while 1: conn, addr = s.accept() print("Connection from {}".format(addr)) with conn.makefile() as f: line = f.readline(MAX_LINE + 1) if len(line) > MAX_LINE: raise ValueError("line too long") print(line) conn.close()
Validierung von CA-Certs (Grundeinstellung) • geplant für Python 3.4 – CA Certificate Bundle von NSS (Mozilla) – Anbindung an CA-Store von Windows und Mac OS X – X.509 Typ, CA Chain API
present should allow cert signing */ if(ku_reject(x, KU_KEY_CERT_SIGN)) return 0; if(x->ex_flags & EXFLAG_BCONS) { if(x->ex_flags & EXFLAG_CA) return 1; /* If basicConstraints says not a CA then say so */ else return 0; } else { /* we support V1 roots for... uh, I don't really know why. */ if((x->ex_flags & V1_ROOT) == V1_ROOT) return 3; /* If key usage present it must have certSign so tolerate it */ else if (x->ex_flags & EXFLAG_KUSAGE) return 4; /* Older certificates could have Netscape-specific CA types */ else if (x->ex_flags & EXFLAG_NSCERT && x->ex_nscert & NS_ANY_CA) return 5; /* can this still be regarded a CA certificate? I doubt it */ return 0; } }
... print(unicodedata.name(c)) ... CYRILLIC CAPITAL LETTER ER CYRILLIC SMALL LETTER U LATIN SMALL LETTER T LATIN SMALL LETTER H GREEK SMALL LETTER OMICRON LATIN SMALL LETTER N
import os filename = 'example.txt' if not os.path.isfile(filename): # file does not exist, create it with open(filename, 'w') as f: f.write('example') Angriff (unpriviligiert) $ ln -s /etc/passwd example.txt $ cat /etc/passwd example
ext.add("You have been hacked!") >>> new_message, new_digest = ext.final() >>> new_message '3. Deutsche Python-Konferenz\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x28 You have been hacked!' >>> new_digest '913ade7a09bb0506a5912169806f9bca2e93b506' >>> hashlib.new("sha1", secret + new_message).hexdigest() '913ade7a09bb0506a5912169806f9bca2e93b506'