Jump to content
  • 0

Help with gg.prompt


I-Do-Trolling
 Share

Question

So i this code:

local old = gg.getRanges();
  gg.setRanges(gg.REGION_CODE_APP)
  gg.searchNumber ('360', gg.TYPE_FLOAT)
  gg.searchAddress('1C4',FFF)
  v = gg.prompt({i = "[setFov]Select a Number Between 175 and 360"}, {i = "0"})
if v == nil then
  gg.clearResults()
  gg.toast("FoV Unchanged")
else
  gg.getResults (5)
  gg.editAll(v["i"], gg.TYPE_FLOAT, false, gg.SIGN_EQUAL,
  0, -1)
  print("Changed FoV to:" .. v["i"])
  gg.clearResults()
  end

 

But i wanna to turn it off 

Can anyone help me 

Link to comment
Share on other sites

Recommended Posts

  • 0
4 hours ago, DESYROLLERSE said:

there is some way for the ranges selected by people to be entered in this way


gg.setRanges(bit32.bxor(gg.REGION_ANONYMOUS, gg.REGION_BAD, gg.REGION_C_ALLOC))  

and not like that


gg.setRanges(bit32.bxor(gg.REGION_ANONYMOUS))
gg.setRanges(bit32.bxor(gg.REGION_BAD))
gg.setRanges(bit32.bxor(gg.REGION_C_ALLOC))  

that's the problem ....

or is it something very difficult to achieve?


if g.sel[18] == true then
data8 = 'gg.setRanges(bit32.bxor('..g.sel[17]..'))'
addMemoryRanges = on
else
data8 = ''
end
local result8 = tochar(data8) 
dataxx8 = 'load(string.char('..result8..'))()\n'

This way you can do it ... but the person will have to write ...

and what I'm trying to achieve is that it's automatic.

 

I'm going to label with great respect the people that I think may know the solution.

and maybe help or provide an idea or an example.

@bukandewa @noblack

@Revoxtical @Enyby

If for some reason the contribution you can provide is to send me to Google.

With all due respect, I ask you to omit this label.

Any other person who knows Lua and wants to contribute an idea or example will be welcome.

thanks to everyone.

_20190308_063602.JPG

Try this :

local region, checkbox = {}, {}
for v in tostring(gg):gmatch('(REGION.-)\'') do
  table.insert(region, v)
  table.insert(checkbox, 'checkbox')
end
while true do
  local res = {}
  local prompt = gg.prompt(region, nil, checkbox)
  if prompt then
    for k, v in ipairs(prompt) do
      if v then table.insert(res, 'gg.'..region[k]) end
    end
    if res[1] then load('gg.setRanges(bit32.bxor('..table.concat(res, ',')..'))')() end
  else
    break
  end
end

 

Link to comment
Share on other sites

  • 0
2 hours ago, DESTR0LLERSE said:

Hello friends, sorry for not answering ...

I have 2 problems ....

  1. my internet.
  2. I have a message in my account that says: your reactions reached their limit ... you will have to wait 24 hours.

OMG.....

@noblack I'm working on the open source of @bukandewa


