Package org.rat.free.security.makifx.base

Examples of org.rat.free.security.makifx.base.EncryptedNode


            TableCell cell = new TableCell() {
                @Override
                public void updateItem(Object item, boolean empty) {
                    if (item != null && !empty && item instanceof EncryptedNode) {
                        EncryptedNode node = (EncryptedNode) item;
                        Label label_cell = new Label();
                        label_cell.setId("generic_label");
                        try {
                            switch (column) {
                                case 0: {
                                    label_cell.setId("name_label");
                                    String t = node.getProperties().get("title");
                                    if (_IMPOSSIBLE_TITLE_.equals(t)) {
                                        label_cell.setText("...");
                                    } else {
                                        label_cell.setText(t);
                                    }
                                    break;
                                }
                                case 1: {
                                    sensibleInit(label_cell, node, "user_type", "user_name_value");
                                    break;
                                }
                                case 2: {
                                    label_cell.setText(node.getProperties().get("url_value"));
                                    break;
                                }
                                case 3: {
                                    label_cell.setText(node.getProperties().get("email_value"));
                                    break;
                                }
                                case 4: {
                                    sensibleInit(label_cell, node, "password1_type", "password1_value");
                                    break;
View Full Code Here


        try {

            escaper = MakiDI.get().fromStock(Escaper.class);

            if (root_node == null || root_node.isLeaf()) {
                root_node = new EncryptedNode();
                root_node.setId(getTabTitle());
                root_node.getProperties().put("process", "");
                manager.putInStoredData(getId(), root_node);
                ctree = executeCommand();
                root_node.addChild(ctree);
View Full Code Here

            __total_proc = 0;
            __proc_over = 0;
            __proc_less = 0;

            EncryptedNode p_act = executeCommand();

            UtilityFX.log("getAllChildOf procAttuali: " + p_act);
            List<EncryptedNode> __curr_proc = getAllChildOf(p_act);

            UtilityFX.log("getAllChildOf root_saved: " + root_saved);
            List<EncryptedNode> __saved_proc = getAllChildOf(root_saved);

            if (__curr_proc != null) {
                for (EncryptedNode natt : __curr_proc) {

                    __total_proc++;
                    EncryptedNode bef = this.evalNodesList(__saved_proc, natt);

                    Map<String, String> m = natt.getProperties();
                    String name = (m.containsKey("name") ? m.get("name") : "...");

                    name = escaper.unescapeValue(name);

                    if (bef != null) {
                        //DLL
                    } else {

                        TreeItem<String> n = new TreeItem<>(name);
                        ImageView iv = new ImageView(UtilityFX.getImage("plus_24.png"));
                        n.setGraphic(iv);

                        result.getChildren().add(n);

                        __proc_over++;
                    }
                }
            } else {
                UtilityFX.log("__curr_proc null");
            }

            if (__saved_proc != null) {
                for (EncryptedNode nsal : __saved_proc) {
                    EncryptedNode min = this.evalNodesList(__curr_proc, nsal);
                    if (min == null) {

                        Map<String, String> m = nsal.getProperties();
                        String name = (m.containsKey("name") ? m.get("name") : "...");
View Full Code Here

                return null;
            }
            List<EncryptedNode> fs = n.getChilds();
            Iterator<EncryptedNode> ite = fs.iterator();
            while (ite.hasNext()) {
                EncryptedNode i = ite.next();
                __list_en.add(i);
            }
        } catch (Exception ex) {
            UtilityFX.log("Err in getAllChildOf:" + ex);
        }
View Full Code Here

        return null;
    }

    private EncryptedNode executeCommand() {

        EncryptedNode root_tree = new EncryptedNode();
        root_tree.setId("Process");

        String result_cmd_proc = "";

        try {

            if (!UtilityFX.isOsLinux()) {
                result_cmd_proc = UtilityFX.executeCommand(COMMAND_TASK_PROC_WIN);
            } else {
                result_cmd_proc = UtilityFX.executeCommand(COMMAND_PS_PROC_LINUX);
            }

            StringTokenizer st = new StringTokenizer(result_cmd_proc, "\n");
            String __proc = null;
            String __ram = null;
            String __pid = null;

            while (st.hasMoreTokens()) {

                String t = st.nextToken().trim();

                if (UtilityFX.isOsLinux()) {

                    if (t.startsWith("UID")) {
                        continue;
                    } else {

                        int cc = 0;
                        String[] str = t.split("\\ ");
                        for (int i = 0; i < str.length; i++) {
                            String s = str[i].trim();
                            if (s != null && s.length() > 0) {
                                switch (cc) {
                                    case 1: {
                                        __pid = s;
                                        break;
                                    }
                                    case 7: {
                                        __proc = t.substring(t.indexOf(s));
                                        break;
                                    }
                                }
                                cc++;
                            }
                        }

                        if (__proc != null && __pid != null) {

                            EncryptedNode node = new EncryptedNode();

                            if (escaper != null) {
                                __proc = escaper.escapeValue(__proc);
                            }

                            node.getProperties().put("name", __proc);
                            node.getProperties().put("ram", "not_set");
                            node.getProperties().put("pid", __pid);
                            root_tree.addChild(node);

                            __proc = null;
                            __pid = null;
                        }
                    }
                } else {

                    /**
                     * ATTENZIONE DA MODIFICARE PER LINGUA DIVERSA.
                     */
                    if (t.startsWith("Image Name") || t.startsWith("Nome immagine")) {
                        __proc = t.substring(t.indexOf(":") + 1);
                        __proc = __proc.trim();
                    }
                    if (t.startsWith("Mem Usage") || t.startsWith("Utilizzo memoria")) {
                        __ram = t.substring(t.indexOf(":") + 1);
                        __ram = __ram.trim();
                    }
                    if (t.startsWith("PID") || t.startsWith("PID")) {
                        __pid = t.substring(t.indexOf(":") + 1);
                        __pid = __pid.trim();
                    }

                    if (__proc != null && __ram != null) {

                        EncryptedNode node = new EncryptedNode();

                        if (escaper != null) {
                            __proc = escaper.escapeValue(__proc);
                        }

                        node.getProperties().put("name", __proc);
                        node.getProperties().put("ram", __ram);
                        node.getProperties().put("pid", __pid);
                        root_tree.addChild(node);

                        __proc = null;
                        __ram = null;
                    }
View Full Code Here

            col_names = new String[]{"Priority", "Name", "Source", "Action", "Destination"};

            data_table = FXCollections.observableArrayList();

            if (root_node == null) {
                root_node = new EncryptedNode();
                root_node.setId(getTabTitle());
                manager.putInStoredData(getId(), root_node);
            }

            if (root_node.getChilds() != null && !root_node.getChilds().isEmpty()) {
                for (int i = 0; i < root_node.getChilds().size(); i++) {
                    data_table.add(new CellPropertiesManager(root_node.getChilds().get(i)));
                }
            }

            UtilityFX.log("Start Backup On Demand.");

            this.escaper = MakiDI.get().fromStock(Escaper.class);
            this.ini = MakiDI.get().fromStock(IniProperties.class, manager);

            latest_bck_res.setVisible(true);

            __btn_bck_add = ToolBarAction.newButton("btn_bck_add", "Add Value",
                    "plus_24.png", (ActionEvent e) -> {
                        addBackupEntry();
                    });

            __btn_bck_remove = ToolBarAction.newButton("btn_bck_remove", "Delete Value",
                    "delete_24.png", (ActionEvent e) -> {
                        deleteSelectedEntry();
                    });

            __btn_bck_remove_all = ToolBarAction.newButton("btn_bck_remove_all", "Delete All Value",
                    "trash_24.png", (ActionEvent e) -> {
                        manager.createPopupMessage("bk_del_all_operation", new AnswarePopupMessage() {
                            @Override
                            public void onOkAnsware() {
                                deleteAllEntry();
                            }

                            @Override
                            public void onCancelAnsware() {
                            }
                        }).setHeader(RBLoader.ll("Delete All Backups."))
                        .setContent(RBLoader.ll("Confirm delete all backups ?"))
                        .setOkCancelButton(RBLoader.ll("Ok"),
                                RBLoader.ll("Cancel"))
                        .setIcon(UtilityFX.getImage("help_24.png"))
                        .show();
                    });

            __btn_bck_start_backup = ToolBarAction.newButton("btn_bck_start_backup", "Start Backup",
                    "video_play_24.png", (ActionEvent e) -> {
                        manager.createPopupMessage("bk_start_operation", new AnswarePopupMessage() {
                            @Override
                            public void onOkAnsware() {
                                startBackup();
                            }

                            @Override
                            public void onCancelAnsware() {
                            }
                        }).setHeader("Start Backup.")
                        .setContent("Confirm run backup?\n\n"
                                + "Warning: this operation always overwrites every file in the target directory. "
                                + "Please, make sure that you have set the correct input value.")
                        .setOkCancelButton("Ok", "Cancel")
                        .setIcon(UtilityFX.getImage("help_24.png"))
                        .show();
                    });

            __btn_bck_info = InfoButton.create("In this section you "
                    + "can set one or more actions to be performed for your backup. "
                    + "Please click the button insert and set a priority, "
                    + "select the source and destination and choose whether "
                    + "to perform a recursive zip all files or just a copy.", manager);

            registerTableButtons();

            __btn_bck_confirm_add = ToolBarAction.newButton("btn_bck_confirm_add", "Ok",
                    "checkmark_24.png", (ActionEvent e) -> {
                        String prio = (String) editor.priority_edit.getSelectionModel().getSelectedItem();
                        String name = editor.name_edit.getText();
                        String act = (String) editor.action_edit.getSelectionModel().getSelectedItem();
                        String source = editor.fileordir_edit.getText();
                        String destination = editor.dest_edit.getText();

                        if (source != null && source.length() > 0 && destination != null && destination.length() > 0) {

                            if (name == null) {
                                name = "";
                            }

                            EncryptedNode node = new EncryptedNode();
                            node.getProperties().put("priority", prio);
                            node.getProperties().put("name", name);
                            node.getProperties().put("action", act);
                            node.getProperties().put("source", source);
                            node.getProperties().put("destination", destination);
                            data_table.add(new CellPropertiesManager(node));

                            addMainTable();
                            updateTable();
View Full Code Here

                    int total = data_table.size();

                    for (int i = 0; i < total; i++) {

                        //----------------------------------------------------//
                        EncryptedNode node = data_table.get(i).getNode();
                        String source_path = node.getProperties().get("source");
                        String dest_path = node.getProperties().get("destination");
                        String action = node.getProperties().get("action");
                        //----------------------------------------------------//

                        File file_source = new File(source_path);
                        File file_dest = new File(dest_path);

                        if (!file_source.exists()) {
                            ini.store("last_result_bck", "Error - " + UtilityFX.data());
                            message = "Can't find souce path: " + file_source + "\n";
                            showMessage(message);
                            return null;
                        }

                        if (!file_dest.exists()) {
                            ini.store("last_result_bck", "Error - " + UtilityFX.data());
                            message = message + "Can't find dest. path: " + file_dest;
                            showMessage(message);
                            return null;
                        }
                    }

                    for (int i = 0; i < total; i++) {

                        //----------------------------------------------------//
                        EncryptedNode node = data_table.get(i).getNode();
                        String source_path = node.getProperties().get("source");
                        String dest_path = node.getProperties().get("destination");
                        String action = node.getProperties().get("action");
                        //----------------------------------------------------//

                        File file_source = new File(source_path);
                        File file_dest = new File(dest_path);
                        boolean exits_all = true;

                        if (!file_source.exists()) {
                            ini.store("last_result_bck", "Error - " + UtilityFX.data());
                            message = "Can't find souce path: " + file_source + "\n";
                            exits_all = false;
                        }

                        if (!file_dest.exists()) {
                            ini.store("last_result_bck", "Error - " + UtilityFX.data());
                            message = message + "Can't find dest. path: " + file_dest;
                            exits_all = false;
                        }

                        if (exits_all) {

                            //------------------------------------------------//
                            //------------------------------------------------//
                            //------------------------------------------------//
                            node.getProperties().put("status", "Running");
                            updateTable();

                            fileList.clear();

                            if (!fileList.isEmpty()) {
                                UtilityFX.log("ERROR CAN'T CLEAR FILE LIST!");
                                showMessage("Application Error, can't clear file list.");
                                return null;
                            }

                            //------------------------------------------------//
                            //------------------------------------------------//
                            //------------------------------------------------//
                            /**
                             * Da ricordare che: 1) NIO nella copia dei file mi
                             * da' dei problemi su alcuni attributi per win7,
                             * quindi in caso di errore faccio la copia
                             * "normale" 2) Lo Zip mi dava problemi con le
                             * cartelle vuote quindi le creo io con il path
                             * "cartella/"
                             */
                            switch (action) {
                                case ACTION_ZIP: {
                                    visitor.setAction("Analyse");
                                    UtilityFX.listFiles(file_source, fileList, visitor);
                                    File result = new File(file_dest + File.separator + file_source.getName() + ".zip");
                                    visitor.setAction("Processing");
                                    UtilityFX.createZipFile(result, file_source, fileList, visitor);
                                    break;
                                }
                                case ACTION_COPY: {
                                    if (file_source.isFile()) {
                                        visitor.setAction("Processing");
                                        UtilityFX.copyFile(file_source.toString(), file_dest + File.separator + file_source.getName(), visitor);
                                    } else {
                                        visitor.setAction("Processing");
                                        UtilityFX.copyRecursively(file_source.toString(), file_dest + File.separator + file_source.getName(), visitor);
                                    }
                                    break;
                                }
                            }
                            node.getProperties().put("status", "Done");
                            updateTable();

                        } else {
                            showMessage(message);
                            return null;
View Full Code Here

            TableCell cell = new TableCell() {
                @Override
                public void updateItem(Object item, boolean empty) {
                    if (item != null && !empty && item instanceof EncryptedNode) {
                        EncryptedNode node = (EncryptedNode) item;
                        Label label_cell = new Label();
                        label_cell.setId("generic_label");
                        try {
                            /*
                             TableColumn title_priority = new TableColumn(RBLoader.ll("Priority"));
                             TableColumn title_name = new TableColumn(RBLoader.ll("Name"));
                             TableColumn title_fdir = new TableColumn(RBLoader.ll("File/Directory"));
                             TableColumn title_action = new TableColumn(RBLoader.ll("Action"));
                             TableColumn title_dest = new TableColumn(RBLoader.ll("Destination"));
                             TableColumn title_status = new TableColumn(RBLoader.ll("Status"));
                             * */
                            switch (column) {
                                case 0: {
                                    if (node.getProperties().containsKey("priority")) {
                                        label_cell.setText(node.getProperties().get("priority"));
                                    }
                                    break;
                                }
                                case 1: {
                                    if (node.getProperties().containsKey("name")) {
                                        label_cell.setText(node.getProperties().get("name"));
                                    }
                                    break;
                                }
                                case 2: {
                                    if (node.getProperties().containsKey("source")) {
                                        label_cell.setText(node.getProperties().get("source"));
                                    }
                                    break;
                                }
                                case 3: {
                                    if (node.getProperties().containsKey("action")) {
                                        label_cell.setText(node.getProperties().get("action"));
                                    }
                                    break;
                                }
                                case 4: {
                                    if (node.getProperties().containsKey("destination")) {
                                        label_cell.setText(node.getProperties().get("destination"));
                                    }
                                    break;
                                }
                                /*case 5: {
                                 if (node.getProperties().containsKey("status")) {
View Full Code Here

    @Override public Node getGuiEditor() {
        try {

            if (root_node == null) {
                root_node = new EncryptedNode();
                root_node.setId(getTabTitle());
                root_node.getProperties().put("notes", "");
                manager.putInStoredData(getId(), root_node);
            }
View Full Code Here

    @Override public Node getGuiEditor() {
        try {

            if (root_node == null) {
                root_node = new EncryptedNode();
                root_node.setId(getTabTitle());
                root_node.getProperties().put("notes", "");
                manager.putInStoredData(getId(), root_node);
            }
View Full Code Here

TOP

Related Classes of org.rat.free.security.makifx.base.EncryptedNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.