How to use sw_security_features method of phodevi_system class

Best Phoronix-test-suite code snippet using phodevi_system.sw_security_features

phodevi_system.php

Source:phodevi_system.php Github

copy

Full Screen

...47 'kernel-parameters' => new phodevi_device_property('sw_kernel_parameters', phodevi::std_caching),48 'compiler' => new phodevi_device_property('sw_compiler', phodevi::no_caching),49 'system-layer' => new phodevi_device_property('sw_system_layer', phodevi::std_caching),50 'environment-variables' => new phodevi_device_property('sw_environment_variables', phodevi::std_caching),51 'security-features' => new phodevi_device_property('sw_security_features', phodevi::std_caching)52 );53 }54 public static function sw_username()55 {56 // Gets the system user's name57 if(function_exists('posix_getpwuid') && function_exists('posix_getuid'))58 {59 $userinfo = posix_getpwuid(posix_getuid());60 $username = $userinfo['name'];61 }62 else63 {64 $username = trim(getenv('USERNAME'));65 }66 return $username;67 }68 public static function sw_system_layer()69 {70 $layer = null;71 if(phodevi::is_windows() && pts_client::executable_in_path('winecfg.exe') && ($wine = phodevi::read_property('system', 'wine-version')))72 {73 $layer = $wine;74 }75 else76 {77 // Report virtualization78 $layer = phodevi::read_property('system', 'virtualized-mode');79 }80 return $layer;81 }82 public static function sw_hostname()83 {84 $hostname = 'Unknown';85 if(($bin = pts_client::executable_in_path('hostname')))86 {87 $hostname = trim(shell_exec($bin . ' 2>&1'));88 }89 else if(phodevi::is_windows())90 {91 $hostname = getenv('USERDOMAIN');92 }93 return $hostname;94 }95 public static function sw_vendor_identifier()96 {97 // Returns the vendor identifier used with the External Dependencies and other distro-specific features98 $vendor = phodevi::is_linux() ? phodevi_linux_parser::read_lsb_distributor_id() : false;99 if(!$vendor)100 {101 $vendor = phodevi::read_property('system', 'operating-system');102 if(($spos = strpos($vendor, ' ')) > 1)103 {104 $vendor = substr($vendor, 0, $spos);105 }106 }107 return str_replace(array(' ', '/'), '', strtolower($vendor));108 }109 public static function sw_filesystem()110 {111 // Determine file-system type112 $fs = null;113 if(phodevi::is_macosx())114 {115 $fs = phodevi_osx_parser::read_osx_system_profiler('SPSerialATADataType', 'FileSystem', false, array('MS-DOS FAT32'));116 if($fs == null && pts_client::executable_in_path('mount'))117 {118 $mount = shell_exec('mount 2>&1');119 if(stripos($mount, ' on / (hfs, local, journaled)') !== false)120 {121 $fs = 'Journaled HFS+';122 }123 else if(stripos($mount, ' on / (hfs') !== false)124 {125 $fs = 'HFS+';126 }127 else if(stripos($mount, ' on / (apfs') !== false)128 {129 $fs = 'APFS';130 }131 }132 }133 else if(phodevi::is_bsd())134 {135 if(pts_client::executable_in_path('mount'))136 {137 $mount = shell_exec('mount 2>&1');138 if(($start = strpos($mount, 'on / (')) != false)139 {140 // FreeBSD, DragonflyBSD mount formatting141 /*142 -bash-4.0$ mount143 ROOT on / (hammer, local)144 /dev/da0s1a on /boot (ufs, local)145 /pfs/@@-1:00001 on /var (null, local)146 /pfs/@@-1:00002 on /tmp (null, local)147 /pfs/@@-1:00003 on /usr (null, local)148 /pfs/@@-1:00004 on /home (null, local)149 /pfs/@@-1:00005 on /usr/obj (null, local)150 /pfs/@@-1:00006 on /var/crash (null, local)151 /pfs/@@-1:00007 on /var/tmp (null, local)152 procfs on /proc (procfs, local)153 */154 // TODO: improve this in case there are other partitions, etc155 $fs = substr($mount, $start + 6);156 $fs = substr($fs, 0, strpos($fs, ','));157 }158 else if(($start = strpos($mount, 'on / type')) != false)159 {160 // OpenBSD 5.0 formatting is slightly different from above FreeBSD example161 // TODO: improve this in case there are other partitions, etc162 $fs = substr($mount, $start + 10);163 $fs = substr($fs, 0, strpos($fs, ' '));164 }165 }166 }167 else if(phodevi::is_hurd())168 {169 // Very rudimentary Hurd filesystem detection support but works for at least a clean Debian GNU/Hurd EXT2 install170 if(pts_client::executable_in_path('mount'))171 {172 $mount = shell_exec('mount 2>&1');173 if(($start = strpos($mount, 'on / type')) != false)174 {175 $fs = substr($mount, $start + 10);176 $fs = substr($fs, 0, strpos($fs, ' '));177 if(substr($fs, -2) == 'fs')178 {179 $fs = substr($fs, 0, -2);180 }181 }182 }183 }184 else if(phodevi::is_linux() || phodevi::is_solaris())185 {186 $fs = trim(shell_exec('stat ' . pts_client::test_install_root_path() . ' -L -f -c %T 2> /dev/null'));187 switch($fs)188 {189 case 'ext2/ext3':190 if(isset(phodevi::$vfs->mounts))191 {192 $fstab = phodevi::$vfs->mounts;193 $fstab = str_replace('/boot ', 'IGNORE', $fstab);194 $using_ext2 = strpos($fstab, ' ext2') !== false;195 $using_ext3 = strpos($fstab, ' ext3') !== false;196 $using_ext4 = strpos($fstab, ' ext4') !== false;197 if(!$using_ext2 && !$using_ext3 && $using_ext4)198 {199 $fs = 'ext4';200 }201 else if(!$using_ext2 && !$using_ext4 && $using_ext3)202 {203 $fs = 'ext3';204 }205 else if(!$using_ext3 && !$using_ext4 && $using_ext2)206 {207 $fs = 'ext2';208 }209 else if(is_dir('/proc/fs/ext4/'))210 {211 $fs = 'ext4';212 }213 else if(is_dir('/proc/fs/ext3/'))214 {215 $fs = 'ext3';216 }217 }218 break;219 case 'Case-sensitive Journaled HFS+':220 $fs = 'HFS+';221 break;222 case 'MS-DOS FAT32':223 $fs = 'FAT32';224 break;225 case 'UFSD_NTFS_COMPR':226 $fs = 'NTFS';227 break;228 case 'ecryptfs':229 if(isset(phodevi::$vfs->mounts))230 {231 // An easy attempt to determine what file-system is underneath ecryptfs if being compared232 // For now just attempt to figure out the root file-system.233 if(($s = strrpos(phodevi::$vfs->mounts, ' / ')) !== false)234 {235 $s = substr(phodevi::$vfs->mounts, ($s + 3));236 $s = substr($s, 0, strpos($s, ' '));237 if($s != null && !isset($s[18]) && $s != 'rootfs'&& pts_strings::string_only_contains($s, pts_strings::CHAR_LETTER | pts_strings::CHAR_NUMERIC))238 {239 $fs = $s . ' (ecryptfs)';240 }241 }242 }243 break;244 default:245 if(substr($fs, 0, 9) == 'UNKNOWN (')246 {247 $magic_block = substr($fs, 9, -1);248 $known_magic_blocks = array(249 '0x9123683e' => 'Btrfs',250 '0x2fc12fc1' => 'zfs', // KQ Infotech ZFS251 '0x482b' => 'HFS+',252 '0x65735546' => 'FUSE',253 '0x565a4653' => 'ReiserFS',254 '0x52345362' => 'Reiser4',255 '0x3434' => 'NILFS2',256 '0x5346414f' => 'OpenAFS',257 '0x47504653' => 'GPFS',258 '0x5941ff53' => 'YAFFS',259 '0xff534d42' => 'CIFS',260 '0x24051905' => 'UBIFS',261 '0x1021994' => 'TMPFS',262 '0x73717368' => 'SquashFS',263 '0xc97e8168' => 'LogFS',264 '0x5346544E' => 'NTFS',265 '0xf15f' => 'eCryptfs',266 '0x61756673' => 'AuFS',267 '0xbd00bd0' => 'Lustre',268 '0xaad7aaea' => 'PanFS', // Panasas FS269 '0xf2f52010' => 'F2FS',270 '0xc36400' => 'CephFS',271 '0x53464846' => 'WSLFS',272 '0xca451a4e' => 'BcacheFS'273 );274 foreach($known_magic_blocks as $hex => $name)275 {276 if($magic_block == $hex)277 {278 $fs = $name;279 break;280 }281 }282 }283 break;284 }285 if(strpos($fs, 'UNKNOWN') !== false && isset(phodevi::$vfs->mounts))286 {287 $mounts = phodevi::$vfs->mounts;288 $fs_r = array();289 $fs_checks = array(290 'squashfs' => 'SquashFS',291 'aufs' => 'AuFS',292 'unionfs' => 'UnionFS'293 );294 foreach($fs_checks as $fs_module => $fs_name)295 {296 if(strpos($mounts, $fs_module) != false)297 {298 array_push($fs_r, $fs_name);299 }300 }301 if(count($fs_r) > 0)302 {303 $fs = implode(' + ', $fs_r);304 }305 }306 }307 else if(phodevi::is_windows())308 {309 return null;310 }311 if(empty($fs))312 {313 $fs = 'Unknown';314 }315 return $fs;316 }317 public static function sw_virtualized_mode()318 {319 // Reports if system is running virtualized320 $virtualized = null;321 $mobo = phodevi::read_name('motherboard');322 $gpu = phodevi::read_name('gpu');323 $cpu = phodevi::read_property('cpu', 'model');324 if(strpos($cpu, 'QEMU') !== false || (is_readable('/sys/class/dmi/id/bios_vendor') && pts_file_io::file_get_contents('/sys/class/dmi/id/bios_vendor') == 'QEMU'))325 {326 $virtualized = 'QEMU';327 if(strpos($cpu, 'QEMU Virtual') !== false)328 {329 $qemu_version = substr($cpu, (strrpos($cpu, ' ') + 1));330 if(pts_strings::is_version($qemu_version))331 {332 $virtualized .= ' ' . $qemu_version;333 }334 }335 }336 else if(stripos($gpu, 'VMware') !== false || (is_readable('/sys/class/dmi/id/product_name') && stripos(pts_file_io::file_get_contents('/sys/class/dmi/id/product_name'), 'VMware') !== false))337 {338 $virtualized = 'VMware';339 }340 else if(stripos($gpu, 'VirtualBox') !== false || stripos(phodevi::read_name('motherboard'), 'VirtualBox') !== false)341 {342 $virtualized = 'VirtualBox';343 if($vbox_manage = pts_client::executable_in_path('VBoxManage'))344 {345 $vbox_manage = trim(shell_exec($vbox_manage . ' --version 2> /dev/null'));346 if(is_numeric(substr($vbox_manage, 0, 1)))347 {348 $virtualized .= ' ' . $vbox_manage;349 }350 }351 else if($modinfo = pts_client::executable_in_path('modinfo'))352 {353 $modinfo = trim(shell_exec('modinfo -F version vboxguest 2> /dev/null'));354 if($modinfo != null && pts_strings::is_version(str_ireplace(array('_', 'RC', 'beta'), null, $modinfo)))355 {356 $virtualized .= ' ' . $modinfo;357 }358 }359 }360 else if(is_file('/sys/class/dmi/id/sys_vendor') && pts_file_io::file_get_contents('/sys/class/dmi/id/sys_vendor') == 'Xen')361 {362 $virtualized = pts_file_io::file_get_contents('/sys/class/dmi/id/product_name');363 if(strpos($virtualized, 'Xen') === false)364 {365 $virtualized = 'Xen ' . $virtualized;366 }367 // version string368 $virtualized .= ' ' . pts_file_io::file_get_contents('/sys/class/dmi/id/product_version');369 // $virtualized should be then e.g. 'Xen HVM domU 4.1.1'370 }371 else if(stripos($gpu, 'Microsoft Hyper-V') !== false)372 {373 $virtualized = 'Microsoft Hyper-V Server';374 }375 else if(stripos($mobo, 'Parallels Software') !== false)376 {377 $virtualized = 'Parallels Virtualization';378 }379 else if(is_file('/sys/hypervisor/type'))380 {381 $type = pts_file_io::file_get_contents('/sys/hypervisor/type');382 $version = array();383 foreach(array('major', 'minor', 'extra') as $v)384 {385 if(is_file('/sys/hypervisor/version/' . $v))386 {387 $v = pts_file_io::file_get_contents('/sys/hypervisor/version/' . $v);388 }389 else390 {391 continue;392 }393 if($v != null)394 {395 if(!empty($version) && substr($v, 0, 1) != '.')396 {397 $v = '.' . $v;398 }399 array_push($version, $v);400 }401 }402 $virtualized = ucwords($type) . ' ' . implode('', $version) . ' Hypervisor';403 }404 if($systemd_virt = pts_client::executable_in_path('systemd-detect-virt'))405 {406 $systemd_virt = trim(shell_exec($systemd_virt . ' 2> /dev/null'));407 if($systemd_virt != null && $systemd_virt != 'none')408 {409 switch($systemd_virt)410 {411 case 'kvm':412 $systemd_virt = 'KVM';413 break;414 case 'oracle':415 $systemd_virt = 'Oracle';416 break;417 }418 if($virtualized != null && stripos($virtualized, $systemd_virt) === false && stripos($systemd_virt, $virtualized) === false)419 {420 $virtualized = $systemd_virt . ' ' . $virtualized;421 }422 else if($virtualized == null)423 {424 $virtualized = $systemd_virt;425 }426 }427 }428 return $virtualized;429 }430 public static function sw_environment_variables()431 {432 $check_variables = array('LIBGL', '__GL', 'DRI_', 'DEBUG', 'FLAGS');433 $to_report = array();434 if(stripos(phodevi::read_property('system', 'opengl-driver'), 'Mesa'))435 {436 array_push($check_variables, 'MESA', 'GALLIUM');437 }438 if(isset($_SERVER))439 {440 foreach($_SERVER as $name => &$value)441 {442 foreach($check_variables as $var)443 {444 if(stripos($name, $var) !== false && $name != '__GL_SYNC_TO_VBLANK' && strpos($name, 'GJS') === false)445 {446 array_push($to_report, $name . '=' . $value);447 break;448 }449 }450 }451 }452 return implode(' ', array_unique($to_report));453 }454 public static function sw_security_features()455 {456 $security = array();457 if(pts_client::executable_in_path('getenforce'))458 {459 $selinux = shell_exec('getenforce 2>&1');460 if(strpos($selinux, 'Enforcing') !== false)461 {462 $security[] = 'SELinux';463 }464 }465 // Meltdown / KPTI check466 if(is_file('/sys/devices/system/cpu/vulnerabilities/meltdown'))467 {468 if(pts_file_io::file_get_contents('/sys/devices/system/cpu/vulnerabilities/meltdown') == 'Mitigation: PTI')...

Full Screen

Full Screen

sw_security_features

Using AI Code Generation

copy

Full Screen

1include_once('phodevi_system.php');2$sw_security_features = new phodevi_system();3$sw_security_features->sw_security_features();4include_once('phodevi_system.php');5$sw_security_features = new phodevi_system();6$sw_security_features->sw_security_features();7include_once('phodevi_system.php');8$sw_security_features = new phodevi_system();9$sw_security_features->sw_security_features();10include_once('phodevi_system.php');11$sw_security_features = new phodevi_system();12$sw_security_features->sw_security_features();13include_once('phodevi_system.php');14$sw_security_features = new phodevi_system();15$sw_security_features->sw_security_features();16include_once('phodevi_system.php');17$sw_security_features = new phodevi_system();18$sw_security_features->sw_security_features();19include_once('phodevi_system.php');20$sw_security_features = new phodevi_system();21$sw_security_features->sw_security_features();22include_once('phodevi_system.php');23$sw_security_features = new phodevi_system();24$sw_security_features->sw_security_features();25include_once('phodevi_system.php');26$sw_security_features = new phodevi_system();27$sw_security_features->sw_security_features();28include_once('phodevi_system.php');29$sw_security_features = new phodevi_system();30$sw_security_features->sw_security_features();

Full Screen

Full Screen

sw_security_features

Using AI Code Generation

copy

Full Screen

1require_once 'phodevi.php';2$system = new phodevi_system();3$system->set_system(true);4$system->set_device(true);5$system->set_components(true);6$system->set_sensors(true);7$system->set_software(true);8$system->set_virtual(false);9$system->set_chassis(false);10$system->set_cpu(true);11$system->set_memory(true);12$system->set_network(true);13$system->set_storage(true);14$system->set_graphics(true);15$system->set_audio(true);16$system->set_display(true);17$system->set_input(true);18$system->set_os(true);19$system->set_distro(true);20$system->set_kernel(true);21$system->set_cpu_cache(true);22$system->set_cpu_frequency(true);23$system->set_cpu_voltage(true);24$system->set_cpu_temperature(true);25$system->set_gpu_temperature(true);26$system->set_gpu_frequency(true);27$system->set_gpu_load(true);28$system->set_gpu_memory(true);29$system->set_gpu_utilization(true);

Full Screen

Full Screen

sw_security_features

Using AI Code Generation

copy

Full Screen

1require_once('phodevi.php');2echo phodevi::read_property('system', 'sw_security_features');3array(4) {4 array(2) {5 array(2) {6 bool(true)7 bool(true)8 }9 array(2) {10 bool(true)11 bool(true)12 }13 }14}15require_once('phodevi.php');16echo phodevi::read_property('system', 'sw_security_features')['sw_security_features']['enabled'];17bool(true)18require_once('phodevi.php');19echo phodevi::read_property('system', 'sw_security_features')['sw_security_features']['supported'];20bool(true)21require_once('phodevi.php');22echo phodevi::read_property('system', 'sw_security_features')['sw_security_features']['enabled'];23bool(true)24require_once('phodevi.php');25echo phodevi::read_property('system', 'sw_security_features')['sw_security_features']['supported'];

Full Screen

Full Screen

sw_security_features

Using AI Code Generation

copy

Full Screen

1include_once('phodevi.php');2$system = new phodevi_system();3$system->set_device('sw');4$system->set_component('system');5$system->set_sensor('security_features');6$system->set_type('string');7$system->set_interface('command');8$system->set_output('xml');9$system->set_debug(false);10$system->set_debug_level(0);11$system->set_default(false);12$system->set_format('array');13$system->set_function('sw_security_features');14$system->set_parameter(false);15$system->set_parameter2(false);16$system->set_parameter3(false);17$system->set_parameter4(false);18$system->set_parameter5(false);19$system->set_parameter6(false);20$system->set_parameter7(false);21$system->set_parameter8(false);22$system->set_parameter9(false);23$system->set_parameter10(false);24$system->set_parameter11(false);25$system->set_parameter12(false);26$system->set_parameter13(false);27$system->set_parameter14(false);28$system->set_parameter15(false);29$system->set_parameter16(false);30$system->set_parameter17(false);31$system->set_parameter18(false);32$system->set_parameter19(false);33$system->set_parameter20(false);34$system->set_parameter21(false);35$system->set_parameter22(false);36$system->set_parameter23(false);37$system->set_parameter24(false);38$system->set_parameter25(false);39$system->set_parameter26(false);40$system->set_parameter27(false);41$system->set_parameter28(false);42$system->set_parameter29(false);43$system->set_parameter30(false);44$system->set_parameter31(false);45$system->set_parameter32(false);46$system->set_parameter33(false);47$system->set_parameter34(false);48$system->set_parameter35(false);49$system->set_parameter36(false);50$system->set_parameter37(false);51$system->set_parameter38(false);52$system->set_parameter39(false);53$system->set_parameter40(false);54$system->set_parameter41(false);55$system->set_parameter42(false);56$system->set_parameter43(false);57$system->set_parameter44(false);58$system->set_parameter45(false);59$system->set_parameter46(false);60$system->set_parameter47(false);61$system->set_parameter48(false);62$system->set_parameter49(false);

Full Screen

Full Screen

sw_security_features

Using AI Code Generation

copy

Full Screen

1require_once('/usr/share/php/phodevi/phodevi.php');2$ps = new phodevi_system();3if($ps->sw_security_features())4{5echo "Secure";6}7{8echo "Not Secure";9}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Phoronix-test-suite automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Trigger sw_security_features code on LambdaTest Cloud Grid

Execute automation tests with sw_security_features on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful