-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
38 lines (29 loc) · 1.11 KB
/
main.py
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
import os
from tools.tool import *
def test():
# 获取固定会话
session = login(url="https://xxxx.com/login/dologin",
username="xxxxx",
password="xxxxx"
)
# 获取当前日期
#today = "2023-04-03"
today = get_current_date()
time_str = today + ' 00:00:00'
# 得到外联信息词典
outreach_info_dict = get_outreach_info(session, time_str)
# 得到细节信息
illicit_outnet_sum = process_data(session, outreach_info_dict, today)
for table_info in illicit_outnet_sum:
if table_info:
local_network = table_info[0]['local_network']
output_file_name = generate_filename(local_network,today=today)
if not os.path.exists(output_file_name):
save_to_excel(ip_list=table_info, template_file_path="template.xlsx", output_file_path=output_file_name)
else:
print('该单位已经处理')
if __name__ == '__main__':
# 初始化处理
path = r"./"
os.chdir(path) # 修改工作路径
test()