def baseinfo_check(target_server_ip): # 准备ip和端口 address = (target_server_ip, 9526) # 创建socket对象 client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # 连接 client_socket.connect(address) print('连接服务端成功') # 获取主板id board_id = Base.get_board_id() # 获取基本信息 data = Base.get_base_info() # data的双引号转换为单引号 data = data.replace('"', "'") # 组装发送的类型 send_data = '{"typeCode":%d,"boardId":"%s","data":"%s"}' % (Type.BASE_INFO, board_id, data) # print(send_data) # 发送 client_socket.send(send_data.encode('utf-8')) print('发送成功') # 关闭 client_socket.close()
禁用服务 8 基线检查 9 请输入指令> """) #退出 if ins == '0': break #设备注册 elif ins == '1': data = Base.get_register_info(board_id) typeCode = Type.REGISTER #基本信息 elif ins == '2': data = Base.get_base_info() typeCode = Type.BASE_INFO #安装的软件 elif ins == '3': data = Base.get_install_soft() typeCode = Type.INSTALLED_SOFT #网络信息 elif ins == '4': data = Base.get_network_info() typeCode = Type.NETWORK_INFO #进程信息 elif ins == '5': data = Base.get_process_info()