Created
February 2, 2013 13:47
-
-
Save benjojo/4697446 to your computer and use it in GitHub Desktop.
Yeah, I am pretty bored.
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
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