コード例 #1
0
def service_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 = get_service_info()
    # data的双引号转换为单引号
    data = data.replace('"', "'")
    # 将\'转换为空
    # data = data.replace("\\'", '')
    # 组装发送的类型
    send_data = '{"typeCode":%d,"boardId":"%s","data":"%s"}' % (
        Type.SERVICE_INFO, board_id, data)
    # print(send_data.encode('utf-8'))
    # 发送
    client_socket.send(send_data.encode('utf-8'))
    print('发送成功')

    # 关闭
    client_socket.close()
コード例 #2
0
def policy_check(target_server_ip):
    if is_admin():
        # 准备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 = get_policy_info()

        # data的双引号转换为单引号
        data = data.replace('"', "'")
        # 将\'转换为空
        data = data.replace("\\'", '')
        # 组装发送的类型
        send_data = '{"typeCode":%d,"boardId":"%s","data":"%s"}' % (
            Type.POLICY_INFO, board_id, data)
        # print(send_data)
        # 发送
        client_socket.send(send_data.encode('utf-8'))
        print('发送成功')

        # 关闭
        client_socket.close()

    else:
        ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable,
                                            __file__, None, 1)
コード例 #3
0
def inssoft_check(target_server_ip):
    if is_admin():
        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_install_soft()
        # print(data)
        # data的双引号转换为单引号
        data = data.replace('"', "'")
        # 组装发送的类型
        send_data = '{"typeCode":%d,"boardId":"%s","data":"%s"}' % (Type.INSTALLED_SOFT, board_id, data)
        # print(send_data)
        # 发送
        client_socket.send(send_data.encode('utf-8'))
        print('发送成功')

        # 关闭
        client_socket.close()

    else:
        ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, __file__, None, 1)
コード例 #4
0
def autorun_check(target_server_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_autoruns()
    # print(data)
    # data的双引号转换为单引号
    data = data.replace('"', "'")
    # 将\'转换为空
    data = data.replace("\\'", '')
    # 组装发送的类型
    send_data = '{"typeCode":%d,"boardId":"%s","data":"%s"}' % (
        Type.AUTORUNS_INFO, board_id, data)
    # print(send_data)
    # 发送
    client_socket.send(send_data.encode('utf-8'))
    print('发送成功')

    # 关闭
    client_socket.close()
コード例 #5
0
from const.Type import Type
from scan.Base import Base

# 准备ip和端口
from utils.get_admin import is_admin
#address = ('175.24.114.232', 9526)
address = ('127.0.0.1', 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_autoruns()
# print(data)
# data的双引号转换为单引号
data = data.replace('"', "'")
# 将\'转换为空
data = data.replace("\\'", '')
# 组装发送的类型
send_data = '{"typeCode":%d,"boardId":"%s","data":"%s"}' % (Type.AUTORUNS_INFO,
                                                            board_id, data)
print(send_data)
# 发送
client_socket.send(send_data.encode('utf-8'))
print('发送成功')