Skip to content

Instantly share code, notes, and snippets.

@0x6d61
Last active June 19, 2019 10:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0x6d61/7ebfe4393ba3a3564313b48684e7b7fb to your computer and use it in GitHub Desktop.
Save 0x6d61/7ebfe4393ba3a3564313b48684e7b7fb to your computer and use it in GitHub Desktop.
難読化shell芸を手助けするscript
obfresult= ["__=$(. 2>&1);","___=$(/ 2>&1);","__=${__##*.};",'___=$(${__:4:1}c$(printf "\x68")o $___|cut -d":" -${__:1:1}2-);']
obfchain={
"a" => '${__:6:1}',
"b" => '$(printf "%b\n" $(printf "%s%x" "\x" 98))',
"c" => '${___:13:1}',
"d" => '${___:9:1}',
"e" => '${__:4:1}',
"f" => '${__:1:1}',
"g" => '${__:13:1}',
"h" => '$(printf "\x68")',
"i" => '${___:10:1}',
"j" => '$(printf "\x6a")',
"k" => '$print "\x6b")',
"l" => '${__:3:1}',
"m" => '${__:7:1}',
"n" => '${__:5:1}',
"o" => '${___:15:1}',
"p" => '$(printf "\x70")',
"q" => '$(printf "\x71")',
"r" => '${___:11:1}',
"s" => '${___:5:1}',
"t" => '${__:18:1}',
"u" => '$(printf "\x75")',
"v" => '$(printf "\x76")',
"w" => '$(printf "\x77")',
"x" => '$(printf "\x78")',
"y" => '${___:17:1}',
"z" => '$(printf "\x7a")',
">" => ">",
"<" => "<",
" " => " $(:;:;:;:;:;:;)",
"-" => "-",
"." => ".",
"[" => "${__:10:1}",
"]" => "${__:20:1}",
"{" => "{",
"}" => "}",
"$" => "$",
"&" => "&",
"#" => "#",
"(" => "(",
")" => ")",
"|" => "|",
"\"" => "\"",
"/"=>"${___:1:1}",
"'" => "'",
";" => ';',
"9" => "$(((((1+1)*2)+1)*2-1))",
"8" => "$(((1+1+1)*2+1+1))",
"7" => "$(((1+1+1+1+1)+1+1))",
"6" => "$(((2*2)+2))",
"5" => "$((((1*1*1*1*1)+1*2)+1))",
"4" => "$((2*2))",
"3" => "$((1+1+1))",
"2" => "2",
"1" => "1"
}
if ARGV.length > 0
ARGV[0].each_char do |i|
obfresult.push(obfchain[i])
end
puts obfresult.join
else
puts "obfsh.rb <shellsctipt>"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment