/** * dataSize * * A more readable way of viewing the returned float when polling disk size * * @param string $cmd command to execute for data * @return array $results array of command execution results * */ public function getTotalMemory() { try { $Bytes = disk_total_space($drive); $totalBytes = dataSize($Bytes); return $totalBytes; } catch (Exception $e) { } }
<?php require "ettercap_vars.php"; if (isset($_GET[history])) { $log_list = array_reverse(glob($module_path . "log/*.pcap")); if (count($log_list) == 0) { echo "<em>No log history...</em>"; } for ($i = 0; $i < count($log_list); $i++) { $file = basename($log_list[$i], ".pcap"); $info = explode("_", basename($log_list[$i])); echo date('Y-m-d H-i-s', $info[1]) . " - "; echo dataSize($module_path . "log/" . basename($log_list[$i])) . " ["; echo "<a href=\"javascript:load_file('" . $file . ".log');\">view</a> | "; echo "<a href=\"javascript:javascript:location.href='log/" . $file . ".log'\">download</a> | "; echo "<a href=\"javascript:javascript:location.href='log/" . $file . ".pcap'\">pcap</a> | "; echo "<a href=\"javascript:delete_file('" . $file . "');\">delete</a>]<br />"; } } if (isset($_GET[lastlog])) { if ($is_ettercap_running) { $path = $module_path . "log"; $latest_ctime = 0; $latest_filename = ''; $d = dir($path); while (false !== ($entry = $d->read())) { $filepath = "{$path}/{$entry}"; if (is_file($filepath) && filectime($filepath) > $latest_ctime) { $latest_ctime = filectime($filepath); $latest_filename = $entry; }
<?php require "tcpdump_vars.php"; if (isset($_GET[history])) { $dumps_list = array_reverse(glob($module_path . "dumps/*.pcap")); if (count($dumps_list) == 0) { echo "<em>No dump history...</em>"; } for ($i = 0; $i < count($dumps_list); $i++) { if (basename($dumps_list[$i]) != "capture.log") { $info = explode("_", basename($dumps_list[$i])); echo date('Y-m-d H-i-s', $info[1]) . " - "; echo dataSize($module_path . "dumps/" . basename($dumps_list[$i])) . " ["; echo "<a href=\"javascript:javascript:location.href='dumps/" . basename($dumps_list[$i]) . "'\">download</a> | "; echo "<a href=\"javascript:delete_file('" . basename($dumps_list[$i]) . "');\">delete</a>]<br />"; } } }
_mem(); $data = _data(); _step("Creating multiple data ..."); $all = []; for ($i = 0; $i < 100; $i++) { $all[] = $data; _mem(); } _mem(); _var('data'); _step("Pass string value to read"); dataSize($data); _mem(); _var('data'); _step("Pass array value to read"); dataSize($all); _mem(); _var('all'); _step("Pass string value to change"); changeValueOf($data); _mem(); _var('data'); _step("Pass array value to change"); changeValueOf($all); _mem(); _var('all'); // passing by reference to immutable values uses more memory in this case! _step("Pass string reference to change"); changeValueOfReference($data); _mem(); _var('data');
echo "<a href=\"javascript:delete_file('log','" . basename($log_list[$i]) . "');\">delete</a>]<br />"; } } } if (isset($_GET[captures])) { $captures_list = array_reverse(glob($module_path . "captures/*.cap")); if (count($captures_list) == 0) { echo "<em>No capture history...</em>"; } for ($i = 0; $i < count($captures_list); $i++) { $info = explode("_", basename($captures_list[$i])); $BSSID = exec("awk -F, '/BSSID/ {i=1; next} i {print \$1}' " . $module_path . "captures/" . basename($captures_list[$i], ".cap") . ".csv | head -1"); $ESSID = exec("awk -F, '/BSSID/ {i=1; next} i {print \$14}' " . $module_path . "captures/" . basename($captures_list[$i], ".cap") . ".csv | head -1"); $IVS = exec("awk -F, '/BSSID/ {i=1; next} i {print \$11}' " . $module_path . "captures/" . basename($captures_list[$i], ".cap") . ".csv | head -1"); echo date('Y-m-d H-i-s', $info[1]) . " [" . $BSSID . " - " . $ESSID . "] #IVS " . $IVS . " "; echo "| " . dataSize($module_path . "captures/" . basename($captures_list[$i], ".cap") . ".*") . " "; echo "| <a href=\"javascript:delete_file('cap','" . basename($captures_list[$i], ".cap") . "');\">delete</a><br/>"; for ($j = 0; $j < count($output_types); $j++) { $file = basename($captures_list[$i], ".cap") . "." . $output_types[$j]; $tags = array("FILENAME" => $module_path . "captures/" . $file); $custom_command = addslashes(replace_tags($tags, $custom_commands[1])); echo $output_types[$j] . " "; echo "[<a href=\"javascript:location.href='captures/" . $file . "'\">load</a> - "; echo "<a href=\"javascript:execute_custom_script('" . base64_encode($custom_command) . "');\">exec</a>] "; } echo "<br /><br />"; } } if (isset($_GET[deauthtarget])) { if (isset($_GET[deauthtargetClient]) && $_GET[deauthtargetClient] != "") { $cmd = "aireplay-ng -0 " . $_GET[deauthtimes] . " --ignore-negative-one -D -c {$_GET['deauthtargetClient']} -a {$_GET['deauthtarget']} " . $monitorInterface . " &";