I am trying to decrypt an encrypted lua code, because:
First: I don't want to create it from the begging.
Second: It sounds fun!
I've created a simple program at Visual Basic 2013 that executes lua functions from a file, the files as you guys can see below contains the encrypted code defined as 'code' in ASCII bytes and my lua code translate it back to the original form.
The problem is: I can translate some words and sign but it still pretty mess, since this is a lua code and contains numbers, signs and words.
The files of the program, as the code encrypted and the code to decrypt can be found at my Gist: https://gist.github.com/DarkShinz/e9aeca7dd1ac1035cf6e ; so you guys can reproduce my so far progress.
I need advices to improve my following code, because, so far, it decrypts some words but others are still just numbers and some signs. Still a mess to the eye.
function tablelength(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
local code = {SOME COMPILED LUA CODE} //Mine is too extensive to be added here
local finalString = "Yay! :"
local codeLength = tablelength(code)
local text = nil
for i = 1, codeLength do
local letter = string.char(code[i])
if (letter:match("%w")) then
elseif (letter:match("%d")) then
elseif (letter:match("%s")) then
elseif (letter:match("%p")) then
elseif (letter:match("%(")) then
elseif (letter:match("%)")) then
elseif (letter:match("%.")) then
elseif (letter:match("%+")) then
elseif (letter:match("%*")) then
elseif (letter:match("%#")) then
elseif (letter:match("%?")) then
elseif (letter:match("%^")) then
elseif (letter:match("%$")) then
elseif (letter:match("%-")) then
elseif (letter:match("%=")) then
elseif (letter:match("%_")) then
elseif (letter:match("%[")) then
elseif (letter:match("%]")) then
elseif (letter:match("%:")) then
elseif (letter:match("%,")) then
elseif (letter:match("%#")) then
elseif (letter:match("%&")) then
else
letra = string.byte(letter)
end
finalString = finalString .. letra
end
print(finalString)
This is my output
I wish I had a full clean lua source code.
Related
To Whom it may concern:
In a Adobe Form there is a Exchange Rate field, the rawValue is based on numeric field that has to be completed by the user.
The following code is what is used to do this under (formCalc, Client):
if (Paid2.selectedIndex == "Cash")then
Exch2.rawValue = AdvCash.rawValue
elseif (Exch2.selectedIndex == "Card") then
Exch2.rawValue = ""
endif
The problem with above code is that once the user type in there own value for Card Exchange rate Exch2.rawValue and made a mistake and reselect "Cash" it does not run the first line of the If statement.
the last part of the question is how to add the following code into the above if then statement
Exch2.rawValue.ui.oneOfChild.border.fill.color.value = " *, *, * "
if (Paid2.selectedIndex == "Cash")then
Exch2.rawValue = AdvCash.rawValue
Exch2.rawValue.ui.oneOfChild.border.fill.color.value = "229, 229, 229"
elseif (Exch2.selectedIndex == "Card") then
Exch2.rawValue = ""
Exch2.rawValue.ui.oneOfChild.border.fill.color.value = "255, 255, 153"
endif
The above fill.color does not provide the desired results.
Hope anybody can assist in this regard
To your first issue:
You are probably running the script in "wrong"(change?) event. Try to run in on exit event of the drop-down list.
To your second issue:
Remove rawValue in the Exch2.rawValue.ui.oneOfChild.border.fill.color.value = "255, 255, 153" and it should be good.
I want to get pixel color from a game and react.
So I have this sript:
#include <Color.au3>
Local $pause = False;
$WinName = "Game" ; Let's say there is a game with this name =)
$hwnd = WinGetHandle($WinName) ; Checked handle with powershell and Au3Info, handle is correct
local $res
Opt("PixelCoordMode", 2);
HotKeySet("{F10}", "exitNow");
HotKeySet("{F11}", "Pause");
While 1
;WinWaitActive($hwnd) ; The script stops here if it is uncommented no matter if window is active or not
if ( $pause ) Then
$res = GetPos();
ConsoleWrite ( StringFormat ("Result color: %s %s", $res[0], $res[1] ) )
Sleep (1000)
EndIf
WEnd
Func exitNow()
Exit
EndFunc
Func Pause()
$pause = Not $pause
EndFunc
Func GetPos()
local $var = Hex(PixelGetColor(5, 5, $hwnd)) ; Only works in windowed mode, FullScreen return some random colors like 00FFFFFF or 00AAAAAA
$var = StringTrimLeft($var,2) ; Removing first 2 numbers they r always 00
local $var1 = Hex(PixelGetColor(15, 5, $hwnd)) ; Only works in windowed mode, FullScreen return some random colors like 00FFFFFF or 00AAAAAA
$var1 = StringTrimLeft($var1,2) ; Removing first 2 numbers they r always 00
local $result[2] = [ $var, $var1 ]
return $result
EndFunc
Main script should before window is active and only then should try to GetPixelColor but that never happens, no matter what I do, i've tried WindowActivate still no result.
a) - What am I doing wrong ? Or may be there is another way to check if window is currently active ?
So at the moment I start script disabled, and when I activate window manually I press F11 to enable.
b) - PixelGetColor only works if game is running in Windowed mode, if it's a fullscreen mode result is unpredictable. Is there a way to make PixelGetColor work in fullscreen.
I've tried to run game x32, x64, DX9 and DX11 in different combinations Fullscreen result is just wrong.
ADDED:
Now While looks like this and that works :)
Thanks to Xenobeologist!!!
While 1
$hwnd = WinGetHandle('[Active]');
If ( $pause ) Then
If WinGetTitle($hwnd) <> $WinName Then
Pause()
ContinueLoop
EndIf
$res = GetPos();
ConsoleWrite ( StringFormat ("Result color: %s %s", $res[0], $res[1] ) )
Sleep (1000)
Else
If WinGetTitle($hwnd) = $WinName Then
Pause()
ContinueLoop
EndIf
EndIf
WEnd
a) is now solved
b) is still not solved. One more thing, topic of this question doesn't say anything bout this question, should add info bout this into the topic or it's better to start a new thread? a) was my main question, it would be prefect to solve b) as well but I can live without it. As far as I understood it's much more complicated. What do you think?
ADDED2:
As far as I understand problem b) can be solved by using more complex code. Here http://www.autohotkey.com/board/topic/63664-solved-imagesearch-failure-wdirectx-fullscreen-gamewin7/ was discussed pretty same problem. It's AHK and ImageSearch function, but im pretty sure that the reason I get wrong colours in fullscreen is the same. I don't want to complicate code that much and PrintScreen is too slow so I'll use windowed mode and wont be bothering with b).
Does this help?
#include <MsgBoxConstants.au3>
$handle = WinGetHandle('[Active]')
ConsoleWrite('!Title : ' & WinGetTitle($handle) & #CRLF)
ConsoleWrite('!Process : ' & WinGetProcess($handle) & #CRLF)
ConsoleWrite('!Text : ' & WinGetText($handle) & #CRLF)
Sleep(Random(10, 3000, 1))
If WinActive($handle) Then MsgBox($MB_SYSTEMMODAL, "", "WinActive" & #CRLF & "Scite ")
My path of file is C:\Documents and Settings\12313\My Documents\Downloads\Bubble_Hit_TSA31DIBX.exe
I wanna run it with sandboxie but anytime redownload,the name of file is changing.
For example:Buble_Hit_**.exe " * " is the changing.
You can use the wildcard feature of FileFindFirstFile and FileFindNextFile to do this easily from AutoIt. The helpfile for those functions contains an example of enumerating over a set of files that match the pattern, but you are only interested in the first, so only have to call FileFindNextFile once.
I would implement it as a function like the following:
; Returns the matching file name.
; If the file could not be found then return an empty string and sets #error to 1
Func _FindFile($wildcard)
Local $hSearch = FileFindFirstFile($wildcard)
If $hSearch = -1 Then Return SetError(1, 0, "")
Local $ret = FileFindNextFile($hSearch)
Local $found = Not #error
FileClose($hSearch)
If Not $found Then Return SetError(1, 0, "")
Return $ret
EndFunc ;==>_FindFile
Which would then be called like this (to find Program Files (x86)):
MsgBox(0, "Test", _FindFile("C:\Program Files (*)"))
Once you have the file name then Run(...) etc. etc. the rest of it should be fairly normal stuff you can find the helpfile.
do until rs1.eof
elseif year(tDate) = year(now) then
elseif rs1("leavetype") = 1 and (rs1("statusLev1") = "z" and rs1("statusLev2") = "z") then
childcare = childcare + rs1("totaldays")
elseif rs1("leavetype") = 28 and (rs1("statusLev1") = "P" and rs1("statusLev2") = "P") then
%>
<script>alert("You are...")
history.go(-1)</script>
<%**
end if
end if
rs1.movenext
loop
rs1.movefirst
After submitting leavetype = 28 ,i can't apply any other leave as the message box is showing.I want to show the message box only if i applied for leave type 28 and status level is p.Otherwise i don't need to the message box for leave 1 or 2.How can i modify..?
Thanks
ASP is executed on the server side, the <script>.... is executed on the client site.
What you are looking for is ( I think )
Response.Write("<script>alert(""You are...""); history.go(-1)<script>")
withgout the %> and <%. So writing the javascript code so that it appears in the client side html .
I need help with the code below.
I try to convert a AutoCAD file from the format dwg to the format dwf.
Then, the dwf file is downloaded and opened on the client computer using a java applet.
The command used to convert the dwg file on the command-line is:
C:\inetpub\wwwroot\COR-Basic\cadviewer\converter\ax2008.exe -i="C:\inetpub\wwwroot\test\container\DU38_EG00_070116.dwg" -o="C:\inetpub\wwwroot\COR-Basic\cadviewer\files\DU38_EG00_070116.dwf" -f=dwf -model -text
this works when I enter the command text in cmd.exe.
But when I call it from my asp.net application, it only starts the process, but the process never ends...
I've tried adding an additional user, have given this user full permission, and full permissions on wwwroot, but it still doesn't work.
Anybody knows what I'm doing wrong, or how I could do it in another way?
If System.IO.File.Exists(strDWGlocation) Then
Dim psiProcessSettings As Diagnostics.ProcessStartInfo = New Diagnostics.ProcessStartInfo
psiProcessSettings.FileName = strApplicationPath
psiProcessSettings.Arguments = " -i=""" & strDWGlocation & """ -o=""" & strOutputLocation & """ -f=dwf -model -text"
'ST-LAPTOP\converter
psiProcessSettings.UserName = "converter"
psiProcessSettings.Password = secureString
'StefanSteiger.Debug.MsgBox("Input location:" + strDWGlocation)
'StefanSteiger.Debug.MsgBox("Output location:" + strOutputLocation)
Response.Write("<h1>Argument1: " + psiProcessSettings.Arguments + "</h1>")
Response.Write("<h1>Pfad1: " + psiProcessSettings.FileName + "</h1>")
'psiProcessSettings.RedirectStandardInput = True
psiProcessSettings.RedirectStandardError = True
psiProcessSettings.RedirectStandardOutput = True 'Redirect output so we can read it.
psiProcessSettings.UseShellExecute = False 'To redirect, we must not use shell execute.
'psiProcessSettings.CreateNoWindow = True ' don't create a window
Dim pConverterProcess As Diagnostics.Process = New Diagnostics.Process
pConverterProcess = Diagnostics.Process.Start(psiProcessSettings) 'Create the process.
pConverterProcess.Start() 'Execute the process.
'Response.Write("<h1>" + Replace(pConverterProcess.StandardOutput.ReadToEnd(), vbCrLf, "<BR />") + "</h1>") 'Send whatever was returned through the output to the client.
'pConverterProcess.CancelOutputRead()
'pConverterProcess.CancelErrorRead()
'pConverterProcess.StandardInput.Close()
'Wait for the process to end.
'pConverterProcess.WaitForExit()
pConverterProcess.Close()
'Dim iExitCode As Integer = pConverterProcess.ExitCode()
pConverterProcess.Dispose()
Else
MyNamespace.Debug.MsgBox("No such file.")
End If
This is my code that does a similar thing, and it works!
process.StartInfo.FileName = toolFilePath;
process.StartInfo.Arguments = parameters;
process.StartInfo.UseShellExecute = false; // needs to be false in order to redirect output
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.RedirectStandardInput = true; // redirect all 3, as it should be all 3 or none
process.StartInfo.WorkingDirectory = Path.GetDirectoryName(toolFilePath);
process.StartInfo.Domain = domain;
process.StartInfo.UserName = userName;
process.StartInfo.Password = decryptedPassword;
process.Start();
output = process.StandardOutput.ReadToEnd(); // read the output here...
process.WaitForExit(); // ...then wait for exit, as after exit, it can't read the output
returnCode = process.ExitCode;
process.Close(); // once we have read the exit code, can close the process
Why have you commented out the WaitForExit()?
You could try setting EnableRaisingEvents to true as well.
In my experience, the Process class is quite difficult to work with when reading the standard output, try removing any code that attempts to redirect and read output