while True:
time.sleep(30)
- logger.info("HB : challenge starting")
+ logger.debug("HB : challenge starting")
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((DEST_TCP_IP, DEST_TCP_PORT))
s.send(MESSAGE)
- logger.info("HB : waiting for the reply packet ...")
+ logger.debug("HB : waiting for the reply packet ...")
data = s.recv(MY_BUFFER_SIZE)
#data = s.recv(BUFFER_SIZE).decode('UTF-8')
- logger.info("HB : reply packet received")
+ logger.debug("HB : reply packet received")
s.close()
try:
- logger.info("HB : trying to decrypt data : " + str(data))
+ logger.debug("HB : trying to decrypt data : " + str(data))
data = k.decrypt(data).decode('UTF-8')
- logger.info("HB : received data:" + str(data))
+ logger.debug("HB : received data:" + str(data))
#data = k.decrypt(data)
#data = data.decode('UTF-8')
if data == "Received":
else:
logger.warn("HB : Error")
except:
- logger.info("Received an invalid HB packet")
+ logger.warn("Received an invalid HB packet")
time.sleep(1)
logger.error("I am out of the infinit HB loop !")
if not conn: break
data = conn.recv(MY_BUFFER_SIZE)
if not data: break
- logger.info("HB : Received HB from " + str(addr) + " : " + str(data))
+ logger.debug("HB : Received HB from " + str(addr) + " : " + str(data))
k = pyDes.des(b"DEADJACK", pyDes.CBC, b"\2\2\2\2\2\2\2\2", pad=None, padmode=2)
try:
logger.debug("HB : HB packet content is : " + str(data))
logger.debug("HB : decode from UTF-8")
logger.debug("HB : HB packet content is : " + str(data))
if data == "HB":
- logger.info("HB : sending HB packet back")
+ logger.info("HB : Remus pinged")
DEST_MESSAGE = bytes("Received", 'UTF-8')
DEST_MESSAGE = k.encrypt(DEST_MESSAGE)
# Sending
conn.send(DEST_MESSAGE)
conn.close()
except:
- logger.warn("HB : Received an invalid HB packet")
- time.sleep(1)
+ logger.warn("HB : Received an invalid HB packet" + str(addr) + " : " + str(data))
logger.error("HB : I am out of the infinit HB loop !")
return 1