Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5351222

Browse files
style: format code with autopep8
Format code with autopep8 This commit fixes the style issues introduced in 1a2e0a9 according to the output from Autopep8. Details: None
1 parent a164133 commit 5351222

File tree

6 files changed

+44
-13
lines changed

6 files changed

+44
-13
lines changed

‎Database_Interaction/Databse_Interaction.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import sqlite3
22

3+
34
def create_table(connection):
45
cursor = connection.cursor()
56
cursor.execute('''CREATE TABLE IF NOT EXISTS employees (
@@ -10,25 +11,31 @@ def create_table(connection):
1011
)''')
1112
connection.commit()
1213

14+
1315
def insert_data(connection, name, position, salary):
1416
cursor = connection.cursor()
1517
cursor.execute("INSERT INTO employees (name, position, salary) VALUES (?, ?, ?)",
1618
(name, position, salary))
1719
connection.commit()
1820

21+
1922
def update_salary(connection, employee_id, new_salary):
2023
cursor = connection.cursor()
21-
cursor.execute("UPDATE employees SET salary = ? WHERE id = ?", (new_salary, employee_id))
24+
cursor.execute("UPDATE employees SET salary = ? WHERE id = ?",
25+
(new_salary, employee_id))
2226
connection.commit()
2327

28+
2429
def query_data(connection):
2530
cursor = connection.cursor()
2631
cursor.execute("SELECT * FROM employees")
2732
rows = cursor.fetchall()
2833

2934
print("\nEmployee Data:")
3035
for row in rows:
31-
print(f"ID: {row[0]}, Name: {row[1]}, Position: {row[2]}, Salary: {row[3]}")
36+
print(
37+
f"ID: {row[0]}, Name: {row[1]}, Position: {row[2]}, Salary: {row[3]}")
38+
3239

3340
if __name__ == "__main__":
3441
database_name = "employee_database.db"

‎Forced_Browse/Forced_Browse.py

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,46 @@
55
from concurrent.futures import ThreadPoolExecutor as executor
66
from optparse import OptionParser
77

8+
89
def printer(word):
910
sys.stdout.write(word + " \r")
1011
sys.stdout.flush()
1112
return True
1213

14+
1315
yellow = "033円[93m"
1416
green = "033円[92m"
1517
blue = "033円[94m"
1618
red = "033円[91m"
1719
bold = "033円[1m"
1820
end = "033円[0m"
1921

22+
2023
def check_status(domain, url):
2124
if not url or url.startswith("#") or len(url) > 30:
2225
return False
23-
26+
2427
printer("Testing: " + domain + url)
2528
try:
2629
link = domain + url
2730
req = requests.head(link)
2831
st = str(req.status_code)
2932
if st.startswith(("2", "1")):
30-
print(green + "[+] " + st + " | Found: " + end + "[ " + url + " ]" + " \r")
33+
print(green + "[+] " + st + " | Found: " + end + "[ " + url +
34+
" ]" + " \r")
3135
elif st.startswith("3"):
3236
link = req.headers['Location']
33-
print(yellow + "[*] " + st + " | Redirection From: " + end + "[ " + url + " ]" + yellow + " -> " + end + "[ " + link + " ]" + " \r")
37+
print(yellow + "[*] " + st + " | Redirection From: " + end + "[ " + url + " ]" + yellow +
38+
" -> " + end + "[ " + link + " ]" + " \r")
3439
elif st.startswith("4"):
3540
if st != '404':
36-
print(blue + "[!] " + st + " | Found: " + end + "[ " + url + " ]" + " \r")
41+
print(blue + "[!] " + st + " | Found: " + end + "[ " + url +
42+
" ]" + " \r")
3743
return True
3844
except Exception:
3945
return False
4046

47+
4148
def presearch(domain, ext, url):
4249
if ext == 'Null' or ext == 'None':
4350
check_status(domain, url)
@@ -47,6 +54,7 @@ def presearch(domain, ext, url):
4754
link = url if not i else url + "." + str(i)
4855
check_status(domain, link)
4956

57+
5058
def main():
5159
parser = OptionParser(green + """
5260
#Usage:""" + yellow + """
@@ -60,10 +68,14 @@ def main():
6068
""" + end)
6169

