PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Parsa Yazdani   Deb Parser   index.php   Download  
File: index.php
Role: Auxiliary script
Content type: text/plain
Description: Configuration script
Class: Deb Parser
Parse Debian files to extract package information
Author: By
Last change:
Date: 12 days ago
Size: 939 bytes
 

Contents

Class file image Download
<?php
$files_in_dir
= scandir(__DIR__);
$output = shell_exec('cd ' . __DIR__ . ' && ar x file.deb && tar -xf control.tar.gz && tar -xf control.tar.xz');
foreach(
scandir(__DIR__) as $file){
    if(!
in_array($file, $files_in_dir) && $file != 'control')
       
unlink($file);
}
foreach(
explode(PHP_EOL, file_get_contents('control')) as $line){
    if(
str_starts_with($line, 'Package: '))
       
$bundleid = substr($line, 9);
    if(
str_starts_with($line, 'Name: '))
       
$packagename = substr($line, 6);
    if(
str_starts_with($line, 'Depends: '))
       
$depends = substr($line, 9);
    if(
str_starts_with($line, 'Description: '))
       
$description = substr($line, 13);
    if(
str_starts_with($line, 'Author: '))
       
$author = substr($line, 8);
    if(
str_starts_with($line, 'Section: '))
       
$section = substr($line, 9);
    if(
str_starts_with($line, 'Version: '))
       
$version = substr($line, 9);
}
unlink('control');