Script Obfuscation: Difference between revisions

m
Text replacement - "<SyntaxHighlight code="lua">" to "<syntaxhighlight lang="lua">"
m (Text replacement - "</code>" to "</SyntaxHighlight>")
m (Text replacement - "<SyntaxHighlight code="lua">" to "<syntaxhighlight lang="lua">")
Tags: Mobile edit Mobile web edit
Line 6: Line 6:
== How To Obfuscate Source In Lua ==
== How To Obfuscate Source In Lua ==
Many users wish to know how to obfuscate their code. There is no specific way to do so, but they all do the same thing. Here is an example of obfuscating some source and then printing it to the output window:
Many users wish to know how to obfuscate their code. There is no specific way to do so, but they all do the same thing. Here is an example of obfuscating some source and then printing it to the output window:
<SyntaxHighlight code="lua">
<syntaxhighlight lang="lua">
local Source = [==[
local Source = [==[
print("Hello World!")
print("Hello World!")
Line 17: Line 17:


Now most intermediate scripters will probably not understand the source above. The point of this tutorial is not to explain the source, but to demonstrate source obfuscation. What prints after running that code is this:
Now most intermediate scripters will probably not understand the source above. The point of this tutorial is not to explain the source, but to demonstrate source obfuscation. What prints after running that code is this:
<SyntaxHighlight code="lua">
<syntaxhighlight lang="lua">
loadstring('\27\76\117\97\81\0\1\4\4\4\8\0\45\0\0\0\114\101\116\117\114\110\32\102\117\110\99\116\105\111\110\40\41\32\112\114\105\110\116\40\34\72\101\108\108\111\32\87\111\114\108\100\33\34\41\10\32\101\110\100\0\1\0\0\0\2\0\0\0\0\0\0\2\4\0\0\0\5\0\0\0\65\64\0\0\28\64\0\1\30\0\128\0\2\0\0\0\4\6\0\0\0\112\114\105\110\116\0\4\13\0\0\0\72\101\108\108\111\32\87\111\114\108\100\33\0\0\0\0\0\4\0\0\0\1\0\0\0\1\0\0\0\1\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0')()
loadstring('\27\76\117\97\81\0\1\4\4\4\8\0\45\0\0\0\114\101\116\117\114\110\32\102\117\110\99\116\105\111\110\40\41\32\112\114\105\110\116\40\34\72\101\108\108\111\32\87\111\114\108\100\33\34\41\10\32\101\110\100\0\1\0\0\0\2\0\0\0\0\0\0\2\4\0\0\0\5\0\0\0\65\64\0\0\28\64\0\1\30\0\128\0\2\0\0\0\4\6\0\0\0\112\114\105\110\116\0\4\13\0\0\0\72\101\108\108\111\32\87\111\114\108\100\33\0\0\0\0\0\4\0\0\0\1\0\0\0\1\0\0\0\1\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0')()
</SyntaxHighlight>
</SyntaxHighlight>
Line 24: Line 24:
== Decoding Obfuscated Source ==
== Decoding Obfuscated Source ==
Say you want to decode the source of the obfuscated script. Some obfuscations are simple and allow you to just print the source. However, using the obfuscated source above as an example, this is why you simply cannot print the source:
Say you want to decode the source of the obfuscated script. Some obfuscations are simple and allow you to just print the source. However, using the obfuscated source above as an example, this is why you simply cannot print the source:
<SyntaxHighlight code="lua">
<syntaxhighlight lang="lua">
print("\27\76\117\97\81\0\1\4\4\4\8\0\45\0\0\0\114\101\116\117\114\110\32\102\117\110\99\116\105\111\110\40\41\32\112\114\105\110\116\40\34\72\101\108\108\111\32\87\111\114\108\100\33\34\41\10\32\101\110\100\0\1\0\0\0\2\0\0\0\0\0\0\2\4\0\0\0\5\0\0\0\65\64\0\0\28\64\0\1\30\0\128\0\2\0\0\0\4\6\0\0\0\112\114\105\110\116\0\4\13\0\0\0\72\101\108\108\111\32\87\111\114\108\100\33\0\0\0\0\0\4\0\0\0\1\0\0\0\1\0\0\0\1\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0")
print("\27\76\117\97\81\0\1\4\4\4\8\0\45\0\0\0\114\101\116\117\114\110\32\102\117\110\99\116\105\111\110\40\41\32\112\114\105\110\116\40\34\72\101\108\108\111\32\87\111\114\108\100\33\34\41\10\32\101\110\100\0\1\0\0\0\2\0\0\0\0\0\0\2\4\0\0\0\5\0\0\0\65\64\0\0\28\64\0\1\30\0\128\0\2\0\0\0\4\6\0\0\0\112\114\105\110\116\0\4\13\0\0\0\72\101\108\108\111\32\87\111\114\108\100\33\0\0\0\0\0\4\0\0\0\1\0\0\0\1\0\0\0\1\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0")