-
Notifications
You must be signed in to change notification settings - Fork 0
/
muze_client.py
56 lines (48 loc) · 1.38 KB
/
muze_client.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import socket
import logging
import requests
def SocketConnect():
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect((ServerHost,PORT))
print(s.recv(1024))
templete = TempleteSelect()
#소켓통신으로 데이터 전송시 byte object로 전송해야함
#templete_as_bytes=str.encode(templete)
#s.send(templete_as_bytes)
return s
#s.close()
def TempleteSend(sock,templete):
templete_as_bytes = str.encode(templete)
mylogger.debug(templete_as_bytes)
sock.send(templete_as_bytes)
sock.close()
return
def TempleteSelect():
with open("txt/templete.txt", "r", encoding="utf-8") as f:
templete=f.read()
return templete
# 로깅 함수
def Use_Logging(level):
mylogger = logging.getLogger("my")
# 로깅 레벨
mylogger.setLevel(level)
stream_hander = logging.StreamHandler()
mylogger.addHandler(stream_hander)
mylogger.info("logging start!!!")
return mylogger
def main():
templete=TempleteSelect()
mylogger.info(templete)
s=SocketConnect()
TempleteSend(s,templete)
#modsec_file="modsec_audit.log"
#f = open(modsec_file, "r")
#modsec_log=ModsecLogRead(f)
#XSSLog(modsec_log,f)
if __name__ == '__main__':
ServerHost = "192.168.0.181"
PORT = 12345
# 로깅 객체 생성
mylogger = Use_Logging(logging.INFO)
mylogger.debug('test')
main()