Beispiel #1
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)
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()
Beispiel #3
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()
Beispiel #4
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)
Beispiel #5
0
def register_(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('连接服务端成功')
    # 获取注册信息
    data = Base.get_register_info()
    # 组装发送的类型
    send_data = '{"typeCode":%d,"data":"%s"}' % (Type.REGISTER, data)
    # 发送
    client_socket.send(send_data.encode('utf-8'))
    print('发送成功')

    # 关闭
    client_socket.close()
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('发送成功')
from const.Type import Type
from scan.Base import Base

# 准备ip和端口
from utils.get_admin import is_admin

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_update_info()
# print(data)
# data的双引号转换为单引号
data = data.replace('"', "'")
# 组装发送的类型
send_data = '{"typeCode":%d,"boardId":"%s","data":"%s"}' % (Type.UPDATE_INFO,
                                                            board_id, data)
# print(send_data)
# 发送
client_socket.send(send_data.encode('utf-8'))
print('发送成功')

# 关闭
        return ctypes.windll.shell32.IsUserAnAdmin()

    except:
        return False


if is_admin():
    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_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('发送成功')

    # 关闭
import socket

from const.Type import Type
from scan.Base import Base
from scan.service_check import get_service_info

# 准备ip和端口
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 = 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()
Beispiel #10
0
import socket
from const.Type import Type
from scan.Base import Base

#获取主板ID
board_id = Base.get_board_id()
print("欢迎", board_id)

while True:
    ins = input("""
        退出  0
    设备注册  1
    基本信息  2
    安装软件  3
    网络信息  4
    进程信息  5
    服务信息  6
    主机信息  7
    禁用服务  8
    基线检查  9
        请输入指令> """)

    #退出
    if ins == '0':
        break

    #设备注册
    elif ins == '1':
        data = Base.get_register_info(board_id)
        typeCode = Type.REGISTER
Beispiel #11
0
import socket

from const.Type import Type
from scan.Base import Base

# 准备ip和端口
address = ('127.0.0.1', 9526)
# 创建socket对象
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# 连接
client_socket.connect(address)
print('连接服务端成功')
# 获取注册信息
data = Base.get_register_info()
# 组装发送的类型
send_data = '{"typeCode":%d,"data":"%s"}' % (Type.REGISTER, data)
# 发送
client_socket.send(send_data.encode('utf-8'))
print('发送成功')

# 关闭
client_socket.close()


Beispiel #12
0
import socket

from const.Type import Type
from scan.Base import Base

# 准备ip和端口
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_network_info()
# data的双引号转换为单引号
data = data.replace('"', "'")
# 组装发送的类型
send_data = '{"typeCode":%d,"boardId":"%s","data":"%s"}' % (Type.NETWORK_INFO, board_id, data)
# print(send_data)
# 发送
client_socket.send(send_data.encode('utf-8'))
print('发送成功')

# 关闭
client_socket.close()


import socket

from const.Type import Type
from scan.Base import Base

# 准备ip和端口
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_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()