Beispiel #1
0
            $hostname = $DNS->resolve_address($ip, false, true, $nsid);
            //set update query
            $values = array("subnetId" => $s->id, "ip_addr" => $Subnets->transform_address($ip, "decimal"), "dns_name" => $hostname['name'], "description" => "-- autodiscovered --", "note" => "This host was autodiscovered on " . $nowdate, "lastSeen" => $nowdate, "state" => "2", "action" => "add");
            //insert
            $Addresses->modify_address($values);
            //set discovered
            $discovered++;
        }
    }
}
# update scan time
$Scan->ping_update_scanagent_checktime(1, $nowdate);
# send mail
if ($discovered > 0 && $send_mail) {
    # check for recipients
    foreach ($Admin->fetch_multiple_objects("users", "role", "Administrator") as $admin) {
        if ($admin->mailNotify == "Yes") {
            $recepients[] = array("name" => $admin->real_name, "email" => $admin->email);
        }
    }
    # none?
    if (!isset($recepients)) {
        die;
    }
    # fetch mailer settings
    $mail_settings = $Admin->fetch_object("settingsMail", "id", 1);
    # fake user object, needed for create_link
    $User = new StdClass();
    @($User->settings->prettyLinks = $Scan->settings->prettyLinks);
    # initialize mailer
    $phpipam_mail = new phpipam_mail($Scan->settings, $mail_settings);
Beispiel #2
0
        //set temp name - replace space with three ___
        $myField['nameTemp'] = str_replace(" ", "___", $myField['name']);
        if (isset($_GET[$myField['nameTemp']]) && $_GET[$myField['nameTemp']] == "on") {
            $worksheet->write($lineCount, $rowCount, $myField['name'], $format_header);
            $rowCount++;
        }
    }
}
$lineCount++;
//write Subnet entries for the selected sections
foreach ($vlan_domains as $vlan_domain) {
    //cast
    $vlan_domain = (array) $vlan_domain;
    if (isset($_GET['exportDomain__' . str_replace(" ", "_", $vlan_domain['name'])]) && $_GET['exportDomain__' . str_replace(" ", "_", $vlan_domain['name'])] == "on") {
        // get all VLANs in VLAN domain
        $all_vlans = $Admin->fetch_multiple_objects("vlans", "domainId", $vlan_domain['id'], "number");
        $all_vlans = (array) $all_vlans;
        // skip empty domains
        if (sizeof($all_vlans) == 0) {
            continue;
        }
        //write all VLAN entries
        foreach ($all_vlans as $vlan) {
            //cast
            $vlan = (array) $vlan;
            //reset row count
            $rowCount = 0;
            if (isset($_GET['name']) && $_GET['name'] == "on") {
                $worksheet->write($lineCount, $rowCount, $vlan['name'], $format_text);
                $rowCount++;
            }
Beispiel #3
0
if (!is_numeric($_POST['vlanId'])) {
    $Result->show("danger", _("Invalid ID"), true);
}
// verify that new exists
$vlan_domain = $Admin->fetch_object("vlanDomains", "id", $_POST['newDomainId']);
if ($vlan_domain === false) {
    $Result->show("danger", _("Invalid ID"), true);
}
//fetch vlan
$vlan = $Admin->fetch_object("vlans", "vlanId", $_POST['vlanId']);
if ($vlan === false) {
    $Result->show("danger", _("Invalid ID"), true);
}
// check that it is not already set !
if ($User->settings->vlanDuplicate == 0) {
    $check_vlan = $Admin->fetch_multiple_objects("vlans", "domainId", $vlan_domain->id, "vlanId");
    if ($check_vlan !== false) {
        foreach ($check_vlan as $v) {
            if ($v->number == $vlan->number) {
                $Result->show("danger", _("VLAN already exists"), true);
            }
        }
    }
}
# formulate update query
$values = array("vlanId" => @$_POST['vlanId'], "domainId" => $vlan_domain->id);
# update
if (!$Admin->object_modify("vlans", "edit", "vlanId", $values)) {
    $Result->show("danger", _("Failed to move VLAN to new domain") . '!', true);
} else {
    $Result->show("success", _("VLAN moved to new domain successfully") . '!', false);
Beispiel #4
0
 *******************************/
/* functions */
require dirname(__FILE__) . '/../../../functions/functions.php';
# initialize user object
$Database = new Database_PDO();
$User = new User($Database);
$Admin = new Admin($Database);
$Tools = new Tools($Database);
$Result = new Result();
# verify that user is logged in
$User->check_user_session();
# fetch custom fields
$custom = $Tools->fetch_custom_fields('vlans');
//if it already exist die
if ($User->settings->vlanDuplicate == 0 && $_POST['action'] == "add") {
    $check_vlan = $Admin->fetch_multiple_objects("vlans", "domainId", $_POST['domainId'], "vlanId");
    if ($check_vlan !== false) {
        foreach ($check_vlan as $v) {
            if ($v->number == $_POST['number']) {
                $Result->show("danger", _("VLAN already exists"), true);
            }
        }
    }
}
//if number too high
if ($_POST['number'] > $User->settings->vlanMax && $_POST['action'] != "delete") {
    $Result->show("danger", _('Highest possible VLAN number is ') . $settings['vlanMax'] . '!', true);
}
if ($_POST['action'] == "add") {
    if ($_POST['number'] < 0) {
        $Result->show("danger", _('VLAN number cannot be negative') . '!', true);
Beispiel #5
0
	<!-- divider -->
	<tr>
		<td colspan="2"><h4>Request details</h4><hr></td>
	</tr>

	<!-- Subnet -->
	<tr>
		<th><?php 
    print _('Requested subnet');
    ?>
</th>
		<td>
			<select name="subnetId" id="subnetId" class="form-control input-sm input-w-auto">
			<?php 
    $request_subnets = $Admin->fetch_multiple_objects("subnets", "allowRequests", 1);
    foreach ($request_subnets as $subnet) {
        $subnet = (array) $subnet;
        # print
        if ($request['subnetId'] == $subnet['id']) {
            print '<option value="' . $subnet['id'] . '" selected>' . $Addresses->transform_to_dotted($subnet['subnet']) . '/' . $subnet['mask'] . ' [' . $subnet['description'] . ']</option>';
        } else {
            print '<option value="' . $subnet['id'] . '">' . $Addresses->transform_to_dotted($subnet['subnet']) . '/' . $subnet['mask'] . ' [' . $subnet['description'] . ']</option>';
        }
    }
    ?>
			</select>
		</td>
	</tr>
	<!-- IP address -->
	<tr>
Beispiel #6
0
$Result = new Result();
$Zones = new FirewallZones($Database);
# verify that user is logged in
$User->check_user_session();
if ($_POST['sectionId']) {
    if (preg_match('/^[0-9]+$/i', $_POST['sectionId'])) {
        $sectionId = $_POST['sectionId'];
        print $Subnets->print_mastersubnet_dropdown_menu($sectionId);
    } else {
        $Result->show('danger', _('Invalid ID.'), true);
    }
}
if ($_POST['vlanDomain']) {
    if (preg_match('/^[0-9]+$/i', $_POST['vlanDomain'])) {
        $vlanDomain = $_POST['vlanDomain'];
        $vlans = $Admin->fetch_multiple_objects("vlans", "domainId", $vlanDomain, "number");
        print '<select name="vlanId" class="form-control input-sm input-w-auto input-max-200">';
        if ($vlans == false) {
            print '<option disabled selected>' . _('No VLAN available') . '</option>';
        } else {
            foreach ($vlans as $vlan) {
                print '<option value="' . $vlan->vlanId . '">' . $vlan->number . ' - ' . $vlan->name . ' - ' . $vlan->description . '</option>';
            }
        }
        print '</select>';
    } else {
        $Result->show('danger', _('Invalid ID.'), true);
    }
}
if ($_POST['zoneId']) {
    if (preg_match('/^[0-9]+$/i', $_POST['zoneId'])) {
Beispiel #7
0
?>
			</select>
		</td>
	</tr>
	<tr>
		<!-- vlan -->
		<td>
			<?php 
print _('VLAN');
?>
		</td>
			<?php 
// if there is only one layer2 domain or if there is one already selected, fetch the vlans of that domain
if ($firewallZone->vlanId) {
    // fetch all vlans of that particular domain
    $vlans = $Admin->fetch_multiple_objects("vlans", "domainId", $firewallZone->domainId, "number");
    print '<td><div class="domainVlans"><select name="vlanId" class="form-control input-sm input-w-auto input-max-200">';
    foreach ($vlans as $vlan) {
        if ($firewallZone->vlanId == $vlan->vlanId) {
            print '<option value="' . $vlan->vlanId . '" selected>' . $vlan->number . ' (' . $vlan->description . ')</option>';
        } else {
            print '<option value="' . $vlan->vlanId . '">' . $vlan->number . ' (' . $vlan->name . ' - ' . $vlan->description . ')</option>';
        }
    }
    print '</select></div></td>';
} else {
    // if there are more than one section, use ajax to fetch the subnets of the selected section
    print '<td><div class="domainVlans"></div></td>';
}
?>
	</tr>