Any thoughts on security

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
AUGE_OHR
Posts: 2065
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Any thoughts on security

Post by AUGE_OHR »

hi Franco,

you can not change Byte in "Header" of File but you can add something "at End" of File
this might be identify as Attack by Antivirus when "infect" a File by add CODE
---
you can not delete a File which is running.
use a *.BAT File for that CODE which you have post as xBase Syntax
have fun
Jimmy
edk
Posts: 914
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Any thoughts on security

Post by edk »

Code: Select all

if file('winlog1.ese')
	copy file winlog1.ese to winlog1.exe                          //This works
	msgbox('You Must Restart Program After Entering the Following')               //This works
	Do While .Not. hb_FileDelete('winlog1.ese')                                          
	     Do events
	End Do
	execute file('winlog1.exe') 
	Do While .Not. hb_FileDelete( 'winlog1.exe')   
	      Do events
	End Do
	cancel
	return
endif	                                             
franco
Posts: 822
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Any thoughts on security

Post by franco »

Thanks Edward, this completely makes sense.
Jimmy try this it works so we could basically send a program to a client that only works only 1 time by erasing it after use inside another program.

Code: Select all

#include <hmg.ch>
local msn := '', memvar

memvar := memoread('winlog1.ese')                                // any hmg .exe program
*msgbox(substr(memvar,79,1))
memowrit('winlog1.ese', substr(memvar,1,78)+substr(memvar,80,len(memvar)-78))   // This takes out the T
copy file winlog1.ese to winlog1.exe                             // changes extention
execute file('winlog1.exe')                                           //Will not run
*msgbox()
memvar := memoread('winlog1.exe')
memowrit('winlog1.exe',subst(memvar,1,78)+'T'+substr(memvar,79,len(memvar)-78))             // This replaces the T
memowrit('winlog1.ese',subst(memvar,1,78)+'T'+substr(memvar,79,len(memvar)-78))
execute file('winlog1.exe')                                    //Then it works
*msgbox()
RETURN
Anyone, give it a try with any hmg program.
Last edited by franco on Sun Dec 10, 2023 9:12 am, edited 1 time in total.
All The Best,
Franco
Canada
franco
Posts: 822
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Any thoughts on security

Post by franco »

Had to adjust previous post.

Code: Select all

#include <hmg.ch>
local memvar
memvar := memoread('winlog1.ese')                                // any hmg .exe program
*msgbox(substr(memvar,79,1))
memowrit('winlog1.ese', substr(memvar,1,78)+substr(memvar,80,len(memvar)-78))          // This takes out the T from exe file
copy file winlog1.ese to winlog1.exe
          execute file('winlog1.exe')      //Will not run
*msgbox()
memvar := memoread('winlog1.exe')
memowrit('winlog1.exe',subst(memvar,1,78)+'T'+substr(memvar,79,len(memvar)-78))             // This replaces the T
memowrit('winlog1.ese',subst(memvar,1,78)+'T'+substr(memvar,79,len(memvar)-78))
	execute file('winlog1.exe')     //Then it works
*msgbox()
RETURN
All The Best,
Franco
Canada
franco
Posts: 822
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Any thoughts on security

Post by franco »

Does anyone know how to stop a program from running from inside another program.
If I execute a program exe2 from inside program exe1 I would like to stop exe1 from running from exe2 so I can modify it or delete it
as EDK subjects above.
If I can do this I have figured a pretty sure way of creating an secure program.
Thanks in advance Franco
All The Best,
Franco
Canada
franco
Posts: 822
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Any thoughts on security

Post by franco »

Have figured out, before deleting as EDK above.
I run the table making exe program from inside main exe program. After tables are made I can write to program while running.
memowrit('winlog1.exe',"winlog")

Code: Select all

                                                      // from inside main exe program
if file('winlog1.ese')                         // These files create the tables for main exe program
	copy file winlog1.ese to winlog1.exe                          //This works
	msgbox('You Must Restart Program After Entering the Following')               //This works
        memowrit('winlog1.ese',"winlog1")
	Do While .Not. hb_FileDelete('winlog1.ese')                                          
	     Do events
	End Do
	execute file('winlog1.exe') 
        memowrit('winlog1.exe',"winlog1")           
	Do While .Not. hb_FileDelete( 'winlog1.exe')   
	      Do events
	End Do                                                             // Now if someone finds the winlog programs they will never work again
                                                                               // We do not need them the tables are created.
	cancel
        return
endif
All The Best,
Franco
Canada
Post Reply