#147 escape filenames during (obfuscated) as export
> What steps will reproduce the problem? run the following command ffdec.bat -export as c:\xx SWFCrytest_Cryout.swf > What is the expected output? What do you see instead? expected: .as files are written lot of exceptions, because the filenames are invalid: java.io.FileNotFoundException: c:\xx\-@@*.as (The filename, directory name, or volume label syntax is incorrect) at java.io.FileOutputStream.open(Native Method) at java.io.FileOutputStream.<init>(Unknown Source) at java.io.FileOutputStream.<init>(Unknown Source) at com.jpexs.decompiler.flash.abc.ScriptPack.export(ScriptPack.java:67) at com.jpexs.decompiler.flash.abc.ABC$ExportPackTask.run(ABC.java:597) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) > What version of the product are you using? On what operating system? 1.6.3, win7 x64 > Please provide any additional information below. Attach the file you have problem with if neccessary. If you do not want to publish files YOU CAN CHANGE VISIBILITY TO PRIVATE please escape the filenames. Maybe you can use this function: http://stackoverflow.com/questions/1184176/how-can-i-safely-encode-a-string-in-java-to-use -as-a-filename Or just a simple urlencode.
SWFCrytest_Cryout.swf (188 KiB)
Please encode the foldernames, too (packagenames)
Sorry, urlencode it not OK for filenames, because it won't encode "*" character. Maybe you can use the attached function. And modify the last line of the getPath method in ScriptPack.java to: return FileNameEncoder.encodeFileName(packageName) + "." + FileNameEncoder.encodeFileName(scriptName); I tried the last 15 swfs from the issues (from other users), and every encoded filename was OK with this method. (It was written by me, no license is required, you can modify it freely)
FileNameEncoder.java (2 KiB)
If I change filename, I should change class name too, otherwise it is uncompilable. Do you know there is rename identifiers feature which will rename invalid identifiers? (Menu Tools->Deobfuscation)
Yes, i understand that the filename and the classname will be diffrent, therefore the code will be uncompilable. The escaping is just for the obfustaced classes (escaped names for valid classnames should be the same as unescaped). They are not compilabe anyway. It is just for enable saving the opfuscated codes. In my opinion it is better to save them with anoher filename than getting an exception. Yes, i tried the rename identifiers feature, it is very cool:) But i understad if you dont want to save the files with diffrent name from classname. Thanks.
version 1.6.4 was released modified version of your class was used, try it
Tried it, it is working. Thank you.