bool mod_mimikatz_efs::infos(vector<wstring> * arguments)
{
	if(!arguments->empty())
	{
		PENCRYPTION_CERTIFICATE_HASH_LIST pHashes = NULL;

		if(QueryUsersOnEncryptedFile(arguments->front().c_str(), &pHashes) == ERROR_SUCCESS)
		{
			wcout << L"User (s) reported : " << pHashes->nCert_Hash << endl;
			printInfos(pHashes);
			FreeEncryptionCertificateHashList(pHashes);
		}
		else wcout << L"Error QueryUsersOnEncryptedFile : " << mod_system::getWinError() << endl;

		if(QueryRecoveryAgentsOnEncryptedFile(arguments->front().c_str(), &pHashes) == ERROR_SUCCESS)
		{
			wcout << L"Agent(s) covering  : " << pHashes->nCert_Hash << endl;
			printInfos(pHashes);
			FreeEncryptionCertificateHashList(pHashes);
		}
		else wcout << L"Error QueryRecoveryAgentsOnEncryptedFile : " << mod_system::getWinError() << endl;

	}
	return true;
}
Exemple #2
0
	void execute(){

		parseArgs();

		printInfos();

	}
void
TestApp::render() {
  if(getFPS()>1.0f)
    speedFactor = SPEEDCONST/getFPS();
  
  glDisable(GL_CULL_FACE);
  glEnable(GL_DEPTH_TEST);
  glDisable(GL_TEXTURE_2D);
  glDisable(GL_LIGHTING);
  
  glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
  cam->toOpenGL();

  /*  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glOrtho(800, 0, 600, 0, 0, 1.);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();*/

  glEnable(GL_FRAGMENT_PROGRAM_ARB);
  progFp->bind();
  //shader->setUniform("heightfield", 0);
  glClientActiveTextureARB(GL_TEXTURE0);
  tex->bind();
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

  glColor3f(1, 1, 0);
  glBegin(GL_QUADS);
  for(int i = 0; i < 1; i++) {
    glTexCoord2f(0, 1);
    glVertex3f(-0.01, 0.01, i*0.01);
    glTexCoord2f(0, 0);
    glVertex3f(-0.01, -0.01, i*0.01);
    glTexCoord2f(1, 0);
    glVertex3f(0.01, -.01, i*0.01);
    glTexCoord2f(1, 1);
    glVertex3f(.01, .01, i*0.01);
  }
  glEnd();
/*  glBegin(GL_QUADS);
    glTexCoord2f(0, 1);
    glVertex2f(0, 0);
    glTexCoord2f(0, 0);
    glVertex2f(256, 0);
    glTexCoord2f(1, 0);
    glVertex2f(256, 256);
    glTexCoord2f(1, 1);
    glVertex2f(0, 256);
  glEnd();
*/
  glDisable(GL_FRAGMENT_PROGRAM_ARB);
  Shader::useFixedPipeline();

  printInfos();
}
Exemple #4
0
/*
 * Test if adhesions points should unattach due to (pulling) forces (vs AdhesionForce)
 * Two different case : if stress pushing or stress pulling 
 *	Update the number of points attached (and by effet de bord, the AdhesionForce)
 * Return 1 if detached , else 0
 */
int StickyObj::testAdhesionEfficiency(){
	//For each adhesionPoint:
	//	if (pull force + stress)*func(sheer) > Fadhesion --> then detach this point 

	dReal lengX = absdReal(2*collidingPointPos[0].getX()); // approximate the width of the conctact surfac with one point (should be done with all points ..)
	dReal lengZ = absdReal(2*collidingPointPos[0].getZ()); // approximate the height of the conctact surfac with one point (should be done with all points ..)
	dReal stepX = lengX/BOUND;
	dReal stepZ = lengZ/BOUND; 
	dReal dispX = -lengX/2+stepX/2;
	dReal dispZ = -lengZ/2+stepZ/2;	
	rho= adheringPoints/MAX_ADHESIONPOINTS;
	dReal sigmaVonMisesThreshold = 200*ADHESION_FORCE_FACTOR*surfaceArea*rho; // = 1000 exp data from Webots
	dReal thetaVonMisesThreshold = 50*ADHESION_FORCE_FACTOR*surfaceArea*rho; // guessed value
	dReal mu = 0.5;
	
	
	int adhePoints = MAX_ADHESIONPOINTS;
	
	dReal max =0.0;
	dReal maxTemp;
	int i;
	int j;
	for(i=0; i< BOUND; i++){
		for(j=0; j<BOUND;j++){
			sheerAndStress[i][j] = computeSheerAndStress(dispX+stepX*i ,dispZ+stepZ*j);
			maxTemp = 0.01*vonMisesFunction(sheerAndStress[i][j]);
			if(sheerAndStress[i][j].getX() > 0){	
				if(maxTemp > sigmaVonMisesThreshold){	
					adhePoints--;
				}
			}else{
				if(maxTemp > mu*-1*sheerAndStress[i][j].getX()*rho + thetaVonMisesThreshold){	
					adhePoints--;
				}
			}
			if(maxTemp > max){
				max = maxTemp;
			}
		}
	}	
	
	adheringPoints = adhePoints;
	if(adheringPoints == 0){
		dWebotsConsolePrintf("Detached due to forces");
		printInfos();
		
		detach();
		dJointDestroy(adhesionJoint);
		return 1;
	}
	return 0;
}
Exemple #5
0
int openSocket(const char* address, const char* port)
{
	printf("openSocket\n");
	int s = 0, status;
#ifdef _WIN32
	WSADATA wsaData;
	//WSAData wsaData; //falls das andere nicht geht
	// MAKEWORD(1,1) for  Winsock 1.1, MAKEWORD(2,0) for Winsock 2.0:
	if(!WSAInit)
	{
		if(WSAStartup(MAKEWORD(2,2), &wsaData) != 0)
		{
			fprintf(stderr, "WSAStartup failed.\n");
			return -1;
		}
		WSAInit = 1;
	}
#endif
	struct addrinfo hints, *servinfo = NULL, *p = NULL, *pSocket = NULL;
	memset(&hints, 0, sizeof(struct addrinfo));

	//prepare
	hints.ai_family = AF_INET;
        hints.ai_socktype = SOCK_DGRAM;
        hints.ai_protocol = IPPROTO_UDP;
//	*/
	
	// do the lookup
	// [pretend we already filled out the "hints" struct]
	status = getaddrinfo(address, port, &hints, &servinfo);
	if(status != 0)
	{
		printf("status != 0\n");
		fprintf(stderr, "addresse: %s, port: %s, getaddrinfo error: %s\n", address, port, gai_strerror(status));
		return -1;
	}
	//printf("getaddrinfo fertig\n");

	// Retrieve each address and print out the hex bytes
    for(p=servinfo; p != NULL ;p=p->ai_next) 
	{
#ifdef __DEBUG
		printInfos(p);
#endif
		//Socket erstellen
		if ((s = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) 
		{
			fprintf(stderr, "socket erstellung fehlgeschlagen, weiter naechster Versuch!\n");
			continue;
		}
		else
		{
			pSocket= p;
			fprintf(stderr, "socket wurde erstellt!\n");
			break;
		}
    }
#ifdef __DEBUG
	printf("socket %d\n", s);	
#endif
	
	if(s != -1)
	{	
		//printf("s: %d, ai_addr: %d" );//, ai_addr: %d, ai_addrlen: %d", s, p->ai_addr, p->ai_addrlen);
		// socket connecten, damit der send aufruf leichter ist
		if(connect(s, pSocket->ai_addr, pSocket->ai_addrlen) != 0)
		{
#ifdef _WIN32
			//int err = WSAGetLastError();
			fprintf(stderr, "errorcode: %s ", getErrnoText());
#endif
			fprintf(stderr, "Fehler beim connecten: %d, %s\n", errno, getErrnoText());
		}	
		else
		{
			printf("connection wurde erstellet\n");
		}
	}
	
	freeaddrinfo(servinfo);
	
	return s;					
}
/// unit tests
int test() {
	std::ofstream log("flowIterated4_SpatialPW.log", std::ios::trunc);
	std::ofstream csv("flowIterated4_energy.csv", std::ios::trunc);
	assert(log.good());
	sout.assign(log);

	// load plugin manager
	PluginManager man(GLOBAL_PLUGIN_DIR, LOCAL_PLUGIN_DIR);

	// start tests
	std::string testfile(TESTDIR "/flowIterated4.wrp");
	std::cout << "Loading parameter file \"" << testfile;
	std::cout << "\"" << std::endl;
	man.loadParameterFile(testfile);

	// get test instances
	SimpleIterator<double>* iterator =
			dynamic_cast<SimpleIterator<double>*>(
					man.getInstance("iterator"));
	assert(iterator);

	RelaxingIterator<double>* relaxator =
			dynamic_cast<RelaxingIterator<double>*>(
					man.getInstance("relaxator"));
	assert(relaxator);

	IteratorHelper<double>* helper =
			dynamic_cast<IteratorHelper<double>*>(
					man.getInstance("helper"));
	assert(helper);

	IteratorHelper<double>* relaxinghelper =
			dynamic_cast<IteratorHelper<double>*>(
					man.getInstance("relaxinghelper"));
	assert(helper);

	SpatialPW<double>* spatialPW = dynamic_cast<SpatialPW<double>*>(
			man.getInstance("spatialterm_learned"));
	assert(spatialPW);

	FlowComparator<double>* analyzer = dynamic_cast<FlowComparator<double>*>(
			man.getInstance("analyzer"));
	assert(analyzer);

	std::string curDir = FileTool::getCurrentDir();
	FileTool::changeDir(TESTDIR);

	// make sure that ground truth is available
	ParameteredObject* gen = man.getInstance("seqgen");
	assert(gen);
	gen->run();

	// connect analyzer input to current flow
	analyzer->result.disconnect();
	analyzer->result.connect(helper->flow);

	// write ground truth
	analyzer->groundtruth().get_append('c').save_cimg(
			(curDir+"/" PREFIX "_gt.cimg").c_str(),true);

	relaxator->prepareIterations();
	printHeader(csv);

	std::cout << "Iteration: " << std::flush;
	bool contOut, contIn;
	do {
		relaxator->prepareStep();
		double cur = relaxator->getCur();
		printInfos(csv,curDir,cur,helper,relaxinghelper,spatialPW,analyzer);
		iterator->prepareIterations();
		do {
			contIn = iterator->singleStep();
			printInfos(csv,curDir,cur,helper,relaxinghelper,spatialPW,analyzer);
			std::cout << helper->countAll() << " " << std::flush;
		} while (contIn);
		iterator->finishIterations();
		contOut = relaxator->finishStep();
	} while (contOut);
	relaxator->finishIterations();

	std::cout << "done" << std::endl;

	double meanEndpointError = analyzer->getMeanEndpointError();

	man.reset();

	sout.assign(std::cout, log);
	sout << "\tmean endpoint error: " << meanEndpointError << std::endl;
	sout.assign();
	csv.close();
	log.close();

	// check results
	if (meanEndpointError >= 0.15) {
		std::cout << "Mean endpoint error too bad!" << std::endl;
		return EXIT_FAILURE;
	}

	return EXIT_SUCCESS;
}