Link to home
Start Free TrialLog in
Avatar of suply
suply

asked on

How can I edit a .prg file

Hello, How can I open a file with extention .prg. I think this is a very old program that was done on foxpro or dbase Im not sure. One of the files stored in data has a file with important information  that need to be opened to view or edit. Please any suggestion on the best way to open the file and see the information it contains.

Thankyou
 
Avatar of tusharkanvinde
tusharkanvinde
Flag of India image

PRG files are plain text files. Notepad should open the file. There should be program code in the PRG file and not data.
Avatar of jrbbldr
jrbbldr

"that need to be opened to view or edit"

Opening a file in Notepad or some other text editor will not do you much good.

Yes, you would probably be able to read the lines of code in the file.

But then what would/could you do with it.  Nothing!

You need to have a copy of FP/VFP to actually edit and compile the prg file so that it might be usable.

Good Luck


Avatar of Cyril Joudieh
You can view or edit the prg file in Notepad or WordPad or any other text editor. If you have the program running from the source or from app that is run with Development Version of FoxPro it will self compile.

Or you can send the prg to someone who has the same version of FoxPro that is running or a previous one and he will compile it for you. I don't know if that is legal though.
Avatar of suply

ASKER

Im trying to retrieve the password and user name to access the program. Im looking at afile that I think has the information stored. Its called password.dbf. Here is a copy of whats inside but I cant see the information I need. All I see is numbers, please help.


