std::string bootLoad(int step, std::string renderString) {
    if (step == 200) {
        renderString += " PCOS(C) , UNMOS. UNAUTHORIZED USE OF THIS TERMINAL CAN RESULT IN PENALTY BY DEATH. \n";
    } else if (step == 500) {
        renderString += "  Beginning File System Initialization \n";
    } else if (step == 1000) {
        renderString +="   Loaded: /PCOS/init/config/system \n";
    } else if (step == 3000) {
        renderString +="   Loaded: /PCOS/init/config//ntoskrn1.exe \n";
    } else if (step == 4000) {
        for (int i = 0; i < 20; ++i) {
            renderString += "   Loaded: /PCOS/init/config//DRIVERSs";
            renderString += "//" + getRandomString((rand() % 12)+ 4) + "\n";
        }
    } else if (step == 4200) {
        for (int i = 0; i < 20; ++i) {
            renderString += "   Loaded: /PCOS/init/config//ntwkprtl";
            renderString += "//" + getRandomString((rand() % 12)+ 4) + "\n";
        }
    } else if (step == 5000) {
        for (int i = 0; i < 20; ++i) {
            renderString += "   Loaded: /PCOS/init/config//drivers";
            renderString += "//" + getRandomString((rand() % 12)+ 4) + "\n";
        }
    } else if (step == 5200) {
        renderString = "   > Receiving packet from [UNKNOWN-ADDRESS] \n";
    } else if (step == 5500) {
        renderString += "   > Packet Received \n";
    } else if (step == 6100) {
        renderString +="   > Executing";
    }
    return renderString;
    
}
Exemplo n.º 2
0
inline std::vector<std::string> getRandomStringInputs(size_t N) {
    std::vector<std::string> inputs;
    for (size_t i=0; i < N; ++i) {
        inputs.push_back(getRandomString(1024));
    }
    return inputs;
}
Exemplo n.º 3
0
QString Settings::getCookie()
{
    QString cookie = settings.value("cookie", "").toString();
    if (cookie == "") {
        cookie = getRandomString();
        settings.setValue("cookie", cookie);
    }
    return cookie;
}
Exemplo n.º 4
0
void EncryptionTests::bigRandomTest()
{
    int iterations = 10000;
    QTime time = QTime::currentTime();
    qsrand((uint)time.msec());

    while(iterations--) {
        QString key = getRandomString(qrand() % 100);
        QString randomString = getRandomString(qrand() % 1000);
        QString encoded = Encryption::encodeText(randomString, key);
        QString decoded = Encryption::decodeText(encoded, key);
        if (randomString != decoded) {
            QFAIL(QString("Text: %1\nDecoded: %2\nKey: %3").arg(randomString).arg(decoded).arg(key)
                  .toStdString().c_str());
            break;
        }
    }
}
/*
 * Sender thread function
 */
void *sender_thread_function(void* data){

	int i;
	int sleep_interval;
	char random_str[70];

	for(i=1; i<=100; i++){													// Send 100 tokens
		int res;
		thread_data *tdata = (thread_data*)data;
		//printf("*****************************************threadID = %d***************************************\n", tdata->threadId);

		token *tok = calloc(1, sizeof(token));

		pthread_mutex_lock(&mutex);
		tok->id = (TOKEN_SEQUENCE_NO)++;									//protect the shared variable TOKEN_SEQUENCE_NO
		pthread_mutex_unlock (&mutex);

		//read HRT counter value
		int counter_value = 0;
		if( (counter_value=read_hrt_counter(tdata->fd_hrt)) == -1 ){
			printf("read failed while reading hrt counter\n");
			close(tdata->fd_hrt);
			exit(-1);
		}

		//printf("adding ts1 = counter_value = %u to token \n", counter_value);
		tok->ts1 = counter_value;															//fill up token structure with ts1

		strcpy(random_str, getRandomString(STR_MAX_LEN-10));
		//printf("\nrandom_str=%s, len=%d\n", random_str, strlen(random_str));
		sprintf(tok->string, "Sender%d-%s", tdata->threadId, random_str);					//Concatenate threadID with random string to form the final string
		//printf("\nfinal_str=%s, strlen=%d\n", tok->string, strlen(tok->string));			// final_str eg. Sender

		res = -1;
		while(res==-1){

			res = write(tdata->fd_squeue, tok, sizeof(token));		/* Issue a write */
			sleep_interval=(rand()%9000)+1000;
			usleep(sleep_interval);												// sleep for random interval

			if(res == sizeof(token)){
				printf("Can not write to the squeue device file.\n");
				close(tdata->fd_squeue);
				exit(-1);
			}
			else if(res == -1){														//res=-1 means buffer is full, hence retry
				//printf("The circular buffer is full hence will try again\n");
			}
			else {
				//printf("write_to_squeue() succeeded with res=%d\n", res);
			}
		}
	}
	pthread_exit(0);
}
Exemplo n.º 6
0
String ApLib::getRandomString(int nLength)
{
  String sRandom;

  while (sRandom.chars() < nLength) {
    String sId = getRandomString();
    sRandom += sId.subString(0, nLength - sRandom.chars());
  }

  return sRandom;
}
Exemplo n.º 7
0
bool MISC::callProtocol(std::string input_str, std::string &result, const bool async_method, const unsigned int unique_id)
{
	// Protocol
	std::string command;
	std::string data;

	const std::string::size_type found = input_str.find(":");

	if (found==std::string::npos)  // Check Invalid Format
	{
		command = input_str;
	}
	else
	{
		command = input_str.substr(0,found);
		data = input_str.substr(found+1);
	}
	if (command == "TIME")
	{
		getDateTime(data, result);
	}
	else if (command == "BEGUID")
	{
		getBEGUID(data, result);
	}
	else if (command == "CRC32")
	{
		getCrc32(data, result);
	}
	else if (command == "MD4")
	{
		getMD4(data, result);
	}
	else if (command == "MD5")
	{
		getMD5(data, result);
	}
	else if (command == "RANDOM_UNIQUE_STRING")
	{
		getRandomString(data, result);
	}
	else if (command == "TEST")
	{
		result = data;
	}
	else
	{
		result = "[0,\"Error Invalid Format\"]";
		extension_ptr->logger->warn("extDB2: Misc Invalid Command: {0}", command);
	}
	return true;
}
Exemplo n.º 8
0
void MainWindow::prepare()
{
	ui.run->disconnect(SIGNAL(clicked()));
	ui.stop->disconnect(SIGNAL(clicked()));
	ui.mark->disconnect(SIGNAL(clicked()));

	connect(ui.run, SIGNAL(clicked()), this, SLOT(run()));
	ui.view->setText("");
	sequence.restart(getRandomString(Settings::getSequenceSize(), Settings::getSequenceSize() /4, Settings::getN()), Settings::getN());

	ui.run->setEnabled(true);
	ui.stop->setEnabled(false);
	ui.mark->setEnabled(false);
}
Exemplo n.º 9
0
void dXorg::setupSharedMem() {
    qDebug() << "Configure shared mem";

    // create the shared mem block. The if comes from that configure method
    // is called on every change gpu, so later, shared mem already exists
    if (!sharedMem.isAttached()) {
        qDebug() << "Shared memory is not attached, creating it";
        sharedMem.setKey(getRandomString());

        if (!sharedMem.create(SHARED_MEM_SIZE)) {
            if (sharedMem.error() == QSharedMemory::AlreadyExists) {
                qDebug() << "Shared memory already exists, attaching to it";

                if (!sharedMem.attach())
                    qCritical() << "Unable to attach to the shared memory: " << sharedMem.errorString();

            } else
                qCritical() << "Unable to create the shared memory: " << sharedMem.errorString();
        }
    }
}
Exemplo n.º 10
0
inline std::vector<std::string> getDuplicateStringInputs(size_t N) {
    std::vector<std::string> inputs(N, getRandomString(1024));
    return inputs;
}
Exemplo n.º 11
0
TestObject* TestObject::createRandomOne(int data_len, int isallrandom) {
    return new TestObject(getRandomString(data_len, isallrandom), data_len);
}
Exemplo n.º 12
0
void Settings::generateCookie()
{
    setCookie(getRandomString());
}
Exemplo n.º 13
0
String ApLib::getUniqueId()
{
  return getRandomString(20);
}