Skip to content

Commit 1a2e0a9

Browse files
Merge pull request avinashkranjan#2931 from Kalivarapubindusree/jim
Motor_Control script added
2 parents acf90ea + 4c61931 commit 1a2e0a9

File tree

12 files changed

+332
-0
lines changed

12 files changed

+332
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import sqlite3
2+
3+
def create_table(connection):
4+
cursor = connection.cursor()
5+
cursor.execute('''CREATE TABLE IF NOT EXISTS employees (
6+
id INTEGER PRIMARY KEY,
7+
name TEXT,
8+
position TEXT,
9+
salary REAL
10+
)''')
11+
connection.commit()
12+
13+
def insert_data(connection, name, position, salary):
14+
cursor = connection.cursor()
15+
cursor.execute("INSERT INTO employees (name, position, salary) VALUES (?, ?, ?)",
16+
(name, position, salary))
17+
connection.commit()
18+
19+
def update_salary(connection, employee_id, new_salary):
20+
cursor = connection.cursor()
21+
cursor.execute("UPDATE employees SET salary = ? WHERE id = ?", (new_salary, employee_id))
22+
connection.commit()
23+
24+
def query_data(connection):
25+
cursor = connection.cursor()
26+
cursor.execute("SELECT * FROM employees")
27+
rows = cursor.fetchall()
28+
29+
print("\nEmployee Data:")
30+
for row in rows:
31+
print(f"ID: {row[0]}, Name: {row[1]}, Position: {row[2]}, Salary: {row[3]}")
32+
33+
if __name__ == "__main__":
34+
database_name = "employee_database.db"
35+
36+
connection = sqlite3.connect(database_name)
37+
print(f"Connected to {database_name}")
38+
39+
create_table(connection)
40+
41+
insert_data(connection, "John Doe", "Software Engineer", 75000.0)
42+
insert_data(connection, "Jane Smith", "Data Analyst", 60000.0)
43+
44+
print("\nAfter Insertions:")
45+
query_data(connection)
46+
47+
update_salary(connection, 1, 80000.0)
48+
49+
print("\nAfter Update:")
50+
query_data(connection)
51+
52+
connection.close()
53+
print(f"Connection to {database_name} closed.")

Database_Interaction/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Database_Interaction
2+
3+
Short description of package/script
4+
5+
- This Script Was simple to setup
6+
- Need import sqlite3
7+
8+
9+
## Setup instructions
10+
11+
12+
Just Need to run this command "pip install sqlite3" then run Databse_Interaction.py file and for running python3 is must be installed!
13+
14+
## Detailed explanation of script, if needed
15+
16+
This Script Is Only for Database_Interaction use only!

Forced_Browse/Forced_Browse.py

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
2+
import sys
3+
import time
4+
import requests
5+
from concurrent.futures import ThreadPoolExecutor as executor
6+
from optparse import OptionParser
7+
8+
def printer(word):
9+
sys.stdout.write(word + " \r")
10+
sys.stdout.flush()
11+
return True
12+
13+
yellow = "\033[93m"
14+
green = "\033[92m"
15+
blue = "\033[94m"
16+
red = "\033[91m"
17+
bold = "\033[1m"
18+
end = "\033[0m"
19+
20+
def check_status(domain, url):
21+
if not url or url.startswith("#") or len(url) > 30:
22+
return False
23+
24+
printer("Testing: " + domain + url)
25+
try:
26+
link = domain + url
27+
req = requests.head(link)
28+
st = str(req.status_code)
29+
if st.startswith(("2", "1")):
30+
print(green + "[+] " + st + " | Found: " + end + "[ " + url + " ]" + " \r")
31+
elif st.startswith("3"):
32+
link = req.headers['Location']
33+
print(yellow + "[*] " + st + " | Redirection From: " + end + "[ " + url + " ]" + yellow + " -> " + end + "[ " + link + " ]" + " \r")
34+
elif st.startswith("4"):
35+
if st != '404':
36+
print(blue + "[!] " + st + " | Found: " + end + "[ " + url + " ]" + " \r")
37+
return True
38+
except Exception:
39+
return False
40+
41+
def presearch(domain, ext, url):
42+
if ext == 'Null' or ext == 'None':
43+
check_status(domain, url)
44+
elif url and not url.isspace():
45+
ext_list = [ext] if ext != "None" else [""]
46+
for i in ext_list:
47+
link = url if not i else url + "." + str(i)
48+
check_status(domain, link)
49+
50+
def main():
51+
parser = OptionParser(green + """
52+
#Usage:""" + yellow + """
53+
-t target host
54+
-w wordlist
55+
-d thread number (Optional, Default: 10)
56+
-e extensions (Optional, ex: html,php)
57+
""" + green + """
58+
#Example:""" + yellow + """
59+
python3 dirbrute.py -t domain.com -w dirlist.txt -d 20 -e php,html
60+
""" + end)
61+
62+
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")
67+
(options, _) = parser.parse_args()
68+
69+
if not options.target or not options.wordlist:
70+
print(parser.usage)
71+
exit(1)
72+
73+
target = options.target
74+
wordlist = options.wordlist
75+
thread = options.thread if options.thread else 10
76+
ext = options.extension if options.extension else "Null"
77+
78+
target = target if target.startswith("http") else "http://" + target
79+
target = target if target.endswith("/") else target + "/"
80+
81+
print("[" + yellow + bold + "Info" + end + "]:\n")
82+
print(blue + "[" + red + "+" + blue + "] Target: " + end + target)
83+
print(blue + "[" + red + "+" + blue + "] File: " + end + wordlist)
84+
print(blue + "[" + red + "+" + blue + "] Thread: " + end + str(thread))
85+
print(blue + "[" + red + "+" + blue + "] Extension: " + end + str(ext))
86+
print("\n[" + yellow + bold + "Start Searching" + end + "]:\n")
87+
88+
ext_list = ext.split(",") if ext != "Null" else ["Null"]
89+
with open(wordlist, 'r') as urls:
90+
with executor(max_workers=int(thread)) as exe:
91+
jobs = [exe.submit(presearch, target, ext, url.strip('\n')) for url in urls]
92+
93+
took = (time.time() - start) / 60
94+
print(red + "Took: " + end + f"{round(took, 2)} m" + " \r")
95+
96+
print("\n\t* Happy Hacking *")
97+
98+
except Exception as e:
99+
print(red + "#Error: " + end + str(e))
100+
exit(1)
101+
102+
if __name__ == '__main__':
103+
start = time.time()
104+
main()

Forced_Browse/README.md

Whitespace-only changes.

Motor_Control/Motor_Control.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import RPi.GPIO as GPIO
2+
import time
3+
4+
# Set the GPIO mode to BCM
5+
GPIO.setmode(GPIO.BCM)
6+
7+
# Define the GPIO pin for the servo motor
8+
servo_pin = 18
9+
10+
# Set up the GPIO pin for PWM
11+
GPIO.setup(servo_pin, GPIO.OUT)
12+
pwm = GPIO.PWM(servo_pin, 50) # 50 Hz PWM frequency
13+
14+
def set_servo_position(angle):
15+
duty_cycle = angle / 18 + 2 # Map angle to duty cycle
16+
pwm.ChangeDutyCycle(duty_cycle)
17+
time.sleep(0.5) # Give time for the servo to move
18+
19+
if __name__ == "__main__":
20+
try:
21+
pwm.start(0) # Start with 0% duty cycle (0 degrees)
22+
print("Servo motor control started. Press Ctrl+C to stop.")
23+
24+
while True:
25+
angle = float(input("Enter angle (0 to 180 degrees): "))
26+
if 0 <= angle <= 180:
27+
set_servo_position(angle)
28+
else:
29+
print("Invalid angle. Angle must be between 0 and 180 degrees.")
30+
31+
except KeyboardInterrupt:
32+
print("\nServo motor control stopped.")
33+
pwm.stop()
34+
GPIO.cleanup()

