Skip to content

Commit 4f25333

Browse files
committed
revised existing code
1 parent 0950fe2 commit 4f25333

14 files changed

+80
-92
lines changed

Secure Password generator.py

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,36 @@
1-
import random
1+
import secrets
2+
import string
23

3-
#->Generate a ten-character password with
4-
#one lowercase character
5-
#one uppercase characteR
6-
#one digits
7-
#one special character.
8-
sr = random.SystemRandom()
4+
# Generate a ten-character password with
5+
# one lowercase character
6+
# one uppercase character
7+
# one digit
8+
# one special character
99

10-
list_ascii=string.ascii_letters+string.digits+string.punctuation
11-
passo=sr.choice(string.punctuation)
12-
passo+=sr.choice(string.ascii_letters)
13-
passo+=sr.choice(string.digits)
14-
passo+="".join(sr.sample(list_ascii,7))
15-
pass_list = list(passo)
16-
sr.shuffle(pass_list)
17-
print("".join(pass_list))
10+
# Create a secure random generator
11+
sr = secrets.SystemRandom()
12+
13+
# Define character sets
14+
lowercase = string.ascii_lowercase
15+
uppercase = string.ascii_uppercase
16+
digits = string.digits
17+
special_characters = string.punctuation
18+
19+
# Ensure each required character type is included
20+
password = [
21+
sr.choice(lowercase),
22+
sr.choice(uppercase),
23+
sr.choice(digits),
24+
sr.choice(special_characters)
25+
]
26+
27+
# Fill the rest of the password length with random characters
28+
remaining_length = 15 - len(password)
29+
all_characters = lowercase + uppercase + digits + special_characters
30+
password += [sr.choice(all_characters) for _ in range(remaining_length)]
31+
32+
# Shuffle the password list to ensure randomness
33+
sr.shuffle(password)
34+
35+
# Convert the list to a string and print the password
36+
print("".join(password))

checking ssl.py renamed to checking website ssl.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import certifi
22
import urllib3
33

4-
54
http = urllib3.PoolManager(
65
cert_reqs = 'CERT_REQUIRED',
76
ca_certs = certifi.where()

file data.py

Lines changed: 0 additions & 12 deletions
This file was deleted.

form data.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

port scanner (simple).py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
s = socket(AF_INET, SOCK_STREAM)
1212
conn = s.connect_ex((t_ip,i))
1313
if conn == 0:
14-
print(f"{i} port is open")
14+
print(f"Port No : {i} is open")
1515
s.close()
1616

1717
print(f"The scanning takes {time.time()-startTime}")

post and put request.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

proxy manager.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

python struct.py

Whitespace-only changes.

shoutdown like a pro.py

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
1-
import os
1+
import os
22
import time
3-
shutdown = input("Do you wish to shutdown your computer ? (yes / no): ")
4-
5-
if shutdown == 'y' or shutdown == 'Y':
6-
info = input(" Now (yes / no): ")
7-
if info == "y" or info=="Y":
8-
print("Y")
9-
os.system("shutdown /s /t 1")
10-
print(f"Bye Bye")
11-
time.sleep(1)
3+
4+
shutdown = input("Do you wish to shutdown your computer? (yes / no): ").strip().lower()
5+
6+
if shutdown == 'yes':
7+
info = input("Now? (yes / no): ").strip().lower()
8+
if info == 'yes':
9+
print("Shutting down immediately...")
10+
os.system("shutdown /s /t 1")
11+
print("Bye Bye")
12+
time.sleep(1)
1213
else:
13-
info2 = int(input("How many minuets leter ? ") )
14-
try:
15-
print(f"You will be shutdown after {info2} minuets")
16-
os.system(f"shutdown /s /t {info2*60}")
17-
time.sleep(1)
18-
except:
19-
print(f"Input error or you changed mind? please try leter")
20-
time.sleep(2)
21-
else:
22-
exit()
14+
try:
15+
info2 = int(input("How many minutes later? ").strip())
16+
print(f"You will be shut down after {info2} minutes")
17+
os.system(f"shutdown /s /t {info2 * 60}")
18+
time.sleep(1)
19+
except ValueError:
20+
print("Input error or you changed your mind? Please try again later.")
21+
time.sleep(2)
22+
else:
23+
print("Shutdown canceled.")
24+
exit()

simple agrument from terminal.py

Lines changed: 0 additions & 6 deletions
This file was deleted.
File renamed without changes.

sys.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

system info.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import sys
2+
import psutil
3+
4+
print(f"Your platform or OS is {sys.platform}")
5+
6+
print(f"Your PC RAM is {psutil.virtual_memory().total / 1e+9:.2f} GB")
7+
print(f"Your PC CPU is {psutil.cpu_count()} cores")
8+
print(f"Your PC CPU frequency is {psutil.cpu_freq().current:.2f} MHz")
9+
print(f"Your PC CPU usage is {psutil.cpu_percent(interval=1)} %")
10+
11+
disk_usage = psutil.disk_usage('/')
12+
print(f"Your PC disk usage is {disk_usage.percent} %")
13+
print(f"Your PC disk total is {disk_usage.total / 1e+9:.2f} GB")
14+
print(f"Your PC disk used is {disk_usage.used / 1e+9:.2f} GB")
15+
print(f"Your PC disk free is {disk_usage.free / 1e+9:.2f} GB")
16+
17+
disk_io = psutil.disk_io_counters()
18+
print(f"Your PC disk read count is {disk_io.read_count}")
19+
print(f"Your PC disk write count is {disk_io.write_count}")
20+
print(f"Your PC disk read bytes is {disk_io.read_bytes / 1e+9:.2f} GB")
21+
print(f"Your PC disk write bytes is {disk_io.write_bytes / 1e+9:.2f} GB")
22+
print(f"Your PC disk read time is {disk_io.read_time} ms")
23+
print(f"Your PC disk write time is {disk_io.write_time} ms")

url_lib3.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)