-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgeneral.py
More file actions
115 lines (95 loc) · 3.67 KB
/
Copy pathgeneral.py
File metadata and controls
115 lines (95 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
import pandas as pd
import schedule
import threading
import socket
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from datetime import datetime
# Function to import CSV file
def import_csv(file_path):
return pd.read_csv(file_path)
# Function to export DataFrame to CSV file
def export_csv(df, file_path):
df.to_csv(file_path, index=False)
# Function to analyze data
def analyze_data(df):
# Placeholder for AI analysis
print("AI Analysis Placeholder")
# Add your AI model analysis here
# Function to analyze accounting data
def analyze_accounting_data(df):
gross_amount = df['Gross Amount'].sum()
net_amount = df['Net Amount'].sum()
fees = df['Fees'].sum()
materials = df['Materials'].sum()
labor_costs = df['Labor Costs'].sum()
overheads = df['Overheads'].sum()
print(f'The total gross amount is: {gross_amount}')
print(f'The total net amount is: {net_amount}')
print(f'The total fees are: {fees}')
print(f'Total materials cost is: {materials}')
print(f'Total labor costs are: {labor_costs}')
print(f'Total overheads are: {overheads}')
print(f'Net amount minus materials, labor, and overheads: {net_amount - materials - labor_costs - overheads}')
# Task scheduling and reminders
def schedule_task(task, time):
schedule.every().day.at(time).do(task)
def send_reminder(email, task):
msg = MIMEMultipart()
msg['From'] = 'your_email@example.com'
msg['To'] = email
msg['Subject'] = 'Task Reminder'
body = f'Reminder to complete: {task}'
msg.attach(MIMEText(body, 'plain'))
with smtplib.SMTP('smtp.example.com', 587) as server:
server.starttls()
server.login(msg['From'], 'your_password')
server.sendmail(msg['From'], msg['To'], msg.as_string())
def start_scheduler():
while True:
schedule.run_pending()
# Function to schedule breaks
def schedule_breaks(email):
for hour in range(9, 17): # Working hours from 9 AM to 5 PM
schedule_task(lambda: send_reminder(email, 'Take a 15-minute break to stretch'), f'{hour}:45')
# Employee efficiency tracking
def log_efficiency(employee_data):
efficiency_df = pd.DataFrame(employee_data)
decline_flag = efficiency_df['Efficiency'].pct_change().fillna(0) < -0.1
if decline_flag.any():
print("Alert: Significant decline in efficiency detected.")
# Further actions can be implemented here
# Security monitoring
def monitor_network():
open_ports = []
target = 'your_target_ip_or_hostname'
for port in range(1, 1025):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
result = sock.connect_ex((target, port))
if result == 0:
open_ports.append(port)
sock.close()
print(f'Open ports: {open_ports}')
if open_ports:
send_security_alert(open_ports)
def send_security_alert(open_ports):
alert_message = f'Open ports detected: {open_ports}'
print(alert_message)
# Email alert can be sent here similarly as in send_reminder function
# Example usage
if __name__ == "__main__":
# Import CSV files
df_main = import_csv('Blank.csv')
# Analyze accounting data
analyze_accounting_data(df_main)
# Schedule tasks with reminders
user_email = 'your_email@example.com'
schedule_task(lambda: send_reminder(user_email, 'Complete task A'), '14:00')
schedule_breaks(user_email)
threading.Thread(target=start_scheduler).start()
# Log employee efficiency
employee_data = [{'Employee': 'John', 'Efficiency': 0.9}, {'Employee': 'Doe', 'Efficiency': 0.8}]
log_efficiency(employee_data)
# Monitor network
threading.Thread(target=monitor_network).start()