Motor_Control/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Motor_Control
2+
3+
Short description of package/script
4+
5+
- This Script Was simple to setup
6+
- Need import RPi.GPIO,time
7+
8+
9+
## Setup instructions
10+
11+
12+
Just Need to run this command "pip install RPi.GPIO " then run Motor_Control.py file and for running python3 is must be installed!
13+
14+
## Detailed explanation of script, if needed
15+
16+
This Script Is Only for Motor_Control use only!
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import ping3
2+
import time
3+
4+
def ping_servers(server_list):
5+
while True:
6+
for server in server_list:
7+
response_time = ping3.ping(server)
8+
if response_time is not None:
9+
print(f"{server} is up (Response Time: {response_time} ms)")
10+
else:
11+
print(f"{server} is down! ALERT!")
12+
13+
time.sleep(60) # Ping every 60 seconds
14+
15+
if __name__ == "__main__":
16+
servers_to_monitor = ["google.com", "example.com", "localhost"]
17+
18+
print("Network Monitoring Script")
19+
print("Press Ctrl+C to stop monitoring")
20+
21+
try:
22+
ping_servers(servers_to_monitor)
23+
except KeyboardInterrupt:
24+
print("\nMonitoring stopped.")

Network_Monitoring/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Network_Monitoring
2+
3+
Short description of package/script
4+
5+
- This Script Was simple to setup
6+
- Need import ping3,time
7+
8+
9+
## Setup instructions
10+
11+
12+
Just Need to run this command "pip install ping3" then run the Network_Monitoring.py file and for running python3 is must be installed!
13+
14+
## Detailed explanation of script, if needed
15+
16+
This Script Is Only for Network_Monitoring use only!

OS_interaction/OS_interaction.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import psutil
2+
import time
3+
import os
4+
5+
def monitor_cpu_threshold(threshold):
6+
while True:
7+
cpu_percent = psutil.cpu_percent(interval=1)
8+
print(f"Current CPU Usage: {cpu_percent}%")
9+
10+
if cpu_percent > threshold:
11+
print("CPU usage exceeds threshold!")
12+
# You can add more actions here, such as sending an email or notification.
13+
# For simplicity, we'll just print an alert message.
14+
os.system("say 'High CPU usage detected!'") # macOS command to speak the message
15+
16+
time.sleep(10) # Wait for 10 seconds before checking again
17+
18+
if __name__ == "__main__":
19+
threshold_percent = 80 # Define the CPU usage threshold in percentage
20+
monitor_cpu_threshold(threshold_percent)

OS_interaction/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# OS_interaction script
2+
3+
Short description of package/script
4+
5+
- This Script Was simple to setup
6+
- Need import psutil,time,os
7+
8+
9+
## Setup instructions
10+
11+
12+
Just Need to import psutil,time,os then run the OS_interaction.py file and for running python3 is must be installed!
13+
14+
## Detailed explanation of script, if needed
15+
16+
This Script Is Only for OS_interaction use only!
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Version_control_automation_script
2+
3+
Short description of package/script
4+
5+
- This Script Was simple to setup
6+
- Need import subprocess module to interact
7+
8+
9+
## Setup instructions
10+
11+
12+
Just Need to import subprocess module and then run the Version_control_automation_script.py file and for running python3 is must be installed!
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import subprocess
2+
3+
def create_and_commit_branch(branch_name, commit_message):
4+
# Create a new branch
5+
subprocess.run(["git", "checkout", "-b", branch_name])
6+
7+
# Make changes to files (modify, add, remove)
8+
# ...
9+
10+
# Commit the changes
11+
subprocess.run(["git", "add", "."])
12+
subprocess.run(["git", "commit", "-m", commit_message])
13+
14+
# Push the changes to the remote repository
15+
subprocess.run(["git", "push", "origin", branch_name])
16+
17+
if __name__ == "__main__":
18+
new_branch_name = "feature/awesome-feature"
19+
commit_msg = "Added an awesome feature"
20+
21+
create_and_commit_branch(new_branch_name, commit_msg)

0 commit comments

Comments
 (0)