`   ‚ H                     USUARIO ÂQåCö_  ( ×~2  åT  ö_j[PASSWORD QåCö_   ×~2  åT  ö_j[MODULO D QåCö_   ×~2  åT  ö_j[
  8987896986778353                        756078788274776344            + 7673828693368683786987                  446068772727272727272727272727+ 7883766982823671698169867583            696243505145272727272727272727+ 7883766982823671698169867583            696243505145272727272727272727, 7673828693368683786987                  446068772727272727272727272727, 7673828693368683786987                  446068772727272727272727272727- 7673828693368683786987                  446068772727272727272727272727. 7673828693368683786987                  446068772727272727272727272727/ 7883766982823671698169867583            696243505145272727272727272727- 7883766982823671698169867583            696243505145272727272727272727. 7883766982823671698169867583            696243505145272727272727272727/ 76738286933681368683786987              4443464752434850              + 7686                                    43505145                      + 7883766982823671698169867583            45515043                      + 7883766982823671698169867583            45515043                      , 7883766982823671698169867583            45515043                      - 7883766982823671698169867583            45515043                      . 7883766982823671698169867583            45515043                      /                                                                       * 80778770738876                          505052522727272727272727272727-

****************************************************************************
Below, is the  menupassword.prg file reads this:

Local Respuesta := "N"
MemVar CaminoDeDatos,CTextos,Clectura
Public CaminoDeDatos
Public CTextos
Public Clectura
If .Not. Clave(1)
   Respuesta = "S"
Endif

Do While  (Respuesta <> "S")
   Clear Screen
   @ 1,1 to 22,79 Double
   @ 7,2 to 7,78
   @ 7,1 say chr(199)
   @ 7,79 say chr(182)
   Set color to U
   @ 2,20 say "C O M P A N Y "
   Set color to (CTextos+","+Clectura)
   @ 3,20 say "DEPARTMENT."
   @ 4,20 to 6,60
   @ 5,21 say "                 CLAVES (password)"
   Set wrap on
   Set Message to 23 Center
   @ 10,20 Prompt "Agregar Usuarios"    Message "Incorporar Usuarios (new users)"
   @ 12,20 Prompt "Borrar Usuarios"     Message "Eliminar Usuarios (eliminate users"
   @ 14,20 Prompt "Modificar Claves"    Message "Modificar PassWord(moify users"
   @ 16,20 Prompt "Retornar"            Message "Retornar al menu anterior return "
   * Captura la opcion del menu
   Menu to Opcion
   Respuesta = "N"
   * Seleccion de la opcion

   Do Case
      Case Opcion = 1
           Do AgreClav
      Case Opcion = 2
           Do BorrClav
      Case Opcion = 3
           Do ModiClav
      Case Opcion = 4
           Respuesta="S"
   EndCase
EndDo
Return


The PRG is neither dBase nor Fox... But it is very similar. The sample code does not handle passwords, it just shows a menu with four options. DBF contains passwords encrypted by some unknown algorithm. You should find some other PRG file which encrypts/decrypts passwords stored to this DBF. The PRG name will be ModiClav.PRG or another PRG having PROCEDURE ModiClav text inside.

FYI, to post a file it is better to add one more extension .TXT and attach it as a file to the posted message.
Avatar of suply

ASKER

Hello, I found the prg name modiclav.prg (a copy is attached). How can I decrypt or get the user and password information inside the dbf file.

Thanks,
MODICLAV.txt
Do you have FoxPro installed?
Avatar of suply

ASKER

I have foxpro 7 installed.
Looking at the code, encryption and decryption is easy:
*-- encryption:
Usuario_1  = "USERNAME"
PassWord_1 = "PASSWORD"

   For i = 1 to Len(Usuario_1)
       Cadena_1 = Cadena_1 + AllTrim(Str(Asc(substr(Usuario_1,i,1))+4))
   Next
   i = 0
   For i = 1 to Len(PassWord_1)
       Cadena_2 = Cadena_2 + AllTrim(Str(Asc(substr(PassWord_1,i,1))-5))
   Next
? "Original  user and password"
? Usuario_1, PassWord_1
? "Encrypted user and password"
? Cadena_1, Cadena_2

*-- decryption from database
USE YourDBF
   For i = 1 to Len(TRIM(Usuario)) STEP 2
       Cadena_1 = Cadena_1 + CHR(VAL(SUBSTR(Usuario, i, 2))-4)
   Next
   i = 0
   For i = 1 to Len(PassWord)
       Cadena_2 = Cadena_2 + CHR(VAL(SUBSTR(Usuario, i, 2))+5)
   Next

? "Database user and password"
? Usuario, PassWord
? "Decrypted user and password"
? Cadena_1, Cadena_2

Open in new window

Avatar of suply

ASKER

Sorry, I have foxpro installed but have no idea how to decrypt it. I havent used foxpro before, dont what to do.

Thanks,
One bug, sorry. The decryption of password should be

   For i = 1 to Len(TRIM(PassWord)) STEP 2
       Cadena_2 = Cadena_2 + CHR(VAL(SUBSTR(Password, i, 2))+5)
   Next
OK, write the following command in FoxPro Command Window:

MODIFY COMMAND decrypt

Edit window appears and inside this window copy the following code (you have to enter correct DBF name). When you finish then you may run the program by CTRL+E.

CLEAR
CLOSE DATA ALL
USE D:\path\YourDBF

BROWSE FIELDS Usuario, Password, User=DecryptUser(Usuario), Pwd=DecryptPwd(Password)

PROCEDURE DecryptUser
LPARAM lcUser
LOCAL Cadena_1
Cadena_1 = ""

   For i = 1 to Len(TRIM(lcUser)) STEP 2 
       Cadena_1 = Cadena_1 + CHR(VAL(SUBSTR(lcUser, i, 2))-4) 
   Next 

RETURN Cadena_1

PROCEDURE DecryptPwd
LPARAM lcPwd
LOCAL Cadena_2
Cadena_2 = ""

   For i = 1 to Len(TRIM(lcPwd)) STEP 2
       Cadena_2 = Cadena_2 + CHR(VAL(SUBSTR(lcPwd, i, 2))+5) 
   Next 

RETURN Cadena_2

Open in new window

Avatar of suply

ASKER

Im unable to run foxpro7 on my machine. Im trying to install in a different machine but I get a message when I insert the installation  CD...."windows setup x This version on windows cannot be installed on this machine". Im not sure if 7 runs on XP Pro.

Thankyou,
And did you read my answer here: https://www.experts-exchange.com/questions/25522988/How-can-I-install-visual-foxpro-7-on-my-pc-getting-an-error-windows-setup.html  ?

VFP 7 is able to run under XP. If you apply all XP service packs the Setup error should be fixed most probably.
Optionally you may send the DBF and I'll add two columns to it.
Avatar of suply

ASKER

Ok, Im sending the dbf...had to save it as .xls; unable to upload dbf by this post.

Thankyou,
Avatar of suply

ASKER

dbf file
CLAVE.xls
It would be better to send it via e-mail from my profile.
ASKER CERTIFIED SOLUTION
Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of suply

ASKER

I apreciate your help, thankyou.
Just FYI, you may post any file when you add .TXT extension. The original ext can remain.

Thanks for points! Used encryption was really easy. To make password more secure it is better to store just some hash calculated from it.