I have a broken Adobe Illustrator file. The person creating the file embedded some images from a remote drive that no longer exists, and it makes Illustrator crash. I think the fix should be rather trivial. Part of the .ai file is text-based XML, that contains remote URLs:
<rdf:li rdf:parseType="Resource">
<stMfs:linkForm>EmbedByReference</stMfs:linkForm>
<stMfs:reference rdf:parseType="Resource">
<stRef:filePath>\\123.45.67.89\path\to\my\file\niceimage.jpg</stRef:filePath>
<stRef:documentID>0</stRef:documentID>
<stRef:instanceID>0</stRef:instanceID>
</stMfs:reference>
</rdf:li>
All that I need to do is to write a short script that would replace all remote URLs with paths to the images on the local drive. The problem is that other parts of the file are binary. When I attempt to open the file with a text reader or with Python, it complains that the file is not UTF8-compatible, and would be corrupt if saved. Is there a way to edit only the text part of such half-text, half-binary file, leaving the binary part untouched? A solution using python, bash, sed or whatever you love most would be appreciated.
Related
I've been asked to set up a laravel app that, when running on a remote desktop, will accept two files via api: a .txt file and a .zip file. The text file would contain cmd prompt commands (e.g. 'ls'). The aim is then for the app to process the contents of the .zip file using the instructions in the .txt file and then return the result to the client (e.g. perhaps another text file with a list of the files in the zip file).
Struggling to know how best to approach it. I know the question is very vague (it's all I have) but very much appreciate any suggestions.
I recently installed WordPress on my hosting server and all went fine, however one of my pages "/wp-admin/update-core.php" is having issues. Upon opening, the file appears to be cut off mid way.
I've compared this file against the file in the zip file I uploaded and the original copy is not truncated.
Where this gets even weirder is that, if I edit the file on the server to paste in the missing code, after I save and open again, the file is still missing the code I just added AND is now missing an additional line of code.
I've also tried deleting the file, and re-uploading the original copy again and it appears to be cutting off at the same point.
Anyone experienced this or have any ideas?
I've got a similar problem with v3.37.3 - uploaded .zip file is truncated, and .svg files have zero length. This is true even when I set the transfer type to 'binary' rather than 'auto'. Also, when repeating the copy operation for the .zip file, I am prompted more than once to confirm the overwrite of th eexisting file, almost as though Filezilla sees several files instead of just the one .zip archive.
I had the same problem. I uploaded a file (a Linux executable) and it was truncated from 4,396,728 bytes to 4,392,145 bytes. My fix was to change the transfer type, which you can set using the Transfer menu, from Auto to Binary. I guess that FileZilla assumes that files with no extension are text; other files, with extensions dmg (Apple disk image) and zip (compressed file) were correctly treated as binary. I am using a very recent version of FileZilla: 3.29.0.
I am in the middle of a discussion with a friend of mine. The question is, if you can edit a (For example jpg) file so that windows opens another (jpg) file by using a hex Editor.
So basically you have a file saved on your desktop. Now if you open this file, another file with the same extension should open. I did not found anything on the internet so hopefully someome here can answer the question.
Thanks in advance
Peter
No it is not possible. Path information is not stored in file, but in storage system metadata, for example:
Windows uses NFTS file system: In NTFS, all file, directory and metafile data—file name, creation date, access permissions (by the use of access control lists), and size—are stored as metadata in the Master File Table (MFT) (https://en.wikipedia.org/wiki/NTFS#Metafiles)
Here is link to good answer on how to access metadata on different filesystems: Where filesystems store their file metadata
What you can do thought is to disguise .exe file as jpg file, and make this .exe file open another, real jpg file:
https://www.reddit.com/r/hacking/comments/2me7qn/hide_exe_within_a_jpg_or_any_other_extension/
I'm new to ruby ... and shoes... and programming but here is my prob:
I made a timer which puts the timed amount into a txt file as a log. It also keeps an all time running total in a separate txt file. It works as I want it to...
I tried packaging it:
If I package the rb file it doesn't work, it will only work if I package the entire folder including the txt files.
This working copy seems to operate without txt files (they are somehow built-in. Is there a way to package this so I still have access to the associated txt files. (maybe has something to do with the paths...)
thanks.
Shoes Packager behaviour is sometimes ugly. I think you're using windows, so i'll try to explain what seems to happen:
You have a bundled Shoes-App (a standalone .exe file). Every Time you start it by double clicking, it will extract itself in a new temp dir (located under c:\tmp\tempFileDirectory). So, it is a NEW temporary Directory, everytime!
The current path also is set to this tmp directory, which also includes the txt files you bundled into the app, in it's original state. If you change the content of the files during the app execution, and restart the app, your changes are gone, because in the new created tmp dir, there is a fresh copy of the original txt files. so far, it is a BAD idea to put your data files (txt in your case, or SQLITE-database-files, or config files, ...) into the bundles app.
Better way:
create a "hidden" folder (folder's name should start with an ".") in the user's home folder. On windows it should be something like "c:\Users\YourName". Create there everything you need, this directory won't be temporal, so you can access it everytime without problems. This should general be a better solution when programming desktop stuff, not just while using shoes.
My windows co-workers were asking me if I could modify my non-windows binary files such that when their "Properties" are examined under Windows, they could see a "Version" tab like that which would show for a Visual Studio compiled exe.
Specifically, I have some gzipped binary files and was wondering if I could modify them to satisfy this demand. If there's a better way, that would be fine, too.
Is there a way I could make my binaries appear to be exe files?
I tried simply appending the VS_VERSION_INFO block from notepad.exe to the end of one of my binaries in the hope that Windows scans for the block, but it didn't work.
I tried editing the other information regarding Author, Subject, Revision, etc. That doesn't modify the file, it just creates another data fork(what's the windows term?) for the file in NTFS.
It is not supported by windows, since each file type has their own file format. But that doesn't mean you can't accomplish it. The resources stored inside dlls and exes are part of the file format.
Display to the user:
If you wanted this information to be displayed to the user, this would probably be best accomplished with using a property page shell extension. You would create a similar looking page, but it wouldn't be using the exact same page. There is a really good multi part tutorial on shell extensions, including property pages starting with that link.
Where to actually store the resource:
Instead of appending a block to the file, you could store the resource into a separate alternate data stream on the same file. This would leave the original file stream non corrupted on disk and not cause its primary file size to change.
Alternate data streams allow more than one data stream to be associated with a filename. Each stream is identified by a colon : at the end of the filename and an identifier.
You can create them for example by doing:
notepad test.txt:adsname1
notepad test.txt:adsname2
notepad test.txt
Getting the normal Win32 APIs working:
If you wanted the normal API to work, you'd have to intercept the Win32 APIs: LoadLibraryEx, FindResource, LoadResource and LockResource. This is probably not worth the trouble though since you are already creating your own property page.
Can't think of any way to do this short of a shell extension. The approach I've taken in the past is a separate "census" program that knows how to read version information from any kind of file.
Zip files can be converted into exe files by using a program that turns a zip file into a self-extracting zip (I know that WinZip does this, there are most likely free utilities for this also; here's one that came up on a search but I haven't actually tried it). Once you've got an exe, you should be able to use a tool like Resource Hacker to change the version information.
It won't work. Either Windows would have to know every file format or no file format would be disturbed if version information were appended to it.
No, resource section is only expected inside PE (portable executable; exe, dll, sys).
It is more then just putting the data inside the file, you have a table that points to the data in the file header.
What you can do if you have NTFS drive, is to use NTFS stream to store custom properties this way the contact of the binary file will remain the same, but you will need to use a custom shell extension to show the content of the stream.