예제 #1
0
* along with this package; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
* MA  02110-1301  USA
*
*
* On Debian GNU/Linux systems, the complete text of the GNU General
* Public License can be found in `/usr/share/common-licenses/GPL-2'.
*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
require_once 'av_init.php';
?>

var __cfg = <?php 
echo Asset::get_path_url();
?>
;

function show_error(error)
{            
    $('#send').removeAttr('disabled');	
    $('#send').off('click');
    $('#send').click(function(){upload_file();});
    
    $('.av_w_overlay').remove(); 
    $('.l_box').remove();               
    
    var txt_error = "<div><?php 
echo _('The following errors occurred');
?>
예제 #2
0
function print_form($import_type)
{
    $config = array('hosts' => array('contexts' => array('show_tree' => Session::show_entities(), 'default_value' => Session::get_default_ctx()), 'chk_iic' => array('show' => TRUE, 'checked' => FALSE), 'help' => array('Version 4.x.x, 5.x.x' => array('format' => _('"IPs(IP1,IP2,...)";"Hostname";"FQDNs(FQDN1,FQDN2,...)";"Description";"Asset Value";"Operating System";"Latitude";"Longitude";"Asset ID";"External Asset";"Device Types(Type1,Type2,...)"'), 'header' => '"IPs";"Hostname";"FQDNs";"Description";"Asset Value";"Operating System";"Latitude";"Longitude";"Asset ID";"External Asset";"Device Type"', 'example' => '"192.168.10.3";"Host-1";"www.example-1.es,www.example-2.es";"' . _('Short description') . '";"2";"Windows";"23.78";"121.45";"379D45C0BBF22B4458BD2F8EE09ECCC2";0;"Server:Mail Server"'), 'Version 3.x.x' => array('format' => _('"IP";"Hostname";"FQDNs(FQDN1,FQDN2,...)";"Description";"Asset Value";"Sensors(Sensor1,Sensor2,...)";"Operating System";"Latitude";"Longitude"'), 'header' => '"IP";"Hostname";"FQDNs";"Description";"Asset Value";"Sensors";"Operating System";"Latitude";"Longitude"', 'example' => '"192.168.10.3";"Host-1";"www.example-1.es,www.example-2.es";"' . _('Short description') . '";"2";"192.168.10.2,192.168.10.3";"Windows";"23.78";"121.45"'))), 'welcome_wizard_hosts' => array('contexts' => array('show_tree' => FALSE, 'default_value' => Session::get_default_ctx()), 'chk_iic' => array('show' => FALSE, 'checked' => TRUE), 'help' => array('Version 4.x.x or higher' => array('format' => _('"IPs(IP1,IP2,...)";"Hostname";"Description";"Operating System";"Device Type(Type1,Type2,...)"'), 'header' => _('"IPs";"Hostname";"Description";"Operating System";"Device Type"'), 'example' => '"192.168.10.3";"Host-1";"' . _('Short description') . '";"Windows";"Server,Network Device"'))));
    $paths = Asset::get_path_url(FALSE);
    $form_action = $paths['asset']['controllers'] . 'import_all_hosts_ajax.php';
    if (!array_key_exists($import_type, $config)) {
        echo ossim_error(_('Error! Import Type not found'));
    } else {
        ?>
        <div id='av_info'></div>

        <form name='form_csv' id='form_csv' method='POST' action='<?php 
        echo $form_action;
        ?>
' enctype='multipart/form-data' target='iframe_upload'>
            <input type="hidden" name="ctx" id="ctx" value="<?php 
        echo $config[$import_type]['contexts']['default_value'];
        ?>
"/>
            <input type="hidden" name="import_type" id="import_type" value="<?php 
        echo $import_type;
        ?>
"/>

            <table id='form_container'>

                <?php 
        //Context
        if ($config[$import_type]['contexts']['show_tree'] == TRUE) {
            ?>
                    <tr class='left'>
                        <td class="td_title">
                            <span><?php 
            echo _('Select the Entity for the assets');
            ?>
:</span>
                        </td>
                    </tr>

                    <tr>
                        <td class='td_content'>
                            <table id="t_tree">
                                <tr>
                                    <td class='noborder'>
                                        <div id="tree"></div>
                                    </td>
                                </tr>

                                <tr>
                                    <td id='td_es'>
                                        <span class='bold'><?php 
            echo _('Entity selected');
            ?>
:</span>
                                        <span id="entity_selected"> - </span>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <?php 
        }
        //Input File
        ?>
                <tr>
                    <td class='td_title'>
                        <span><?php 
        echo _('Choose a CSV file');
        ?>
:</span>
                    </td>
                </tr>

                <tr>
                    <td class='td_content'>
                        <input name='file_csv' id='file_csv' type='file' size='38'/>
                        <?php 
        if ($config[$import_type]['chk_iic']['show'] == TRUE) {
            $checked_iic = $config[$import_type]['chk_iic']['checked'] == TRUE ? 'checked="checked"' : '';
            ?>
                            <span class='ignore_span'>
                                <input type='checkbox' name='iic' id='iic' <?php 
            echo $checked_iic;
            ?>
 value='1'/>
                                <label for='iic' style='margin-left: 2px;'><?php 
            echo _('Ignore invalid characters (Hostnames)');
            ?>
</label>
                            </span>
                            <?php 
        } else {
            $chk_iic_value = $config[$import_type]['chk_iic']['checked'] == TRUE ? '1' : '0';
            ?>
                            <input type='hidden' name='iic' id='iic' value="<?php 
            echo $chk_iic_value;
            ?>
"/>
                            <?php 
        }
        ?>
                    </td>
                </tr>

                <tr>
                        <td class='td_content'>
                            <div id='c_send'>
                                <input type='button' name='send' id='send' value='<?php 
        echo _('Import');
        ?>
'/>
                            </div>
                        </td>
                    </tr>

                <tr>
                    <td class='td_title'>
                        <span><?php 
        echo _('Formats allowed');
        ?>
:</span>
                    </td>
                </tr>

                <tr>
                    <td class='td_content'>
                        <table id='t_format'>
                            <?php 
        //Help
        foreach ($config[$import_type]['help'] as $version => $help_data) {
            ?>
                                <tr>
                                    <td class='td_version'>
                                        <?php 
            echo $version;
            ?>
:
                                    </td>
                                </tr>

                                <tr>
                                    <td class='td_format'>
                                        <strong><?php 
            echo _('Format');
            ?>
:</strong>
                                        <?php 
            echo $help_data['format'];
            ?>
                                    </td>
                                </tr>

                                <tr>
                                    <td class='td_header'>
                                        <strong><?php 
            echo _('Header');
            ?>
:</strong>
                                        <?php 
            echo $help_data['header'];
            ?>
                                    </td>
                                </tr>

                                <tr>
                                    <td class='td_example'>
                                        <strong><?php 
            echo _('Example');
            ?>
:</strong>
                                       <?php 
            echo $help_data['example'];
            ?>
                                    </td>
                                </tr>

                                <tr>
                                    <td></td>
                                </tr>

                                <?php 
        }
        ?>
                        </table>
                    </td>
                </tr>

                <tr>
                    <td class='td_title'>
                        <span><?php 
        echo _('Notes');
        ?>
:</span>
                    </td>
                </tr>

                <tr>
                    <td class='td_content'>
                        <ul id='note_list'>
                            <li><?php 
        echo _('IP address and sensor fields cannot be empty');
        ?>
</li>
                            <li><?php 
        echo _('Hostname syntax defined by RFC 1123');
        ?>
</li>
                            <?php 
        if ($import_type == 'hosts') {
            ?>
                                <li><?php 
            echo _('FQDN syntax defined by RFC 1035, RFC 1123 and RFC 2181');
            ?>
</li>
                                <li>
                                    <span><?php 
            echo _('Valid Operating System values');
            ?>
:</span>
                                    <div style='padding-left: 10px; font-style: italic;'>
                                        Windows, Linux, FreeBSD, NetBSD, OpenBSD, MacOS, Solaris, Cisco, AIX,HP-UX, Tru64, IRIX, BSD/OS, SunOS, Plan9 <?php 
            echo _('or');
            ?>
 IPhone
                                    </div>
                                </li>
                                <?php 
        } else {
            ?>
                                <li>
                                    <span><?php 
            echo _('Valid Operating System values');
            ?>
:</span> <span class='italic'>Windows <?php 
            echo _('or');
            ?>
 Linux</span>
                                </li>
                                 <li>
                                    <span><?php 
            echo _('Valid Device Types');
            ?>
:</span> <span class='italic'>Server <?php 
            echo _('or');
            ?>
 Network Device</span>
                                </li>
                                <?php 
        }
        ?>
                        </ul>
                    </td>
                </tr>
            </table>

            <div id='c_resume'></div>

            <iframe name="iframe_upload" id="iframe_upload" style='display:none;'></iframe>

        </form>
        <?php 
    }
}
예제 #3
0
require_once 'av_init.php';
Session::useractive();
if (!Session::am_i_admin()) {
    Av_exception::throw_error(Av_exception::USER_ERROR, _('You do not have permissions to see this section'));
}
$wizard = Welcome_wizard::get_instance();
if (!$wizard instanceof Welcome_wizard) {
    Av_exception::throw_error(Av_exception::USER_ERROR, "There was an error, the Welcome_wizard object doesn't exist");
}
//Getting the scan step to know if we have a scan running
$step = intval($wizard->get_step_data('scan_step'));
//Selected nets
$nets_selected = $wizard->get_step_data('scan_nets');
$nets_selected = is_array($nets_selected) ? $nets_selected : array();
$n_ids = array_fill_keys(array_keys($nets_selected), 1);
$paths = Asset::get_path_url(FALSE);
$iframe_url = $paths['network']['views'] . 'import_all_nets.php?import_type=welcome_wizard_nets';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <title> <?php 
echo _("AlienVault " . (Session::is_pro() ? "USM" : "OSSIM"));
?>
 </title>
        <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
        <meta http-equiv="Pragma" content="no-cache"/>
    
        <?php 
//CSS Files
$_files = array(array('src' => 'av_common.css?only_common=1', 'def_path' => TRUE), array('src' => 'home.css', 'def_path' => TRUE), array('src' => 'jquery-ui.css', 'def_path' => TRUE), array('src' => 'lightbox.css', 'def_path' => TRUE), array('src' => 'jquery.dataTables.css', 'def_path' => TRUE), array('src' => '/wizard/wizard.css', 'def_path' => TRUE));
예제 #4
0
function print_form($import_type)
{
    $config = array('networks' => array('contexts' => array('show_tree' => Session::show_entities(), 'default_value' => Session::get_default_ctx()), 'chk_iic' => array('show' => TRUE, 'checked' => FALSE), 'help' => array('Version 4.x.x, 5.x.x' => array('format' => _('"Netname";"CIDRs(CIDR1,CIDR2,...)";"Description";"Asset Value";"Net ID"'), 'header' => '"Netname";"CIDRs";"Description";"Asset Value";"Net ID"', 'example' => '"Net-1";"192.168.10.0/24,192.168.9.0/24";"' . _('Short description') . '";"2";"479D45C0BBF22B4458BD2F8EE09ECAC2"'), 'Version 3.x.x' => array('format' => _('"Netname";"CIDRs(CIDR1,CIDR2,...)";"Description";"Asset Value";"Sensors(Sensor1,Sensor2,...)"'), 'header' => '"Netname";"CIDRs";"Description";"Asset Value";"Sensors"', 'example' => '"Net-1";"192.168.10.0/24,192.168.9.0/24";"' . _('Short description') . '";"2";"192.168.10.2,192.168.10.3"'))), 'welcome_wizard_nets' => array('contexts' => array('show_tree' => FALSE, 'default_value' => Session::get_default_ctx()), 'chk_iic' => array('show' => FALSE, 'checked' => TRUE), 'help' => array('Version 4.x.x or higher' => array('format' => _('"Netname";"CIDRs(CIDR1,CIDR2,...)";"Description"'), 'header' => '"Netname";"CIDRs";"Description"', 'example' => '"Net-1";"192.168.10.0/24,192.168.9.0/24";"' . _('Short description') . '"'))));
    $paths = Asset::get_path_url(FALSE);
    $form_action = $paths['network']['controllers'] . 'import_all_nets_ajax.php';
    if (!array_key_exists($import_type, $config)) {
        echo ossim_error(_('Error! Import Type not found'));
    } else {
        ?>
        <div id='av_info'></div>

        <form name='form_csv' id='form_csv' method='POST' action='<?php 
        echo $form_action;
        ?>
' enctype='multipart/form-data' target='iframe_upload'>

            <input type="hidden" name="ctx" id="ctx" value="<?php 
        echo $config[$import_type]['contexts']['default_value'];
        ?>
"/>
            <input type="hidden" name="import_type" id="import_type" value="<?php 
        echo $import_type;
        ?>
"/>

            <table id='form_container'>

                <?php 
        //Context
        if ($config[$import_type]['contexts']['show_tree'] == TRUE) {
            ?>
                    <tr class='left'>
                        <td class="td_title">
                            <span><?php 
            echo _('Select the Entity for the nets');
            ?>
:</span>
                        </td>
                    </tr>

                    <tr>
                        <td class='td_content'>
                            <table id="t_tree">
                                <tr>
                                    <td class='noborder'>
                                        <div id="tree"></div>
                                    </td>
                                </tr>

                                <tr>
                                    <td id='td_es'>
                                        <span class='bold'><?php 
            echo _('Entity selected');
            ?>
:</span>
                                        <span id="entity_selected"> - </span>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <?php 
        }
        $top_class = $import_type == 'welcome_wizard_nets' ? 'td_top' : '';
        //Input File
        ?>
                <tr>
                    <td class='td_title <?php 
        echo $top_class;
        ?>
'>
                        <span><?php 
        echo _('Choose a CSV file');
        ?>
:</span>
                    </td>
                </tr>

                <tr>
                    <td class='td_content'>
                        <input name='file_csv' id='file_csv' type='file' size='38'/>
                        <?php 
        if ($config[$import_type]['chk_iic']['show'] == TRUE) {
            $checked_iic = $config[$import_type]['chk_iic']['checked'] == TRUE ? 'checked="checked"' : '';
            ?>
                            <span class='ignore_span'>
                                <input type='checkbox' name='iic' id='iic' <?php 
            echo $checked_iic;
            ?>
 value='1'/>
                                <label for='iic' style='margin-left: 2px;'><?php 
            echo _('Ignore invalid characters (Net names)');
            ?>
</label>
                            </span>
                            <?php 
        } else {
            $chk_iic_value = $config[$import_type]['chk_iic']['checked'] == TRUE ? '1' : '0';
            ?>
                            <input type='hidden' name='iic' id='iic' value="<?php 
            echo $chk_iic_value;
            ?>
"/>
                            <?php 
        }
        ?>
                    </td>
                </tr>

                <tr>
                        <td class='td_content'>
                            <div id='c_send'>
                                <input type='button' name='send' id='send' value='<?php 
        echo _('Import');
        ?>
'/>
                            </div>
                        </td>
                    </tr>

                <tr>
                    <td class='td_title'>
                        <span><?php 
        echo _('Formats allowed');
        ?>
:</span>
                    </td>
                </tr>

                <tr>
                    <td class='td_content'>
                        <table id='t_format'>
                            <?php 
        //Help
        foreach ($config[$import_type]['help'] as $version => $help_data) {
            ?>
                                <tr>
                                    <td class='td_version'>
                                        <?php 
            echo $version;
            ?>
:
                                    </td>
                                </tr>

                                <tr>
                                    <td class='td_format'>
                                        <strong><?php 
            echo _('Format');
            ?>
:</strong>
                                        <?php 
            echo $help_data['format'];
            ?>
                                    </td>
                                </tr>

                                <tr>
                                    <td class='td_header'>
                                        <strong><?php 
            echo _('Header');
            ?>
:</strong>
                                        <?php 
            echo $help_data['header'];
            ?>
                                    </td>
                                </tr>

                                <tr>
                                    <td class='td_example'>
                                        <strong><?php 
            echo _('Example');
            ?>
:</strong>
                                       <?php 
            echo $help_data['example'];
            ?>
                                    </td>
                                </tr>

                                <tr>
                                    <td></td>
                                </tr>
                                <?php 
        }
        ?>
                        </table>
                    </td>
                </tr>

                <tr>
                    <td class='td_title'>
                        <span><?php 
        echo _('Notes');
        ?>
:</span>
                    </td>
                </tr>

                <tr>
                    <td class='td_content'>
                        <ul id='note_list'>
                            <li><?php 
        echo _("Characters allowed for net names: [A-Za-z0-9], '.' (dot), ':' (colon), '_' (underscore) and '-' (hyphen)");
        ?>
</li>
                            <li><?php 
        echo _('Netname, CIDR and sensor fields cannot be empty');
        ?>
</li>
                        </ul>
                    </td>
                </tr>

            </table>

            <div id='c_resume'></div>

            <iframe name="iframe_upload" id="iframe_upload" style="display:none;"></iframe>

        </form>
        <?php 
    }
}