-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfile_writer.py
More file actions
executable file
·32 lines (25 loc) · 851 Bytes
/
file_writer.py
File metadata and controls
executable file
·32 lines (25 loc) · 851 Bytes
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
import os
from datetime import datetime
class File_writer():
def logAppend(self, data):
today = datetime.now()
day = today.day
if day < 10:
day = '0{}'.format(day)
month = today.month
if month < 10:
month = '0{}'.format(month)
year = today.year
hour = today.hour
if hour < 10:
hour = '0{}'.format(hour)
minute = today.minute
if minute < 10:
minute = '0{}'.format(minute)
second = today.second
if second < 10:
second = '0{}'.format(second)
with open('ddosreporter.log', 'a') as f:
f.write('{}/{}/{} {}:{}:{} - {}'.format(
day, month, year, hour, minute, second, data))
os.chmod('ddosreporter.log', 0o644) # permisões para o arquivo de log