Exemplo n.º 1
0
const char *
DbmsError::what() const throw()
{
    if( 0 == info )
    {
        const_cast< StrBuf& >( info_buf ).set_str
        ( sqlite3_mprintf( "%s[%d]: %s"
                         , error_code_str(error_code)
                         , error_code
                         , error_code_info(error_code)
                         )
        ); // set_str()
        info = info_buf.c_str();
    }
    return info ;
}
Exemplo n.º 2
0
// We receive a file descriptor
static enum a6o_file_status moduleH1_scan(struct a6o_module *module, int fd, const char *path, const char *mime_type, char **pmod_report)
{
	ERROR_CODE e = ARMADITO_NULL;
	const char *virus_name = NULL;

	//printf("[i] Debug :: module H1 scan :: mime-type = %s\n",mime_type);

	if (!strcmp(mime_type, "application/x-sharedlib")
		|| !strcmp(mime_type, "application/x-object")
		|| !strcmp(mime_type, "application/x-executable")) {
		e = analyseElfFile(fd, (char *)path);
		if (e == ARMADITO_IS_MALWARE)
			virus_name = "Linux.Heuristic.Malware.Generic";
	} else if (!strcmp(mime_type, "application/x-dosexec")
		|| !strcmp(mime_type, "application/x-msdownload")) {
		e = fileAnalysis(fd, (char *)path);
		if (e == ARMADITO_IS_MALWARE)
			virus_name = "Win.Heuristic.Malware.Generic";
	}

	switch(e) {
	case ARMADITO_IS_MALWARE:
		/* even if virus_name is a statically allocated string, it must be returned in a dynamically allocated string */
		/* because it will be free()d by the calling code */
		*pmod_report = os_strdup(virus_name);
		return ARMADITO_MALWARE;
	case ARMADITO_NOT_MALWARE:
		return ARMADITO_CLEAN;
	case ARMADITO_NOT_DECIDED:
	case ARMADITO_DOUBTFUL:
		return ARMADITO_UNDECIDED;
	}

	printf("moduleH1 internal error : %s \n", error_code_str(e));
	return ARMADITO_IERROR;
}