Pandora pandora repo/website/native app-manager development


milkshake

Advanced Member
Joined
May 18, 2009
Messages
3,748
Age
40
Location
Rotherham, UK
as part of my mission to build an online app repo im wondering if there is any scripts that I can use that would pull data from the pnd file i.e. icon, pxml data, screenshot maybe a pearl script, or maybe there is away using php?

how can this be achieved anyonw know?
 
It can be done with libpnd. Here you can read a little about it, download the source and build against it, although sadly it isn't extremely well documented. A quick read through the .h files should help you understand though. It's a C++ library however, so I don't know how helpful it would be with PHP. At the very least, maybe you can read it to see how it does things and replicate them in your own script?
 
Can always just look in the last kb or so for the pxml since it is appended to the iso for easy finding; could mount the iso and grab the pxml file from inside, too

Sorry in a burry

Jeffphone
 
Im not sure how I would replicate libpnd using php and even if its possible, I could mount it except there are no php librays that will mount a pnd/iso file.
 
milkshake said:
Im not sure how I would replicate libpnd using php and even if its possible, I could mount it except there are no php librays that will mount a pnd/iso file.
no, but you could create a temporary mount point, mount the file, extract what you need, and then unmount.
Code:
pnd_run.sh /path/to/pnd -m -b pndname
cp /mnt/utmp/pndname/PXML.XML /tmp/blah.xml
pnd_run.sh /path/to/pnd -u -b pndname
something like that
 
Last edited by a moderator:
yeah but I need to extract the files once they are uploaded to the server (this way the user doesnt have to type any application details out on the website it should be populated via the info in the PMXL) how can I create a temporary mount point on my server using php?
 
apperntly with php i can use somthing like this:

Code:
system('mount -t vfat -o rw /dev/hdb1 /home/www/upload',$err);

if($err){
   echo "We have error with number {$err}";
}

But I'm unsure as to what command I would run in the system() function.
If the pnd_run.sh was on the server could I call that from system() do you think?, the thing that gets me with linux is all the privilege's you have to set, im not sure If I can set them on my server or how to do it, or what privilege I should set lol confusion :p
 
Filesystem mounting is typically requires root privileges and, I understand, is not a smart thing to have a server do with user-uploaded content (not entirely sure why, but that's what I've heard). Instead of mounting the files, you can take advantage of the fact that all PNDs will be in either ISO or squashfs format; ISO files can be extracted using 7zip, and squash can be extracted with unsquashfs (part of squashfs-tools). I don't know much about PHP, but you should be able to call these commands through that system() function you showed. Hope that helps.
 
Or as i said.. The pxml is at the end of the file; its goof but just read he last couple K of the pnd and look for thr <PXML and you're good to go; if you dont find it, read some more and look again :)

Jeffphone
 
how would I do that with php? also I need to collect the icon file and the screenshot image and i doubt they will be as easy to collect?

tried reading the file with php, this is the output if the pxml is at the end it would take a miracle to work it out.
 
milkshake said:
how would I do that with php? also I need to collect the icon file and the screenshot image and i doubt they will be as easy to collect?

tried reading the file with php, this is the output if the pxml is at the end it would take a miracle to work it out.
I don't know how you read the file, but there's no PXML in there.
Keeping in mind my php is very, very rusty and I'm probably writing more C than I am PHP here, something like this should do it.
Code:
$pnd = fopen("game.pnd", "r");
$foundPXML = 0;
$seek = 0;
while ($foundPXML < 1)
{
    $seek -= 1000;
    fseek($pnd, $seek);
    $data = fread($pnd, 1000);
    $pxml = strpos($data, "<PXML");
    if ($pxml !== false) break;
}
printf("Found PXML data at %i from the end in %s", ($seek+$pxml), "game.pnd");
Something kinda like that. Fix it up so it's actual php instead of the mishmash of language I've created :p
 
Last edited by a moderator:
The icon and PXML are appended to the iso; screenshot you'd have to mount to get it.

Time for you to learn file operations :)

jeffphone
 
I was reading the file like this.

Code:
$myFile = "xournal.pnd";
$fh = fopen($myFile, 'r');
$theData = fread($fh, 4454400);
fclose($fh);
echo $theData;
 
hmm, there's no way that output you had before was 4MB. Something fishy with the php fread perhaps? Can it read a full 4MB+ file at once?
Try doing like I had before, starting from the end and seeking backwards 1000 bytes at a time.
 
ok my ip has enabled exec() php command now however I cant figure out how to write the desintation I want to extract my files to for example

Code:
unsquashfs xournal.pnd -d ./temp -e PXML.xml

I want to extract files to a temp folder but it keeps extracting to squashfs-root what am I typing wrong?
 
There seems to be two versions of unsquashfs. One goes "unsquashfs [options] filesystem [filelist]"
Try like so
Code:
unsquashfs -d ./temp xournal.pnd PXML.xml
 
looks like my isp doesn't have squashfs installed on the server and apperently it requires a kernel module is loaded to operate, As such, for security reasons, this isn't something they can install on the shared hosting platform.

is there anything apart from squashfs I can use for those that I cant use 7z for? awww man im gutted unsqashfs would have been perfect.
 
milkshake said:
looks like my isp doesn't have squashfs installed on the server and apperently it requires a kernel module is loaded to operate, As such, for security reasons, this isn't something they can install on the shared hosting platform.
That's not quite accurate. Mounting squashfs requires a kernel module, but extracting it only requires an ordinary user-space program. Tell them you need the package squashfs-tools, not squashfs-modules (at least, that's what the packages are called on Debian).
 
Last edited by a moderator:
Tempel said:
milkshake said:
looks like my isp doesn't have squashfs installed on the server and apperently it requires a kernel module is loaded to operate, As such, for security reasons, this isn't something they can install on the shared hosting platform.
That's not quite accurate. Mounting squashfs requires a kernel module, but extracting it only requires an ordinary user-space program. Tell them you need the package squashfs-tools, not squashfs-modules (at least, that's what the packages are called on Debian).

what about listing the contents using unshqashfs;after all I need to find out what files to extract unless all icons and screenshots and pxml files are names the same? does that mount? and if they do install it does it not automatically try and install the kernal module?
 
Last edited by a moderator:
Back
Top