| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
Comments:
<0> difeta: mime magic <1> file_info <0> i think there's a PEAR cl*** for it <2> difeta: mime magic, possibly file_info, but there's no 100% sure fire way to check ultimately. <3> ||cw Ahroun thanks <0> file_info work in much the same way as mime magic <4> hi <2> Does MimeMagic look for magic numbers too, or just file extensions? <4> I have cl*** A and child B, how can I do in A constructor: If you are being called from child B do this <0> Ahroun: since it's magic, I'd have to say magic numbers <0> difeta: ms office docs will be the worse, they change their magic number way to often <5> difeta, PECLs fileinfo extension is a 100% sure fire way to do it :) <5> ||cw, is incorrect <5> the fileinfo extension is as correct as any application/OS can be <6> erm <0> why, just becasue they have all the CURRENT magic numbers?
<6> fileinfo is only as accurate as your /etc/mime.types <0> "as any application/OS can be" which is to say, not 100% <7> does anyone have a quick php script that will throw me back a remote shell from my web server? <5> TML: actually, it doesn't use that <6> Davey|Work: Since when? <8> hi, is there a way to get CPU usage in php? <8> and/or memory usage? <0> PoLiZei: read proc and parse it <6> PoLiZei: from /proc <8> ||cw & TML: What is proc? <5> TML it uses what is in /etc/mime-magic <2> Davey: Any system that functions on fileinfo/extention/etc... will be chancey. For example. I could rename mybitmap.bmp to mybitmap.txt -- my file really hasn't changed, just my extension. It's still a bit map. If the system uses magic numbers, it might detect this. But what if I take a text file and start with characters that form the bmp magic number? Now, does it trust my txt extension or my bmp magic number? You can't know for sure, a <0> PoLiZei: unix. on win32 use the perf counter objects <8> err server is fedora core 5 <6> Davey|Work: Oh. Sorry, bad tab complete on /etc/mime<tab> <5> Ahroun, as a linux user, I know this. however magic mime works by reading the file header <2> Davey|Work: which can be forged or changed easily enough, or duplicated. <8> thanks can anyone elonquate on proc? <5> Ahroun, i.e. if it says it's a GIF file, then it's either going to be a valid GIF file, or the application that tries to read it will see it as a malformed GIF ;) <5> Ahroun, my point is, that if fileinfo says it's something, then your computer will think the same thing - which is what the point is <0> PoLiZei: so parse /proc, or maybe /sys. <2> Davey|Work: But that's not quite the point. the point of most people asking mime types is "how do I find out what kinda file this is?" THe answer is, "Here's some really ways to make REALLY good guesses -- but don't rely on them, none of them are 100%" <5> if it says it's a word document, your computer will try to open it in word too (***uming the all mime-magics are equal) and will therefore either be a broken or non-broken file of that type as far as word is concerned <8> oh <8> Forgive me if proc isn't a directory, but I have no /proc directory on my server <8> Is /proc something else <5> Ahroun, but the point is, all application and OS's have the *same* pitfalls, therefore it's 100% correct as it can get ;)\ <5> ;) <0> PoLiZei: try /sys <6> PoLiZei: /proc is a directory on most recent *nix OSes <4> what is the difference between $this->myvar and $this->$myvar? <8> No /proc or /sys in root <5> mompe, one is a variable variable, the other is not <8> er top directory <6> mompe: $this->myvar refers to the property myvar of the instance $this <0> PoLiZei: then you have a chroot jail or a broken system <8> ok <0> in which case, no stats for you <2> Davey: *grins* "100% correct as it can get" is still not quite 100%. ;) I'll yield that the value will be CLOSE to 100% in most situations -- but if it's mission critical, that .0001% chance needs to be accounted for. <8> lol <6> Ahroun: If you create a file that has the same magic number as a GIF file, it's a GIF file. <8> Well, my CP shows stats <5> ||cw, or perhaps a windows system... oh wait, you covered that :) <4> TML, and $this->$myvar? <6> Ahroun: It may be an *INVALID* GIF, but it's a GIF <8> is it possible the directory is hidden somehow? <0> PoLiZei: the CP may be running in a different context <5> TML: thank you :) <6> mompe: Looks in $myvar for a string, and returns the property named what is stored in that string <4> aha ty :) <8> ok <8> well, it's at <serverIP>:<port>/admincp or something like that <8> but ok, thanks anyway guys <0> PoLiZei: I guess it's possible, but that would be and odd setup <2> TML: Remember, I don't do object orientation or XML. To me, a file is nothing more than a named collection of bytes. Meaning is ascribed by the program that opens it. If I open my mybmp.bmp in notepad.exe, it's a perfectly valid, if weird, text file. And if I try to open blah.txt in paint.exe, my program will still try to open it (though it may crash and burn). There's nothing INTRINSIC to the file itself that identifies its type. <6> Ahroun: So you *CAN* say with 100% ***urance that it's a GIF file. What you cannot say is whether or not that's what was intended. <8> I have a GoDaddy virtual dedicated server <2> TML: Which was just the point I think I was making so I'll yield it at that point. <6> Ahroun: You're mistaken. There actually *IS* something intrinsic to the file itself that identifies its type. It's called a magic number. Now, you can choose to ignore that magic number, or violate its precepts, but that doesn't change the fact that the file itself declares what it is. <2> PoLiZei: There's your first mistake. Abandon GoDaddy. <9> $_COOKIE['username']=$_POST['username'];
<9> $_COOKIE['p***word']=$_POST['p***word']; <9> Header("admin.php"); <5> jeez, what the hell do I need to do to get a Pollita around here? *poke* <9> can anyone spot any bugs there? <2> TML: For what you just said to be true, all files would have to begin with magic numbers. <6> GarethTheGreat: What is that suppsoed to do? <6> GarethTheGreat: Header("admin.php");? <6> Ahroun: They do <9> oops, forgot the Location: <9> thanks <5> :) <2> TML: Really... funny. Wow, I've never saved a file with a magic number. Tell me more. <9> ok, other than the missing Location: any bugs? <6> Ahroun: every file you've ever saved has a magic number <5> Ahroun, never used a non-plaintext application then huh? <2> TML: Are you ***erting that these magic numbers are somehow prepended and appended by the OS? <6> Ahroun: Yes. <5> TML: except plain text, right? <5> (i.e. lack of magic number = plain text) <6> Davey|Work: It has a magic number...the NULL byte <5> ah :) <0> GarethTheGreat: ***uming you are sanitizing that cookie before you actualy use it, no <2> TML: I'd call you on that one. But my boss is looking at me funny for being on my laptop this long and this program won't write itself. <5> Ahroun, use a linux OS once in a while, you'll see it in action <5> Ahroun, in that you can remove of change the filetype all you like, but the OS will still see it as the original format <5> chagne the file *extension* not filetype :) <5> Ahroun, or OSX for that matter <5> the only OS that does it wrong in common use today, is windows <2> You won't convince me guys. Not unless you can bring up some documentation of it. <5> wow, you're a moron. <6> Ahroun: Load any file you like in a hex editor some time <2> TML: Do that often as well. <6> Ahroun: Then you've seen the magic bytes <10> is there a function to only show the first character of a variable? <6> e.g., /usr/bin/python2.4 on hashphp.org: 0000000 042577 043114 000401 000001 000000 000000 000000 000000 <6> 0000000 <-- magic bytes <11> jonathan`, is substr not good ? <2> TML: I'm not saying magic bytes don't exist. I'm saying there is no guarantee any particular file type has a magic number. I create files all the time that don't use magic bytes. <12> jonathan: substr() <10> substr, thanks <5> Ahroun, then they don't have a quantifiable file type :) <13> im using DOMDocument's - i have 2 of them, i want to put the first one inside the second one... is that possible? <6> Ahroun: You always have a magic byte. It's either null, or not null, but it's never absent. <11> why in some website and forums , they dont allow to use .htaccess and .htp***wd words ? <2> Davey|Work: Hence why I view files as nothing more than a named collection of bytes. <5> but any professional application will automatically have magic bytes in the file *format* <0> mephis1987_: no idea what you are talking about <5> SupIAmMike, importNode the DOMDocument->documentElement <5> SupIAmMike, the returned DOMElement (make sure you make it a deep import, p*** true to importNode) is then part of the tree on which you called importNode and can then be inserted where you like <13> do i have to import 1 node at a time? <5> SupIAmMike, no, you can make it a recursive import, just import the root element (documentElement) <6> Ahroun: Unless you re-implement your stdio library, you can't write a file without magic bytes. And if you re-implement your stdio library, you're still writing what will be magic bytes to everyone except you. <1> i like how the example at http://us2.php.net/manual/en/function.imagearc.php doesn't work <11> ||cw, u know these words .htaccess and .htp***wd , they allow me to use in my post <11> any idea ? <1> !tell mephis1987_ about u <5> !tell mephis1987_ about g10 <0> mephis1987_: they are more than "words". <2> TML: Just leave it alone already. Until I see the documentation, I will not change my view. <6> Ahroun: What sort of "Documentation" are you looking for? <0> Ahroun: the docs on magic numbers are not hard to find <5> TML: surely there is an RFC on it? :) <14> http://lists.voscur.org/surveys/admin/manage.php what's going on here <14> where and what do i configure to load the mysql extension <15> just php.ini <15> you may just have to uncomment a line <2> TML: Anything that establishes the fact that every operating system ever written and ever will be written uses magic numbers for every single type of file. <8> hehe where is php.ini usually? <1> err... why is $img = imagecreatetruecolor(200, 200); $white = imagecolorallocate($img, 255, 255, 255); making the background black :/ ? <15> depends <6> Davey|Work: Not an RFC, AFAIK, because it's not an internet standard. It's just OS carryover from CP/M and VAX/Unix <13> Davey so $doc->ImportNode($doc2->documentElement) should work? <6> Ahroun: I didn't say "ever will be written" <5> Ahroun, thats the point, they don't all do it, but that doesn't mean they're not in the file. WinXP goes by the extension, most other operating systems could care less about the extension
Return to
#php or Go to some related
logs:
#math #linux #linux #lisp vim behave like notepad #css +linux +windows hlp files
#linux +fuck css #centos
|
|