g.sel = gg.prompt({
' Select file to compile :',--1
' Select writable path for output :',--2
' Add note/wellcome message\n',--3
'Check this to activate your welcome message.',--4
' Add credits in the print\n',--5
'Check this to activate the credits you wrote.',--6
' Add password\nPut number password in the textbox below',--7
'Check this to activate the password you entered.',--8
' Add limit date. Format year/month/day\ne.g :20191230',--9
'Check this to activate the deadline that you entered.',--10
' Add detect game versions\ne.g : 10121 (OBB Versions PUBGM)',--11
'check this to activate the version you entered.',--12
' Add minimal require GG versions\ne.g : 73.3 (Latest GG Versions)',--13
'check this to activate the GG version that you entered.',--14
' add block load  -  in maintenance',--15
'in maintenance',--16
' add Toast',--17
'Check this to activate your message (toast) that you wrote.',--18
'add REGION_ANONYMOUS',--19
'add REGION_ASHMEM',--20
'add REGION_BAD',--21
'add REGION_C_ALLOC',--22
'add REGION_C_BSS',--23
'add REGION_C_DATA',--24
'add REGION_C_HEAP',--25
'add REGION_CODE_APP',--26
'add REGION_CODE_SYS',--27
'add REGION_JAVA',--28
'add REGION_JAVA_HEAP',--29
'add REGION_PPSSPP',--30
'add REGION_STACK'--31
}, g.sel,{
'file',--1 selected file
'path',--2 output file
'text',--3 add note/wellcome message
'checkbox',--4
'text',--5 add print credits
'checkbox',--6
'text',--7 add password
'checkbox',--8
'text',--9 add limit date
'checkbox',--10
'text',--11 add detect game versions
'checkbox',--12
'text',--13 add minimal require GG versions
'checkbox',--14
'text',--15 block load
'checkbox',--16
'text',--17 add toast
'checkbox',--18
'checkbox',--19 add rank
'checkbox',--20 add rank
'checkbox',--21 add rank
'checkbox',--22 add rank
'checkbox',--23 add rank
'checkbox',--24 add rank
'checkbox',--25 add rank
'checkbox',--26 add rank
'checkbox',--27 add rank
'checkbox',--28 add rank
'checkbox',--29 add rank
'checkbox',--30 add rank
'checkbox'--31 add rank
})

if g.sel[19] == true then
data9 = 'gg.setRanges(bit32.bxor(gg.REGION_ANONYMOUS))'
addMemoryRanges = on
else
data9 = ''
end
local result9 = tochar(data9) 
dataxx9 = 'load(string.char('..result9..'))()\n'

if g.sel[20] == true then
data10 = 'gg.setRanges(bit32.bxor(gg.REGION_ASHMEM))'
addMemoryRanges = on
else
data10 = ''
end
local result10 = tochar(data10) 
dataxx10 = 'load(string.char('..result10..'))()\n'

if g.sel[21] == true then
data11 = 'gg.setRanges(bit32.bxor(gg.REGION_BAD))'
addMemoryRanges = on
else
data11 = ''
end
local result11 = tochar(data11) 
dataxx11 = 'load(string.char('..result11..'))()\n'


if g.sel[22] == true then
data12 = 'gg.setRanges(bit32.bxor(gg.REGION_C_ALLOC))'
addMemoryRanges = on
else
data12 = ''
end
local result12 = tochar(data12) 
dataxx12 = 'load(string.char('..result12..'))()\n'

if g.sel[23] == true then
data13 = 'gg.setRanges(bit32.bxor(gg.REGION_C_BSS))'
addMemoryRanges = on
else
data13 = ''
end
local result13 = tochar(data13) 
dataxx13 = 'load(string.char('..result13..'))()\n'

if g.sel[24] == true then
data14 = 'gg.setRanges(bit32.bxor(gg.REGION_C_DATA))'
addMemoryRanges = on
else
data14 = ''
end
local result14 = tochar(data14) 
dataxx14 = 'load(string.char('..result14..'))()\n'

if g.sel[25] == true then
data15 = 'gg.setRanges(bit32.bxor(gg.REGION_C_HEAP))'
addMemoryRanges = on
else
data15 = ''
end
local result15 = tochar(data15) 
dataxx15 = 'load(string.char('..result15..'))()\n'

if g.sel[26] == true then
data16 = 'gg.setRanges(bit32.bxor(gg.REGION_CODE_APP))'
addMemoryRanges = on
else
data16 = ''
end
local result16 = tochar(data16) 
dataxx16 = 'load(string.char('..result16..'))()\n'

if g.sel[27] == true then
data17 = 'gg.setRanges(bit32.bxor(gg.REGION_CODE_SYS))'
addMemoryRanges = on
else
data17 = ''
end
local result17 = tochar(data17) 
dataxx17 = 'load(string.char('..result17..'))()\n'

if g.sel[28] == true then
data18 = 'gg.setRanges(bit32.bxor(gg.REGION_JAVA))'
addMemoryRanges = on
else
data18 = ''
end
local result18 = tochar(data18) 
dataxx18 = 'load(string.char('..result18..'))()\n'

if g.sel[29] == true then
data19 = 'gg.setRanges(bit32.bxor(gg.REGION_JAVA_HEAP))'
addMemoryRanges = on
else
data19 = ''
end
local result19 = tochar(data19) 
dataxx19 = 'load(string.char('..result19..'))()\n'

if g.sel[30] == true then
data20 = 'gg.setRanges(bit32.bxor(gg.REGION_PPSSPP))'
addMemoryRanges = on
else
data20 = ''
end
local result20 = tochar(data20) 
dataxx20 = 'load(string.char('..result20..'))()\n'

if g.sel[31] == true then
data21 = 'gg.setRanges(bit32.bxor(gg.REGION_STACK))'
addMemoryRanges = on
else
data21 = ''
end
local result21 = tochar(data21) 
dataxx21 = 'load(string.char('..result21..'))()\n'

everything works very well

but the ranges that people select are stored that way.


gg.setRanges(bit32.bxor(gg.REGION_ANONYMOUS))

gg.setRanges(bit32.bxor(gg.REGION_BAD))

gg.setRanges(bit32.bxor(gg.REGION_C_ALLOC))

all ranges were added in the script.

but it is stored badly ..

It would be great when selecting 2, 3, 4, 5, or all ...

stay like this ...

in this case the person selected 4 ranges


gg.setRanges(bit32.bxor(gg.REGION_ANONYMOUS, gg.REGION_BAD, gg.REGION_C_ALLOC, gg.REGION_ASHMEM,))  

or this way

where the person selected 3 ranges


gg.setRanges(bit32.bxor(gg.REGION_ANONYMOUS, gg.REGION_BAD, gg.REGION_C_ALLOC))  

about this code I am working


local g = {}
g.file = gg.getFile()
g.sel = nil
g.config = gg.getFile():gsub('%lua$', '')..'cfg'
g.data = loadfile(g.config)
if g.data ~= nil then
g.sel = g.data()
g.data = nil
end

if g.sel == nil then
g.sel = {g.file, g.file:gsub('/[^/]+$', '')}
end

while true do
g.sel = gg.prompt({
' Select file to compile :',--1
' Select writable path for output :',--2
' Add note/wellcome message\n Result = gg.alert("your text below")',--3
'Check this to add wellcome message',--4
' Add credits in the print\n Result = print("your text below")',--5
'check this to add credits in the print',--6
' Add password\nPut number password in the textbox below',--7
'Check this to add password',--8
' Add limit date. Format year/month/day\ne.g :20191230',--9
'Check this to add limit date',--10
' Add detect game versions\ne.g : 10121 (OBB Versions PUBGM)',--11
'Check this to add detect game versions',--12
' Add minimal require GG versions\ne.g : 73.3 (Latest GG Versions)',--13
'Check this to add minimal require GG versions'
}, g.sel,{
'file',--1 selected file
'path',--2 output file
'text',--3 add note/wellcome message
'checkbox',--4
'text',--5 add print credits
'checkbox',--6
'text',--7 add password
'checkbox',--8
'text',--9 add limit date
'checkbox',--10
'text',--11 add detect game versions
'checkbox',--12
'text',--13 add minimal require GG versions
'checkbox'--14
})

if g.sel == nil then break end
gg.saveVariable(g.sel, g.config)
g.file = g.sel[1]
g.test = loadfile(g.file)
if g.test == nil then
gg.alert('failed to load script: '..g.file)
else
g.name = g.file:match('[^/]+$')
g.path = {g.sel[2]..'/'..g.name, g.file, '/sdcard/'..g.name, gg.getFile():gsub('[^/]+$', '')..g.name, gg.EXT_FILES_DIR..'/'..g.name}
g.doc = nil
g.out = ''
g.try = ''
for i, v in ipairs(g.path) do
g.out = v..".tmp.lua"
g.doc = io.open(g.out, "w")
if g.doc ~= nil then
g.file = v:gsub('%.lua$', '')
break
end
g.try = g.try..' '..v
end		
if g.doc == nil then
gg.alert('Failed write to file. Checked:'..g.try)
else
g.doc:close()
os.remove(g.out)
end

function tochar(data)
x = nil
local tab = {}
res = ''
for i = 1,#data do
sub = string.sub(data,i, i)
xbyte = string.byte(sub)
tab[i] = tonumber(xbyte)
if x == nil then
x = 1
res = res..tab[i]
else
res = res..',\n'..tab[i]
end
end
return res
end

file = io.open(g.sel[1]..'X', 'w')
file:write('')
file:close()
local filex = io.open(g.sel[1], "r") 
assert(filex)

repeat
local data = filex:read("*l")
if data ~= nil then

local smatch1 = string.match(data, "gg.searchNumber")
local smatch2 = string.match(data, "gg.editAll")
local smatch3 = string.match(data, "gg.setRanges")
local smatch4 = string.match(data, "gg.toast")


if smatch1 or smatch2 or smatch3 or smatch4 then

result = tochar(data)
data = 'load(string.char('..result..'))()\n'
file = io.open(g.sel[1]..'X', 'a+')
file:write(data)
file:write("\n")
file:close()
else
file = io.open(g.sel[1]..'X', 'a+')
file:write(data)
file:write("\n")
file:close()
end
end

until data == nil
local file = io.open(g.sel[1]..'X', "r") assert(file) 
local data = file:read("*a") 
file:close()

on = ''
off = ''
limdate = off
detectver = off
addpass = off
ggver = off
addcredit = off
addnote = off

if g.sel[4] == true then
data1 = 'gg.alert("'..g.sel[3]..'")'
addnote = on
else
data1 = ''
end
local result1 = tochar(data1) 
dataxx1 = 'load(string.char('..result1..'))()\n'

if g.sel[6] == true then
data2 = "print('"..g.sel[5].."')"
addcredit = on
else
data2 = ''
end

local result2 = tochar(data2) 
dataxx2 = 'load(string.char('..result2..'))()\n'

if g.sel[8] == true then
data3a = "gpass = gg.prompt({' Input password: '},{[1]=''},{[1]='number'})"
data3b = "if not gpass then os.exit() end if gpass[1] == '"..g.sel[7].."' then gg.toast(' Password correct!')"
data3c = "else gg.alert(' Wrong Password!') os.exit() end"
data3 = data3a..'\n'..data3b..'\n'..data3c
addpass = on
else
data3 = ''
end

local result3 = tochar(data3) 
dataxx3 = 'load(string.char('..result3..'))()\n'

if g.sel[10] == true then
data4 = "if os.date('%Y%m%d') > '"..g.sel[9].."' then gg.alert(' Script expired') os.exit() end"
limdate = on
else
data4 = ''
end

local result4 = tochar(data4) 
dataxx4 = 'load(string.char('..result4..'))()\n'

if g.sel[12] == true then
data5 = "if about.versionCode ~= '"..g.sel[11].."' then gg.alert(' Please open the game first') os.exit() end"
detectver = on
else
data5 = ''
end

local result5 = tochar(data5) 
dataxx5 = 'load(string.char('..result5..'))()\n'

if g.sel[14] == true then
data6 = "if gg.VERSION < '"..g.sel[13].."' then gg.alert(' Please update your GameGuardian') os.exit() end\n"
ggver = on
else
data6 = ''
end

local result6 = tochar(data6)
dataxx6 = 'load(string.char('..result6..'))()\n'

local data = 'about = gg.getTargetInfo()\n'..dataxx1..'\n'..dataxx2 ..'\n'..dataxx3 ..'\n'..dataxx4..'\n'..dataxx5..'\n'..dataxx6..'\n'..data

file = io.open(g.sel[1]..'X', 'w+')
file:write(data)
file:close()

local data = string.dump(loadfile(g.sel[1].. 'X'), true,true)
local data = string.gsub(data, "LuaR", "LuaX", 1)

g.out = g.file..".luaX"
os.remove(g.sel[1]..'X')		
g.doc = io.open(g.out, 'w')
g.doc:write(data)
g.doc:close()

gg.alert("Compile Success!\n\nMenu Added :\n\n"..limdate.."  Limit Date\n"..detectver.."  Detect Game Versions\n"..addpass.."  Add Password\n"..ggver.."  Require GG Versions\n"..addcredit.."  Print Credits\n"..addnote.."  Wellcome Message\n\n File saved to : "..g.out)
break
end
end

 

function tochar(str, sep)
if type(str) == 'string' then
sep = ',' or ''
for i = 1,#str do
bytes = table.concat({string.byte(str, 1,-1)},sep)
end
return "load(string.char("..bytes.."))()\n"
end end

a = "gg.REGION_BAD"
b = "gg.REGION_ANONYMOUS"
c = "gg.REGION_C_ALLOC"

d = "gg.setRanges(bit32.bxor("..a..", "..b..", "..c.."))"
print(d)
--output : gg.setRanges(bit32.bxor(gg.REGION_BAD, gg.REGION_ANONYMOUS, gg.REGION_C_ALLOC))

print(tochar(d))
--output : load(string.char(103,103,46,115,101,116,82,97,110,103,101,115,40,98,105,116,51,50,46,98,120,111,114,40,103,103,46,82,69,71,73,79,78,95,66,65,68,44,32,103,103,46,82,69,71,73,79,78,95,65,78,79,78,89,77,79,85,83,44,32,103,103,46,82,69,71,73,79,78,95,67,95,65,76,76,79,67,41,41))()

I cant understand what do you mean clearly, but maybe code above is helping your case

Link to comment
Share on other sites

  • 0
6 hours ago, DESTR0LLERSE said:

Imagine that we have a script for "deadly combat" that works with 2 memory ranges ...

And that script I need to compile, encrypt, obfuscate ...

The two memory ranges can be any.

Ok then I input to the compiler to encrypt my code and also I select the memory ragos that I need.

As I said earlier, they can be anyone.

example:


gg.setRanges(bit32.bxor(gg.REGION_BAD, gg.REGION_ANONYMOUS))

The previous example shows the correct way to enter the two memory ranges. 

Ok ... But

What happens if the script enters them like this


gg.setRanges(bit32.bxor(gg.REGION_ANONYMOUS))

 


gg.setRanges(bit32.bxor(gg.REGION_BAD))

First the rank "anonymous"

Second the "bad" range ....

What happens is that my game will only look for the values in the last rank that entered .....

which is (gg.REGION_BAB)

That is exactly what happens with this script.

@Revoxtical @bukandewa @noblack

You guys are the cracks in this s*** of lua .. hahaha

You could watch it ... Check it ... And help me find the solution.

script_error.lua

Script cannot look which region is actually needed. 

Why you make it become complicated?

gg.setRanges(gg.REGION_BAD)
gg.searchNumber("1;2;3", gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)

Just put memory region which is needed before searchNumber, then scripts will only search value in memory region selected by scripts.

Link to comment
Share on other sites

  • 0
local old = gg.getRanges();
gg.setRanges(gg.REGION_CODE_APP| gg.REGION_ANONYMOUS) --[will search in both regions]

--[Your code]

gg.setRanges(old) --[will set the regions back to its previous state]

 

_______________________________________________
added 1 minute later
--[example of my own script]


local old = gg.getRanges();
gg.setRanges(gg.REGION_CODE_APP| gg.REGION_C_ALLOC)
gg.searchNumber('1.0E;6.8500028e35F;2.4170348e26F;1.11499989033F:41', gg.TYPE_FLOAT)
t = gg.getResults(4)
gg.addListItems(t)
gg.clearResults()
gg.searchNumber('1.69999992847F;14.0E;1.25699996948F;1.22399997711F:73', gg.TYPE_FLOAT)
if gg.getResultCount() == 0 then gg.toast("before running this script you need to play 1 match, go in match and restart script") os.exit() else
r = gg.getResults(4)
gg.addListItems(r)
gg.clearResults()
gg.setRanges(old)
end

 

Link to comment
Share on other sites

  • 0
8 hours ago, DESTR0LLERSE said:

@bukandewa 

hello, sir, great greeting.

The reason for this label is maybe to find the solution to avoid a compilation error by functions that present this format.

([[

]])

could be added here ?.


local smatch1 = string.match(data, "gg.searchNumber")
local smatch2 = string.match(data, "gg.editAll")
local smatch3 = string.match(data, "gg.setRanges")

Or maybe we should modify these lines ?


