Created
February 11, 2016 09:20
-
-
Save ar1a/842d28c54cb1b5278f0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--converts string to shellcode string | |
local useconsoleargs = false | |
local function converttocha(str) | |
if str == nil then print ("Error - no string passed!") return end | |
local length = #str + 1 | |
-- will break variable name if special characters in the string (". / * etc") | |
local retn = "char ch" .. str .. "[" .. length .. "] = {" | |
--Iterate over every character | |
for c in str:gmatch(".") do | |
retn = retn .. "'" .. c .. "', " | |
end | |
retn = retn .. "0 };" | |
return retn | |
end | |
if useconsoleargs then | |
print(converttocha(...)) else | |
while true do | |
print(converttocha(io.read())) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment