_insidious Posted March 24, 2023 Posted March 24, 2023 i wanna make that my script works only one time so at exit the script will be autodestroyed is it possible?
1 XEKEX Posted March 26, 2023 Posted March 26, 2023 after you destroy the script the user can redownload it and executed again ...
0 BadCase Posted March 24, 2023 Posted March 24, 2023 I am pretty sure this can be done by first renaming with os.rename and then removing the renamed file with os.remove 1
0 CmP Posted March 24, 2023 Posted March 24, 2023 What's the point of "auto-destruction" of the file that is executed, if it can be simply backed up before executing it? There are no ways (without using server) to prevent script from being executed more than one time that couldn't be easily bypassed, but if you still need to have that for some reason, basic approach is to check presence of certain file and only continue execution if the file is not present and to create that file right after the check has been passed.
0 MANDO01 Posted March 25, 2023 Posted March 25, 2023 (edited) 14 hours ago, _insidious said: i wanna make that my script works only one time so at exit the script will be autodestroyed is it possible? You can save a file in the device if this file exists delete the script if it's not the execute it You just need a good place to hide this file Edited March 25, 2023 by MANDO01 1
0 MAARS Posted March 25, 2023 Posted March 25, 2023 Just now, MANDO01 said: You just need a good place to hide this file no way, this is easy to bypass, someone can just use a file manager that that list recently created file, or just list everything by date, and got it
0 MANDO01 Posted March 25, 2023 Posted March 25, 2023 1 hour ago, MAARS said: no way, this is easy to bypass, someone can just use a file manager that that list recently created file, or just list everything by date, and got it You can put this file in an root or in the system or in the game data for example
0 _insidious Posted March 25, 2023 Author Posted March 25, 2023 3 hours ago, MANDO01 said: You can put this file in an root or in the system or in the game data for example storing another file is the most useless thing to even suggest, i need the script will get autodestroyed after use
0 MANDO01 Posted March 25, 2023 Posted March 25, 2023 58 minutes ago, _insidious said: storing another file is the most useless thing to even suggest, i need the script will get autodestroyed after use Save a file when the script executed for the first time and if this file exists make the script delete himself so even if he saved a backup it will delete himself when execute
0 MAARS Posted March 25, 2023 Posted March 25, 2023 (edited) 17 hours ago, MANDO01 said: Save a file when the script executed for the first time and if this file exists make the script delete himself so even if he saved a backup it will delete himself when execute That unnecessary, you can delete it right away on the execution, cause when you execute a script, it will be loaded in the memory, and the file source code is no longer needed until next execution 21 hours ago, MANDO01 said: You can put this file in an root or in the system or in the game data for example Not everyone has root privilege, and just like the /root, game data folder is no longer accessible without root on recent android version 10+ Edited March 26, 2023 by MAARS
0 MANDO01 Posted March 26, 2023 Posted March 26, 2023 17 hours ago, MAARS said: That unnecessary, you can delete it right away on the execution, cause when you execute a script, it will be loaded in the memory, and the file source code is no longer needed until next execution Not everyone has root privilege, and just like the /root, game data folder is no longer accessible without root on recent android version 10+ Okay your right do you have another solution
0 MAARS Posted March 26, 2023 Posted March 26, 2023 Just put this on top of your script, the problem here will be that if the user is aware than you script self destruct, he can just make copies and execute the copies each time local f_name = gg.getFile():match("^.+/(.+)$") local nf_name = math.random(10 ^ 9, 10 ^ 10 - 1) .. ".lua" os.rename(f_name, nf_name) os.remove(nf_name) -- Your code start bellow here gg.alert("I have deleted myself.") 1
0 MANDO01 Posted March 27, 2023 Posted March 27, 2023 7 hours ago, MAARS said: Just put this on top of your script, the problem here will be that if the user is aware than you script self destruct, he can just make copies and execute the copies each time local f_name = gg.getFile():match("^.+/(.+)$") local nf_name = math.random(10 ^ 9, 10 ^ 10 - 1) .. ".lua" os.rename(f_name, nf_name) os.remove(nf_name) -- Your code start bellow here gg.alert("I have deleted myself.") And this why I said to store file
0 _insidious Posted March 27, 2023 Author Posted March 27, 2023 19 hours ago, MANDO01 said: And this why I said to store file thanks
Question
_insidious
i wanna make that my script works only one time so at exit the script will be autodestroyed is it possible?
13 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now