Ejemplo n.º 1
0
def run(payload, socket):
    filepath = payload['args']['filepath']
    response = {
        'cmd_id': payload['cmd_id'],
        "session_id": payload["args"]["session_id"],
        'filepath': filepath
    }
    newpath = payload['args']['topath']
    if newpath == 'desktop':
        newpath = os.path.join(os.path.expanduser('~'), 'Desktop')
    elif newpath == 'document':
        newpath = os.path.join(os.path.expanduser('~'), 'Documents')

    if not KvirusScanner().isFilepathLegal(filepath):
        response['error'] = "Illegal filepath:{}.".format(filepath)
    elif not KvirusScanner().isFilepathLegal(newpath):
        if not os.path.isdir(newpath) or os.path.exists(newpath):
            response['error'] = response['error'] + \
                " Illegal topath:{}.".format(newpath)
    else:
        ret = KvirusScanner().handleVirus(filepath,
                                          newpath=newpath,
                                          operation=OPERATION_MOVETO)
        if ret:
            response['error'] = ret

    if 'ticket' in payload['args']:
        response['ticket'] = payload['args']['ticket']
        
    socket.response(response)
Ejemplo n.º 2
0
def run(payload, socket):
    filepath = payload['args']['filepath']
    response = {
        'cmd_id': payload['cmd_id'],
        "session_id": payload["args"]["session_id"],
        'filepath': filepath
    }
    if not KvirusScanner().isFilepathLegal(filepath):
        response['error'] = "Illegal filepath!"
    else:
        ret = KvirusScanner().handleVirus(filepath, operation=OPERATION_TRUST)
        if ret:
            response['error'] = ret

    if 'ticket' in payload['args']:
        response['ticket'] = payload['args']['ticket']

    socket.response(response)
def run(payload, socket):
    filepath = payload['args']['filepath']
    response = {
        'cmd_id': payload['cmd_id'],
        "session_id": payload["args"]["session_id"],
        'filepath': filepath
    }
    if not KvirusScanner().isFilepathLegal(filepath):
        response['error'] = "Illegal filepath!"
    else:
        ret = KvirusScanner().addWhiteList(filepath,
                                           payload['args']['isWhitelist'])
        if ret:
            response['error'] = ret

    if 'ticket' in payload['args']:
        response['ticket'] = payload['args']['ticket']

    socket.response(response)
Ejemplo n.º 4
0
 def __init__(self):
     self.members = [
         Klogger(),
         Kdatabase(),
         Klanguage(),
         Ksecurity(),
         Kmodules(),
         KUEBA(),
         Kptys(),
         KvirusScanner(),
         Kbaseline(),
         Klauncher()
     ]
     self.terminate = False
Ejemplo n.º 5
0
def run(payload, socket):
    response = {
        'cmd_id': payload['cmd_id'],
        "session_id": payload["args"]["session_id"],
    }
    ret = KvirusScanner().clearHistory()

    if ret:
        response['error'] = ret


    if 'ticket' in payload['args']:
        response['ticket'] = payload['args']['ticket']

    socket.response(response)