Hidden text trick no longer works

Everything else that doesn't fall into one of the other PB categories.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Hidden text trick no longer works

Post by PB »

@Fred: This trick used to work, but doesn't work anymore with v3.92... is
there any way to do the same trick again (to hide text in a compiled exe)?

Code: Select all

; The text "hidden" should NOT appear in a hex editor.
a$=Chr('h')+Chr('i')+Chr('d')+Chr('d')+Chr('e')+Chr('n')
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

otherwise encrypt your text.
if you encrypt some text with the number 1 or 2 or so, you cant just
list it with a debugger.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

pb, that's called 'optimization'... it's what we all want... most of the time :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> otherwise encrypt your text

I know, but that was the easiest way to do it for non-important text. :(

I don't need to encrypt with 128-bit protection or RC4, etc -- just a quick
and easy way to stop casual snooping, and the Chr() method was perfect.
Now I have to write a procedure to decrypt the text. :cry:
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

look in the "Asprotect and purebasic" topic, i just posted a crackme.
In that i have made a small "Xor with password" procedure, you can just take that for simple protections. its rather fast and nearly doesnt use any space

edit:
for making it easier for you, i have cuttet it out for ya:

Code: Select all

Procedure.s dEnc(string.s,pass.s)
  If string.s=""
    ProcedureReturn ""
  Else
    For a=1 To Len(pass.s)
      charval=Asc(Mid(pass.s,i,1))
      myarr=myarr+charval
    Next a
    For i=1 To Len(string.s)
      myenc=Asc(Mid(string.s,i,1)) ! myarr
      mystr.s=mystr.s+Chr(myenc)
    Next i
    ProcedureReturn mystr
  EndIf
EndProcedure 
btw take a look at my crackme anyway..
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> i have cuttet it out for ya

Thanks, but I'm really trying to avoid using a procedure. :)

I've found the following is a bit of a compromise...

Code: Select all

a$=Chr(Asc("h"))+Chr(Asc("i"))+Chr(Asc("d"))+Chr(Asc("d"))+Chr(Asc("e"))+Chr(Asc("n"))
...because in a hex viewer it appears as h.i.d.e.n (with each . representing
a 0-byte character; and note that it doesn't show both d's, which is good).
At least this way you can't directly search the hex view for the word hidden,
although you can visually see it if you scan the view with your eyes. :(

I'll come up with something. :twisted:
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Pupil
Enthusiast
Enthusiast
Posts: 715
Joined: Fri Apr 25, 2003 3:56 pm

Post by Pupil »

Can't you just make an array with the characters in them and add them like you did with Chr()?
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

but either way will be easly readden if i use ollydbg and views the memory of the program.. Or just another program. lot of them. But if you are using "Decrypt on demand" like in my crackme you need to execute the decryption first.. look at my crackme plz :D
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> will be easly readden if i use ollydbg and views the memory of the program

I don't care about the memory being viewed; I only care about the exe itself.
Basically, it's just for hiding some text so nobody will casually notice that it's
there, like an Easter Egg. Using a procedure is too much hassle for what I'm
doing. :) A simple one-liner like at the top of this thread is what I long for.

> look at my crackme plz :D

Okay, I will. :)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Re: Hidden text trick no longer works

Post by Psychophanta »

PB wrote:@Fred: This trick used to work, but doesn't work anymore with v3.92... is
there any way to do the same trick again (to hide text in a compiled exe)?

Code: Select all

; The text "hidden" should NOT appear in a hex editor.
a$=Chr('h')+Chr('i')+Chr('d')+Chr('d')+Chr('e')+Chr('n')
Hi, don't complain. It seems a fixed bug :)
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

hehe well actually if i really want to try get text out of an exe i use my trusted Ollydbg and not any hex editor.
i use a hex editor too, but only for other things.. :P
thanks for looking at my cracke :D

@psycopanta: thats another way to look at it :D
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Hidden text trick no longer works

Post by PB »

Psychophanta wrote: It seems a fixed bug

It wasn't a bug, but an optimization (like blueznl said). I know this because
Fred used to have this done a different way originally, but then changed it.
Originally you'd use Chr(65)+Chr(66) etc, which would hide the text in the
compiled exe, but then a version of PureBasic made it visible again. So
Fred told me to use Chr('a')+Chr('b') instead, which again hid it, but now
v3.92 has it showing again. :( Fred is playing cat-and-mouse with me. :lol:

TheFool wrote: [to] get text out of an exe i use my trusted Ollydbg

It's not that I'm trying hard to disguise the text. It's mainly for safety
reasons, and Easter Eggs. For example, if the user clicks a web link, I
want it to open to a specific site, and not let the user change the URL by
editing the exe with a hex editor. As an Easter Egg example, I'm writing
an app that takes command arguments and I want some of these to be
unknown to the casual user (and not mentioned in my docs either).
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

ah ok that way. i thought you wanted to really hide something so they couldnt see it
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Aha! Sorry, I said nothing, :oops:
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Pupil
Enthusiast
Enthusiast
Posts: 715
Joined: Fri Apr 25, 2003 3:56 pm

Post by Pupil »

As i said earlier, do it like this, if you want to obscure the text:

Code: Select all

Dim Char.s(255)

Restore Characters
Read a$
For i = 1 To Len(a$)
  b$ = Mid(a$, i, 1)
  Char(Asc(b$)) = b$
Next

b$ = Char('H')+Char('e')+Char('l')+Char('l')+Char('o')

Debug b$
End

DataSection
Characters:
Data.s "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234546789"
EndDataSection
Post Reply