Esempio n. 1
0
int dns_health_check(char *server_ip, char *domain, char *type, char *proto, char *port)
{
	
	int offset;
	int result;
	result = parameter_check(domain, type, proto, port, server_ip);
	if (result == -1)
	{
		return PARAMETER_ERROR;
	}
	
	char sendbuf[BUFFER_MAX_SIZE];
	unsigned char recv_buf[BUFFER_MAX_SIZE];
	memset(sendbuf, 0, sizeof(sendbuf));
	memset(recv_buf,0, sizeof(recv_buf));
	
	offset = gen_dns_packet(sendbuf, domain, type, proto);
	result = get_dns_response(sendbuf, recv_buf, offset, proto, port, server_ip);
	if (result != DNS_CHECK_SUCCESS)
	{
		return result;
	}
	result = unpacket(recv_buf, proto, type);
	
	return result;
}
Esempio n. 2
0
/*
 *  Main	
 */
int main(int argc, char** argv)
{
	modeType mode;
	bool hdd_access;
    FILE* fpFile = parameter_check(&mode, argc, argv);

	fingerprintType fprnt;
	get_mac_addr(&fprnt);
    hdd_access = get_hdd_ser(&fprnt);

#ifdef TEST
	int i;
	printf("Test: Sys MAC Addr: ");
	for(i = 0; i < MAC_LENGTH; ++i) {
		printf("%.2X ", (unsigned char)fprnt.mac_addr[i]);
	}
	printf("\n");
#endif	

	// Print to file (WRITE mode) or display results (READ mode)
	if(mode == MODE_WRITE) {
		fwrite(fprnt.mac_addr, 1, sizeof(fprnt.mac_addr), fpFile);
        if (hdd_access == true) {
   		    fwrite(fprnt.hdd_serial, 1,
                   strlen(fprnt.hdd_serial),fpFile);
        }
	} else {
		bool result = compare_file(&fprnt, fpFile, hdd_access);
		switch(result) {
			case true: printf("The fingerprint matches.\n"); break;
			case false: printf("The fingerprint DOES NOT match.\n"); break;
		}
	}

	fclose(fpFile);

	return 0;
}