[Help / Question] Is there a way to encrypt a program?
#1
Posted 31 August 2012 - 05:50 PM
I want to have a program of mine to be un-readable by a user unless they decrypt it (out of game or in-game are both fine), but still be able to be run from a computer. I run my own server and I want some programs to be forced upon the user and un-editable, I already have got some help with some code to put and keep the program on a given computer.
Thanks for the help!
#2
Posted 31 August 2012 - 06:13 PM
#3
Posted 31 August 2012 - 06:20 PM
OmegaVest, on 31 August 2012 - 06:13 PM, said:
ok thanks, if anyone else has a idea i would appreciate the input
#4
Posted 31 August 2012 - 06:56 PM
CODE:
args={...}
function printUsage()
print("Usage: compile <program> <compiledprogram>")
end
if #args<1 or #args>2 then
printUsage()
return
end
p1=args[1]
p2=args[2]
if not fs.exists(p1) or fs.isDir(p1) then
print("File doesn't exist or is a dir")
return
end
if fs.exists(p2) then
print("File exists.")
return
end
local r=fs.open(p1, "r")
body=r.read()
r.close()
r=nil
local w=fs.open(p2, "w")
local str=string.dump(body) --compiles the string
local w.write(str)
w.close()
This should work: 1st arg=Program to compile, 2nd arg=Output File
And you should can run this like an normal program...
An other way is to download the StrUtils API from tomass1997 and encrypt the file with a key, and then you can decrypt the file on an other PC using the decrypt function of the StrUtils API.
#5
Posted 01 September 2012 - 05:29 PM
ardera, on 31 August 2012 - 06:56 PM, said:
CODE:
args={...}
function printUsage()
print("Usage: compile <program> <compiledprogram>")
end
if #args<1 or #args>2 then
printUsage()
return
end
p1=args[1]
p2=args[2]
if not fs.exists(p1) or fs.isDir(p1) then
print("File doesn't exist or is a dir")
return
end
if fs.exists(p2) then
print("File exists.")
return
end
local r=fs.open(p1, "r")
body=r.read()
r.close()
r=nil
local w=fs.open(p2, "w")
local str=string.dump(body) --compiles the string
local w.write(str)
w.close()
This should work: 1st arg=Program to compile, 2nd arg=Output File
And you should can run this like an normal program...
An other way is to download the StrUtils API from tomass1997 and encrypt the file with a key, and then you can decrypt the file on an other PC using the decrypt function of the StrUtils API.
I just have one question, if I use this API would it have to be on a server or just my client?
#6
Posted 01 September 2012 - 08:40 PM
#7
Posted 01 September 2012 - 09:36 PM
Matrixmage, on 01 September 2012 - 05:29 PM, said:
#8
Posted 01 September 2012 - 09:39 PM
MysticT, on 01 September 2012 - 09:36 PM, said:
Matrixmage, on 01 September 2012 - 05:29 PM, said:
I was talking about the StrUtils API that he mentioned, I just need to know if it needs to be on the server and the client or just the client.
#9
Posted 01 September 2012 - 09:52 PM
Well, you would need to have it when encrypting and decrypting it, so it has to be in both. But you can't run the program while encrypted, you need to decrypt it to a new file and then run it.
#10
Posted 01 September 2012 - 10:05 PM
MysticT, on 01 September 2012 - 09:52 PM, said:
Well, you would need to have it when encrypting and decrypting it, so it has to be in both. But you can't run the program while encrypted, you need to decrypt it to a new file and then run it.
Ok... so only the two people who are encrypting and decrypting need the api?
Also is there any way at all to make a program un-readable but sill run-able?
#11
Posted 01 September 2012 - 10:09 PM
#12
Posted 02 September 2012 - 01:45 AM
#13
Posted 02 September 2012 - 02:15 AM
ardera, on 31 August 2012 - 06:56 PM, said:
CODE:
args={...}
function printUsage()
print("Usage: compile <program> <compiledprogram>")
end
if #args<1 or #args>2 then
printUsage()
return
end
p1=args[1]
p2=args[2]
if not fs.exists(p1) or fs.isDir(p1) then
print("File doesn't exist or is a dir")
return
end
if fs.exists(p2) then
print("File exists.")
return
end
local r=fs.open(p1, "r")
body=r.read()
r.close()
r=nil
local w=fs.open(p2, "w")
local str=string.dump(body) --compiles the string
local w.write(str)
w.close()
This should work: 1st arg=Program to compile, 2nd arg=Output File
And you should can run this like an normal program...
An other way is to download the StrUtils API from tomass1997 and encrypt the file with a key, and then you can decrypt the file on an other PC using the decrypt function of the StrUtils API.
I ran your code and I got unexpected symbol on line 25...
Can I get some help?
#14
Posted 02 September 2012 - 02:20 AM
w.write(str)
#15
Posted 02 September 2012 - 02:25 AM
#16
Posted 02 September 2012 - 02:37 AM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











