Motortracker
01-15-2008, 03:43 AM
ok i am making a file for uploading/downloading from an ftp server my problem is when you look at the exe with notepad or a hex editor the username and pass show up example
f t p : / / M y F t p s i t e . c o m U s e r n a m e P a s s w o r d $ c : \ F i l e n a m e . t x t \ P U T R e s p o n s e : R e s p o n s e C o d e ÙN*3™fÏ· ª `Ó“6 F i l e S u c c e s s f u l l y U p l o a d e d .
is there a way to encrypt this info during compile or another way to hide it?
mkaras
01-15-2008, 06:55 AM
It seems that you have simply made your program with the user name and password compiled in as simple string constants. Trying to hide specially encrypted values inside an EXE file is an advanced topic that is beyond the scope of a short reply here. And then may not even be recommended because of the issues it raises with programs that access their EXE directly.
A better way may be to store user name and password information in a separate file. Information to store in this file could be created via some type of registration process that you create. A rather effective scheme used by many programs these days is to have the installer or initial program access make a registration access to your web server. You then email back a registration receipt that contains a registration key and so forth.
You can then use the registration key as the encryption key for securing the password and user name in this separate file.
the master
01-15-2008, 07:02 AM
You could "hide it" by encrypting it, converting to a hex string and storing as it is now. Obviously anyone who desperately wanted to hack in could do but it would make it a lot harder.
I have another suggestion but i dont know if it will work. Maybe someone can comment on it.
dim temp as string
temp="hello"
'Change it to
temp=chr(104) & chr(101) & chr(108) & chr(108) & chr(111)
Motortracker
01-15-2008, 01:30 PM
Thanx guys for the help i just didn't want it in plain text.
dilettante
01-15-2008, 03:18 PM
Far from impenetrable, you could also do something like:
Option Explicit
Private Function Scramble(ByVal S As String) As String
'Simple, low-tech symmetric ASCII text scramble.
Dim Bytes() As Byte
Dim Scram(95) As Byte
Dim I As Integer
For I = 0 To 95
Scram(I) = 95 - I
Next
Bytes = StrConv(StrReverse(S), vbFromUnicode)
For I = 0 To UBound(Bytes)
Bytes(I) = Scram(Bytes(I) - &H20) + &H20
Next
Scramble = StrConv(Bytes, vbUnicode)
End Function
Private Sub Command1_Click()
Text2.Text = Scramble(Text1.Text)
End Sub
Private Sub Form_Load()
Text1.Text = ":-:7+67"
End Sub
Use a separate small program like that to scramble your text. Include the "Scramble()" routine in your real program to unscramble any string values to use them.
In the example above Form_Load() puts a sample scrambled value into Text1 and Command1_Click() unscrambles it into Text2. You can type anything you want into Text1, click Command1, and see the result in Text2.
Because it is symmetric, Scramble() can be used to go either way (scramble or unscramble).