function tochar(data)
x = nil
local tab = {}
res = ''
for i = 1,#data do
sub = string.sub(data,i, i)
xbyte = string.byte(sub)
tab[i] = tonumber(xbyte)
if x == nil then
x = 1
res = res..tab[i]
else
res = res..',\n'..tab[i]
end
end
return res
end

 

Maybe your string inside ([[ ]])) is too long. Error log says 'expression too complex'?

To fix that issue you can try to split the string, then concatenate them.

I'll give you an example obsfucate function. It is not protect the scripts from log hooking, but the purposes is, to slower any  'leaker' convert back your code to full original text using tools like unluac or sstool.

--encode
function strToBytes(str)
  local byteArray= { str:byte(1, -1) }
  for i = 1, #byteArray do
  byteArray[i] = byteArray[i] + 100
	encoded = '{' ..table.concat(byteArray, ',') .. '}'
	encoded = 'bytesToStr(' ..encoded .. ')'
	encoded = 'string.dump(load('..encoded..'),true,true)'
	encoded = 'load('..encoded..')()\n'
end
  return encoded
end

--decode
function bytesToStr(byteArray) 
	local output = ""
	for _,b in ipairs(byteArray) do
		output = output .. string.char(b - 100)
	end return output
end

 

Edited by bukandewa
Link to comment
Share on other sites

  • 0
1 hour ago, DESTR0LLERSE said:

@bukandewa 

The solution can be found by observing the code.

Can you enable private messages for a few hours?

to send you the code and find the problem.

I do not want to make the script public.

Just pm, I will try to solve.

Jump to my tele t.me/bukandewa

Edited by bukandewa
Link to comment
Share on other sites

  • 0
2 hours ago, DESTR0LLERSE said:

the test script has only one line and is:

gg.alert([[

Hello]])



Script error: luaj.LuaError: @/storage/emulated/0/New/NewProjectCompiler.lua:601
`local data = string.dump(loadfile(g.sel[1]..'X'), true,true)`
bad argument #1 (nil): function expected, got nil
level = 1, pc = 738
stack traceback:
	/storage/emulated/0/New/NewProjectCompiler.lua:601 in function 'main'
	/storage/emulated/0/New/NewProjectCompiler.lua:649 in function 'switch'
	/storage/emulated/0/New/NewProjectCompiler.lua:278 in function 'initialize'
	/storage/emulated/0/New/NewProjectCompiler.lua:638 in function 'switch'
	/storage/emulated/0/New/NewProjectCompiler.lua:660 in main chunk
	[Java]: in ?
	at luaj.Varargs.argerr(Varargs.java:282)
	at luaj.Varargs.checkfunction(Varargs.java:312)
	at luaj.lib.StringLib$dump.invoke(StringLib.java:194)
	at android.ext.Script$wrap.invoke(Script.java:1085)
	at luaj.lib.VarArgFunction.call(VarArgFunction.java:66)
	at luaj.LuaValue.callNotNull(LuaValue.java:3272)
	at luaj.LuaClosure.execute(LuaClosure.java:438)
	at luaj.LuaClosure.call(LuaClosure.java:145)
	at luaj.LuaValue.callNotNull(LuaValue.java:3233)
	at luaj.LuaClosure.execute(LuaClosure.java:431)
	at luaj.LuaClosure.call(LuaClosure.java:152)
	at luaj.LuaValue.callNotNull(LuaValue.java:3246)
	at luaj.LuaClosure.execute(LuaClosure.java:432)
	at luaj.LuaClosure.call(LuaClosure.java:145)
	at luaj.LuaValue.callNotNull(LuaValue.java:3233)
	at luaj.LuaClosure.execute(LuaClosure.java:431)
	at luaj.LuaClosure.call(LuaClosure.java:152)
	at luaj.LuaValue.callNotNull(LuaValue.java:3246)
	at luaj.LuaClosure.execute(LuaClosure.java:432)
	at luaj.LuaClosure.call(LuaClosure.java:145)
	at android.ext.Script.runScript(Script.java:5276)
	at android.ext.Script$ScriptThread.run(Script.java:5077)

 

The problem is, line break. file:read(*l) will read the file line by line, so it will capture only first line 'gg.alert([['

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.