6270
try:
63-
parser.add_option("-t", dest="target", type="string", help="the target domain")
64-
parser.add_option("-w", dest="wordlist", type="string", help="wordlist file")
65-
parser.add_option("-d", dest="thread", type="int", help="the thread number")
66-
parser.add_option("-e", dest="extension", type="string", help="the extensions")
71+
parser.add_option("-t", dest="target", type="string",
72+
help="the target domain")
73+
parser.add_option("-w", dest="wordlist",
74+
type="string", help="wordlist file")
75+
parser.add_option("-d", dest="thread", type="int",
76+
help="the thread number")
77+
parser.add_option("-e", dest="extension",
78+
type="string", help="the extensions")
6779
(options, _) = parser.parse_args()
6880

6981
if not options.target or not options.wordlist:
@@ -88,17 +100,20 @@ def main():
88100
ext_list = ext.split(",") if ext != "Null" else ["Null"]
89101
with open(wordlist, 'r') as urls:
90102
with executor(max_workers=int(thread)) as exe:
91-
jobs = [exe.submit(presearch, target, ext, url.strip('\n')) for url in urls]
103+
jobs = [exe.submit(presearch, target, ext,
104+
url.strip('\n')) for url in urls]
92105

93106
took = (time.time() - start) / 60
94-
print(red + "Took: " + end + f"{round(took, 2)} m" + " \r")
107+
print(red + "Took: " + end +
108+
f"{round(took, 2)} m" + " \r")
95109

96110
print("\n\t* Happy Hacking *")
97111

98112
except Exception as e:
99113
print(red + "#Error: " + end + str(e))
100114
exit(1)
101115

116+
102117
if __name__ == '__main__':
103118
start = time.time()
104119
main()

‎Motor_Control/Motor_Control.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111
GPIO.setup(servo_pin, GPIO.OUT)
1212
pwm = GPIO.PWM(servo_pin, 50) # 50 Hz PWM frequency
1313

14+
1415
def set_servo_position(angle):
1516
duty_cycle = angle / 18 + 2 # Map angle to duty cycle
1617
pwm.ChangeDutyCycle(duty_cycle)
1718
time.sleep(0.5) # Give time for the servo to move
1819

20+
1921
if __name__ == "__main__":
2022
try:
2123
pwm.start(0) # Start with 0% duty cycle (0 degrees)

‎Network_Monitoring/Network_Monitoring.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import ping3
22
import time
33

4+
45
def ping_servers(server_list):
56
while True:
67
for server in server_list:
@@ -12,6 +13,7 @@ def ping_servers(server_list):
1213

1314
time.sleep(60) # Ping every 60 seconds
1415

16+
1517
if __name__ == "__main__":
1618
servers_to_monitor = ["google.com", "example.com", "localhost"]
1719

‎OS_interaction/OS_interaction.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import time
33
import os
44

5+
56
def monitor_cpu_threshold(threshold):
67
while True:
78
cpu_percent = psutil.cpu_percent(interval=1)
@@ -11,10 +12,12 @@ def monitor_cpu_threshold(threshold):
1112
print("CPU usage exceeds threshold!")
1213
# You can add more actions here, such as sending an email or notification.
1314
# For simplicity, we'll just print an alert message.
14-
os.system("say 'High CPU usage detected!'") # macOS command to speak the message
15+
# macOS command to speak the message
16+
os.system("say 'High CPU usage detected!'")
1517

1618
time.sleep(10) # Wait for 10 seconds before checking again
1719

20+
1821
if __name__ == "__main__":
1922
threshold_percent = 80 # Define the CPU usage threshold in percentage
2023
monitor_cpu_threshold(threshold_percent)

‎version_control_automation_script/version_control_automation_script.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import subprocess
22

3+
34
def create_and_commit_branch(branch_name, commit_message):
45
# Create a new branch
56
subprocess.run(["git", "checkout", "-b", branch_name])
@@ -14,6 +15,7 @@ def create_and_commit_branch(branch_name, commit_message):
1415
# Push the changes to the remote repository
1516
subprocess.run(["git", "push", "origin", branch_name])
1617

18+
1719
if __name__ == "__main__":
1820
new_branch_name = "feature/awesome-feature"
1921
commit_msg = "Added an awesome feature"

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /