Esempio n. 1
0
void init_shell()
{
  getCmdCount();
  populateCommands();
  tcputs("$>> ", COLOR_GREEN);
  irq_install_handler(1, keyboard_handler);
  waitCmd();
}
Esempio n. 2
0
void shell(void)
{

	kprintf("\rDAMOCLES v2.0\n\n");
	populateCommands(myCommands);

	while(1)
		executeCommand(getCommand(myCommands));


}
Esempio n. 3
0
int main(int argc, char *argv[])
{
    // parse the program options
    bool magic = false;
    namespace po = boost::program_options;
    po::options_description desc("Allowed options");
    desc.add_options()
        ("help", "produce help message")
        ("imageName", po::value<std::string>(), "teasafe image path")
        ("coffee", po::value<bool>(&magic)->default_value(false), "mount alternative sub-volume")
        ;

    po::positional_options_description positionalOptions;
    (void)positionalOptions.add("imageName", 1);

    po::variables_map vm;
    try {
        po::store(po::command_line_parser(argc, argv).
                  options(desc).positional(positionalOptions).run(),
                  vm);
        po::notify(vm);
        if (vm.count("help") ||
            vm.count("imageName") == 0) {
            std::cout << desc << std::endl;
            return 1;
        }

        if (vm.count("help")) {
            std::cout<<desc<<"\n";
        } else {

            std::cout<<"image path: "<<vm["imageName"].as<std::string>()<<std::endl;
            std::cout<<"\n";

        }
    } catch (...) {
        std::cout<<"Problem parsing options"<<std::endl;
        std::cout<<desc<<std::endl;
        return 1;
    }

    populateCommands();

    // Setup a core teasafe io object which stores highlevel info about accessing
    // the TeaSafe image
    auto io(std::make_shared<teasafe::CoreTeaSafeIO>());
    io->path = vm["imageName"].as<std::string>().c_str();
    io->encProps.password = teasafe::utility::getPassword("teasafe password: "******"magic number: ").c_str()) : 0;

    // Obtain the initialization vector from the first 8 bytes
    // and the number of xtea rounds from the ninth byte
    teasafe::detail::readImageIVAndRounds(io);

    // Obtain the number of blocks in the image by reading the image's block count
    long const amount = teasafe::detail::CIPHER_BUFFER_SIZE / 100000;
    auto f(std::bind(&teasafe::cipherCallback, std::placeholders::_1, amount));
    io->ccb = f;
    teasafe::ContainerImageStream stream(io, std::ios::in | std::ios::binary);

    // compare password hashes
    uint8_t hashRecovered[32];
    teasafe::detail::getPassHash(stream, hashRecovered);
    uint8_t hashEntered[32];
    teasafe::utility::sha256((char*)io->encProps.password.c_str(), hashEntered);
    if(!teasafe::utility::compareTwoHashes(hashEntered, hashRecovered)) {
        std::cout<<"Incorrect password"<<std::endl;
        exit(0);
    }

    io->blocks = teasafe::detail::getBlockCount(stream);

    printf("Counting allocated blocks. Please wait...\n");

    io->freeBlocks = io->blocks - teasafe::detail::getNumberOfAllocatedBlocks(stream);
    io->blockBuilder = std::make_shared<teasafe::FileBlockBuilder>(io);

    printf("Finished counting allocated blocks.\n");

    stream.close();

    // Create the basic file system
    teasafe::TeaSafe theBfs(io);
    return loop(theBfs);
}
Esempio n. 4
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
	_core.loadPlugins("limbs");

	ui->setupUi(this);

	_pluginsManager = new PluginsManagerWidget(this);
	_pluginsManager->setModal(true);
	_pluginsManager->setCore(&_core);
	_pluginsManager->close();

	_settingsWidget = new SettingsWidget(this);
	_settingsWidget->setModal(true);
	_settingsWidget->setCore(&_core);

	connectActions();

	populateMenus();
	populateToolbars();
	populateDocks();
	populateViews();

	populateCommands();

	/*TreeInterface *iTree;
	SerializerInterface *iSerializer;

	foreach(QObject *object, _core.plugins())
	{
		iTree = qobject_cast<TreeInterface *>(object);

		if ( !iTree )
			continue;

		break;
	}

	foreach(QObject *object, _core.plugins())
	{
		iSerializer = qobject_cast<SerializerInterface *>(object);

		if ( !iSerializer )
			continue;

		break;
	}

	_root = iTree->create();

	iSerializer->deserialize(QString("test2.yml"), _root);

	foreach(QObject *object, _core.plugins())
	{
		MainWindowViewInterface *iView;

		iView = qobject_cast<MainWindowViewInterface *>(object);

		if ( !iView )
			continue;

		ui->viewTabs->addTab(iView->newView(_root, this), tr("321"));
		break;
	}*/
}