Skip to content

Commit c3b4b0e

Browse files
committed
Enhance hashing and error handling in insecure.py
1 parent 118c605 commit c3b4b0e

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

samples/insecure.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
# Commented out sample to pass scanning
2-
#
3-
#import hashlib
4-
# print("I am very insecure. Bandit thinks so too.")
5-
# #B110
6-
# xs=[1,2,3,4,5,6,7,8]
7-
# try:
8-
# print(xs[7])
9-
# print(xs[8])
10-
# except: pass
1+
Commented out sample to pass scanning
112

12-
# ys=[1, 2, None, None]
13-
# for y in ys:
14-
# try:
15-
# print(str(y+3)) #TypeErrors ahead
16-
# except: continue #not how to handle them
3+
import hashlib
4+
print("I am very insecure. Bandit thinks so too.")
5+
#B110
6+
xs=[1,2,3,4,5,6,7,8]
7+
try:
8+
print(xs[7])
9+
print(xs[8])
10+
except: pass
1711

18-
# #some imports
19-
# import telnetlib
20-
# import ftplib
12+
ys=[1, 2, None, None]
13+
for y in ys:
14+
try:
15+
print(str(y+3)) #TypeErrors ahead
16+
except: continue #not how to handle them
2117

22-
# #B303 and B324
23-
# s = b"I am a string"
24-
# print("MD5: " +hashlib.md5(s).hexdigest())
25-
# print("SHA1: " +hashlib.sha1(s).hexdigest())
26-
# print("SHA256: " +hashlib.sha256(s).hexdigest())
18+
#some imports
19+
import telnetlib
20+
import ftplib
21+
22+
#B303 and B324
23+
s = b"I am a string"
24+
print("MD5: " +hashlib.md5(s).hexdigest())
25+
print("SHA1: " +hashlib.sha1(s).hexdigest())
26+
print("SHA256: " +hashlib.sha256(s).hexdigest())

0 commit comments

Comments
 (0)