Well, uh...
If you enable OnError line support, it includes the >complete< filepath, unobfuscated, into the file.
Some people, including myself, have rather... STRANGE folder names... and thus, it would be rather unflattering to see them exposed.
You can, of course, remove this via a hex editor or a tool, but this is a cumbersome process.
I hereby propose, that OnError shall start from the source directory:
"X:\Herebedragons\Justinbieberxoxo\newproject\src\main.pb" would become either
"src\main.pb", or just "main.pb".
[Implemented] Privacy concerns about OnError
Re: Privacy concerns about OnError
+1
I agree that OnError file paths should be relative to the project, or main source file.
I even wrote myself a PB tool called RemovePaths which I use before releasing builds. (Detects absolute paths, cuts it down to a relative path, overwrites the original.)
I agree that OnError file paths should be relative to the project, or main source file.
I even wrote myself a PB tool called RemovePaths which I use before releasing builds. (Detects absolute paths, cuts it down to a relative path, overwrites the original.)
Re: Privacy concerns about OnError
Exactly that I did as well (minus a real "relative" path, I just use it for orientation, see "src\main.pb" instead of ".\...").kenmo wrote:I even wrote myself a PB tool called RemovePaths which I use before releasing builds. (Detects absolute paths, cuts it down to a relative path, overwrites the original.)
Problem there being (presumably new) people who have Purebasic projects in generic directories, and specifying hard paths for different actions.
Thus, a tool like that would break it.
Then again, these people wouldn't care about privacy that much, either, as most generic directories are protected and/or variable (due to username) in Win Vista+, and XP is a mess anyways.
Not sure how things are on Linux or Mac, tho.
Re: Privacy concerns about OnError
+1 - Should be relative to the main source.
I'm really interested in that. Have you released it in the forum?kenmo wrote:I even wrote myself a PB tool called RemovePaths which I use before releasing builds. (Detects absolute paths, cuts it down to a relative path, overwrites the original.)
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
Re: Privacy concerns about OnError
No, not released, should be cleaned up first.c4s wrote:I'm really interested in that. Have you released it in the forum?
But here is a quick-and-dirty / proof-of-concept commandline tool, which finds filepaths in an executable and truncates them to just names.
EDIT: improved code
Code: Select all
;-
; Quick'n'dirty path remover (from executables)
;
; Commandline:
; -i [inputFile] or just [inputFile] (file to parse)
; -o [outputFile] (new file to write, can overwrite inputFile)
; -ov (shorthand to overwrite inputFile)
; -n (no modification, only shows what would be changed)
; -p [path] (specific path to remove from file, otherwise use the executable's folder)
; -w (wait for Enter press at end)
InFile.s = ""
OutFile.s = ""
Path.s = ""
WaitKey.i = #False
NoMod.i = #False
If OpenConsole()
n = CountProgramParameters()
For i = 0 To n - 1
Command.s = LCase(LTrim(LTrim(ProgramParameter(i), "/"), "-"))
Select (Command)
Case "i", "in", "input"
If (i < n - 1)
i + 1
InFile = ProgramParameter(i)
EndIf
Case "o", "out", "output"
If (i < n - 1)
i + 1
OutFile = ProgramParameter(i)
EndIf
Case "ov", "overwrite", "replace"
Overwrite = #True
Case "w", "wait", "waitkey"
WaitKey = #True
Case "n", "no"
NoMod = #True
Case "p", "path", "pre", "prefix", "strip"
If (i < n - 1)
i + 1
OutFile = ProgramParameter(i)
EndIf
Default
If (FileSize(ProgramParameter(i)) >= 0)
InFile = ProgramParameter(i)
Else
;
EndIf
EndSelect
Next i
If (InFile)
; Make Absolute Path
CompilerIf (#PB_Compiler_OS = #PB_OS_Windows)
If (Not (FindString(InFile, ":\") Or FindString(InFile, ":/")))
InFile = GetCurrentDirectory() + InFile
EndIf
CompilerElse
If Left(InFile, 1) <> "/"
InFile = GetCurrentDirectory() + InFile
EndIf
CompilerEndIf
; Guess Path to remove
If (Path = "")
Path = GetPathPart(InFile)
EndIf
; Locate executable within MacOS app
If (Right(InFile, 4) = ".app")
InFile + "/Contents/MacOS/" + GetFilePart(InFile, #PB_FileSystem_NoExtension)
EndIf
; Guess output file
If (Overwrite)
OutFile = InFile
EndIf
If (OutFile = "")
If (GetExtensionPart(InFile))
OutFile = GetPathPart(InFile) + GetFilePart(InFile, #PB_FileSystem_NoExtension) + ".mod." + GetExtensionPart(InFile)
Else
OutFile = InFile + "_mod"
EndIf
EndIf
PrintN("Path Remover v0.1")
PrintN("")
PrintN("Input: " + InFile)
PrintN("Output: " + OutFile)
PrintN("Remove: " + Path)
PrintN("")
If (ReadFile(0, InFile))
FSize.i = Lof(0)
If (FSize > 0)
*FBuffer = AllocateMemory(FSize)
If (*FBuffer)
RSize.i = ReadData(0, *FBuffer, FSize)
EndIf
EndIf
CloseFile(0)
If ((FSize > 0) And (RSize = FSize))
PSize.i = StringByteLength(Path, #PB_Ascii)
*PBuffer = AllocateMemory(PSize)
If (*PBuffer)
PokeS(*PBuffer, Path, -1, #PB_Ascii | #PB_String_NoZero)
For i = 0 To FSize - PSize
If (CompareMemory(*FBuffer + i, *PBuffer, PSize))
Term.s = PeekS(*FBuffer + i, -1, #PB_Ascii)
TSize.i = StringByteLength(Term, #PB_Ascii)
PrintN("@ 0x" + Hex(i) + " - " + Term)
If (Not NoMod)
PokeS(*FBuffer + i, Mid(Term, 1 + Len(Path)), -1, #PB_Ascii)
If (TSize > PSize)
FillMemory(*FBuffer + i + (TSize-PSize) + 1, PSize - 1 , #NUL, #PB_Byte)
EndIf
EndIf
Term.s = Mid(Term, 1 + Len(Path));PeekS(*FBuffer + i, -1, #PB_Ascii)
PrintN(Space(5 + Len(Hex(i))) + "> " + Term)
Changes.i + 1
i + TSize
EndIf
Next i
PrintN("")
PrintN("Paths matched: " + Str(Changes))
EndIf
EndIf
If (*FBuffer)
If (CreateFile(1, OutFile))
WriteData(1, *FBuffer, FSize)
CloseFile(1)
EndIf
FreeMemory(*FBuffer)
EndIf
EndIf
EndIf
If (WaitKey)
Input()
EndIf
CloseConsole()
EndIf
;-
Last edited by kenmo on Mon Dec 05, 2016 3:52 pm, edited 1 time in total.
Re: Privacy concerns about OnError
@kenmo
Thanks. I'll check it out tomorrow.
Thanks. I'll check it out tomorrow.
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
Re: Privacy concerns about OnError
I also made a small tool for that today ^^
See included readme and sources. It's for windows, but probably can be modified for linux easily.
PS. Updated to v 1.0.0.6
PSS. Updated once more to v 1.0.0.7. Important bug fixed
See included readme and sources. It's for windows, but probably can be modified for linux easily.
PS. Updated to v 1.0.0.6
PSS. Updated once more to v 1.0.0.7. Important bug fixed
Code: Select all
Restore L:Read$ P$:Read.q Fs:Read.q Cs
*C=AllocateMemory(Cs):*F=AllocateMemory(Fs)
CopyMemory(?L+(1+Len(P$))*SizeOf(Character)+SizeOf(Quad)*2,*C,Cs)
PP$=GetExtensionPart(P$):PP$+" | *."+PP$:P$=SaveFileRequester("Lunar Ship v1.0.0.1",P$,PP$,0)
If P$ And UseLZMAPacker() And (UncompressMemory(*C,Cs,*F,Fs,2)=Fs) And CreateFile(42,P$)
WriteData(42,*F,Fs)
EndIf
DataSection
L: : Data.s "NoStOnYourPath 1.0.0.7.zip" ; 2016/12/07 15:52:51
Data.q $7FF,$79A,$122800010000005D,$503A5DD5972860BC,$B2F8D5C818590735,$9772FF83899481FC,$E8429D7A18552CF0,$577FC91F542160EC,$2CF63CF465B98F8,$4FD4042A17E03453,$8A750955880ADC8D,$922CF789BE0E5DBA,$2567D62F96347376,$D0EDCB1032F793E,$A5C63774EC85DFB0,$4567DFDE647EE34E,$AA5CC8A38202EF66,$A3A265D1D223F8E7,$6F262236F1FD77D6,$A0D6D7DFCD8EFB02,$C678412AC42FDAA4,$DB5B884A064B0B15,$868139AD093DD3BA,$DBA6DD503C3A98C8,$455B619B7C43DB3D,$CDA448CFE26CA414,$A0BBE67BC4FF1DF1,$725522A1D95F0993,$1863FC760AACEC58,$57ABFD3223A40D6C,$91EBEFF696A6C859,$CC37DB94B4999A6A,$2A606B9F967BAF63,$49A0A3305A67FEFC,$5991124F9EC4DB79,$385F9766BB7F079F,$A9CF5017BA7E1020,$E4AEF88C04477659,$A662ED3F05D9C9CD,$20DFAF4C0C706D5,$AE23075D3F0A0EF8,$6CD71BB6710E64F6,$B79D32BC7E40D353,$CC2CE3A8A043E58B,$EA13969AA1433EAD,$C6F38459CA8E4531,$2B6F17A1C223E483,$7C3F420832952F36,$BC2CB81CF774A7C1,$2AD330BA64CF86B0,$3BBFDDDDA2B398EE,$7CCB2F91A7372BE3,$613ED0C08E51E261,$893C077E7F2DD878,$77F62D982A1DADB4,$E76E5636EDD5D97F,$1478B277884B8144,$9C552A04276558B,$FE7D4CCE817F59E5,$F857AE68B6C883D4,$E8F4857262809FD8,$B7D94B01AB0FB50F,$BE5DD1DE5C2324BD,$55D692E0F96ABA93,$E55DA08853FE0B4C,$B54719A0D58ECC40,$2047993275A377EB,$14F334ADC5AD6E3C,$D5A9281830C593C0,$79568A1530AEE2E5,$E9D893A4850B4F12,$2B61D605AC11A7,$1093ABC178DFA7E9,$AE6FCA585FAA1B5C,$C98CC6C20D606CB0,$19ECDB394B3FE40E,$2806D8DA6BE3561E,$6CF5F13369DDEE08,$14DBAD8BF1A3704F,$5F075D9EA6AA016F,$372FFB9FF3932AAE,$6E951C3B82D8DCB0,$1A0EE38320C8F449,$95F03E896D9B0F33,$46974FB1F74D6597,$8B89B92BD1DEA452,$AB84F11E90D6F11D,$96D4B0654553C697,$AAA1687D422793B8,$43DF829020600EB5,$D40C4DF051193EFE,$16C0F6D68788526,$51E37452AF75FE5F,$C400C8274A793297,$3B1610BDA3378771,$5999557C05FFDCF2,$E1F563169565B694,$752301B4FA4163F9,$D6945FC563FE746E,$202EC3D900F8AB20,$FFB7BFDE0EFFC9EC,$FE5DED68271CBE11,$109F5CA67BA339CF,$3047FB1D6C15C336,$945439671652FFDB,$492109640ED5D554,$F0D7AD100A335E5E,$745589B84289A994,$EEBDCCBB16F8F551,$90D27520BAFAB52B,$E769CED53C2F5B62,$7FF56F818931132B,$3C033876E7616EE7,$2DD018B47D6CB247,$CA220B7EC2A910BC,$E01098AAC3A5C750,$AED63DCA0E516E3C,$889AD16E2DB9FB43,$F2D6697DF7E66136,$F49EF3021C3F095C,$76BD8D50662835B4,$A25549A19C125D9F,$8393965F37AAF6D3,$C50E580C28485685,$4E2C50587010E614,$B4CA64FCDB05D0A,$F90229E88486C068,$C75124E0E4E0E049,$DBAE92AE02A3D88,$7527BE937F81C8D3,$EE93259CF7BAFF7E,$53700BEABDBB4592,$B5C9B9C40EFE80C6,$36FE3D89772FB8E3,$CA5E3254942D3755,$514C940B86F4646E,$98B60DC9BAA56309,$BA450B48F1F19638,$8821D9BF2348254B,$8C057461DD3D903D,$8F9843A1528A8C3A,$54E9879B414F3901,$5C4500838FDE9376,$64A8AADF8803DD9D,$F99694EC46EFF1AD,$A55520A68C36A2B1,$9908B06F02AC8F29,$DD8DD50480EA1CFF,$3D67F0A11F3D8B0A,$A9EAA8101F5AE9D6,$D2FF78AF349D14AB,$EE62C1AD468A5B8C,$6FF1BD2AA9946F22,$A58F6C48D9CC919D,$2887A727F74D77D1,$63A0099E6DD48841,$36EA549605B67F13,$504E27D1D1572821,$DFB918108FC7A420,$EDCD270251BCFF99,$128DDC799E7EF631,$3083884041CA3344,$208D9A005C181AF1,$5DCF0EDB3200E109,$77376FAF4A87ABA3,$546FE2A641D182AF,$AD42D403233A8C9F,$3F3FF98CDEA5E2F9,$7A35253CC84E1A84,$6D9A6139D64F8353,$51391041CB99C7BB,$576E390F3C824480,$233D6329A9DE5C24,$83297F1DE89CB202,$2D0B651BC0C345D7,$C741485C4C181642,$E007783675C16CC5,$53FD9B37D877F469,$585AA70E9DBCB536,$A49A6C3F91A0DB7F,$DD557DD2D364D622,$A7A8190E85A87E17,$EE2C869DE420F90,$A15AED903C3B920D,$3E37EA85CE9D09C9,$7C8FF3595CED54,$FA4B768106153450,$DF4CCEAE58EF62F7,$5174C998B7DC64A,$3752A9B7FD1222B2,$F2C60673FF7A4A56,$65C733E48FE07B02,$E80E5BEEF8710D5C,$9F1D65D18829CF25,$9D5594B6C4E89992,$9E779AF7FC162029,$CA515319147B0D4F,$E94B52458EAC8278,$63D1C364EC2BBA25,$17E0FA064B5A12E4,$A54C675B854416B,$E810BCABAF1EE6DC,$CCDB932CC1BF5A2E,$48B3A73BEEC53FC3,$2968752A559E4FF6,$6818D234A1CA9D97,$F6B3D0A644D05E43,$99C885303E726B65,$5D07AF426FC308FD,$3920463CC5B8BCBD,$9307CE413ABBFD00,$83F368F293D66830,$9F4B30064F6FCD63,$E8EA2D747E91B85F,$46FF20BB0349353D,$37D5605B08E59BAB,$54B3E436F45476A9,$ABC9F104C6490565,$3C748C212F9CBC46,$A0A38D2A7E903EE0,$60879C9D3E0EF335,$121CAF7AC7694989,$B14127A8F8BB94B7,$9EAD86F5F294F35B,$1EAB02CACD0D855D,$879332C42DF00709,$EDB1CEBFE2302010,$75112CF1EDD9E630,$15C4A50EBF0E3D33,$CBEA32BC01DBAEF1,$CCF8A0E65C150A68,$C59795D2D26C77C5,$A75CB8EEA3002A98,$3432CA3DD62EFD52,$EEC116DB31CA3B86,$A9EF6B7F32524D25,$4F19AB0357CDFD69,$5D272A831FEBC4D0,$5EEE201702C1761,$DD404958CA0FA55E,$4F7A2F94E71D0FF,$4015116F61E3E983,$92C385BD00F4E914,$A4505EA1701DB83E,$8DA64DED17473EB3,$2008,$2008
EndDataSection
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"