Skip to content

Instantly share code, notes, and snippets.

@benjojo
Created February 2, 2013 13:47
Show Gist options
  • Save benjojo/4697446 to your computer and use it in GitHub Desktop.
Save benjojo/4697446 to your computer and use it in GitHub Desktop.
Yeah, I am pretty bored.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PHPrB64
{
class Program
{
static void Main(string[] args)
{
string input = "echo('hi');";
int Levels = 20;
string output = PHPProcess(input);
for (int i = 0; i < Levels; i++)
{
output = PHPProcess(output);
}
Console.Write("<?php "+output+" ?>");
Console.ReadLine();
}
static public string PHPProcess(string code)
{
string o = "eval(base64_decode('";
o += EncodeTo64(code);
o += "'));";
return o;
}
static public string EncodeTo64(string toEncode)
{
byte[] toEncodeAsBytes = System.Text.ASCIIEncoding.ASCII.GetBytes(toEncode);
string returnValue= System.Convert.ToBase64String(toEncodeAsBytes);
return returnValue;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment