Skip to content

Instantly share code, notes, and snippets.

@oxycoder
Last active August 25, 2023 20:01
Show Gist options
  • Save oxycoder/f79f14520d2ad34bf2cb to your computer and use it in GitHub Desktop.
Save oxycoder/f79f14520d2ad34bf2cb to your computer and use it in GitHub Desktop.
Decode!
<?php
/*
Simple script to convert from Octal to character and character to Octal
Author: Oxycoder
Sample Octal: 127 150 141 164 040 160 150 171 163 151 143 151 163 164 040 162 145 155 141 162 153 145 144 072 040 042 107 157 144 040 151 163 040 163 165 142 164 154 145 054 040 142 165 164 040 150 145 040 151 163 040 156 157 164 040 155 141 154 151 143 151 157 165 163 042 077
Sample Char: W h a t p h y s i c i s t r e m a r k e d G o d i s s u b t l e b u t h e i s n o t m a l i c i o u s
*/
class Octal2Text
{
private $octals = array(
000 => 'nul',
001 => 'soh',
002 => 'stx',
003 => 'etx',
004 => 'eot',
005 => 'enq',
006 => 'ack',
007 => 'bel',
010 => 'bs',
011 => 'ht',
012 => 'nl',
013 => 'vt',
014 => 'np',
015 => 'cr',
016 => 'so',
017 => 'si',
020 => 'dle',
021 => 'dc1',
022 => 'dc2',
023 => 'dc3',
024 => 'dc4',
025 => 'nak',
026 => 'syn',
027 => 'etb',
030 => 'can',
031 => 'em',
032 => 'sub',
033 => 'esc',
034 => 'fs',
035 => 'gs',
036 => 'rs',
037 => 'us',
040 => 'sp',
041 => '!',
042 => '"',
043 => '#',
044 => '$',
045 => '%',
046 => '&',
047 => '\'',
050 => '(',
051 => ')',
052 => '*',
053 => '+',
054 => ',',
055 => '-',
056 => '.',
057 => '/',
060 => '0',
061 => '1',
062 => '2',
063 => '3',
064 => '4',
065 => '5',
066 => '6',
067 => '7',
070 => '8',
071 => '9',
072 => ':',
073 => ';',
074 => '<',
075 => '=',
076 => '>',
077 => '?',
100 => '@',
101 => 'A',
102 => 'B',
103 => 'C',
104 => 'D',
105 => 'E',
106 => 'F',
107 => 'G',
110 => 'H',
111 => 'I',
112 => 'J',
113 => 'K',
114 => 'L',
115 => 'M',
116 => 'N',
117 => 'O',
120 => 'P',
121 => 'Q',
122 => 'R',
123 => 'S',
124 => 'T',
125 => 'U',
126 => 'V',
127 => 'W',
130 => 'X',
131 => 'Y',
132 => 'Z',
133 => '[',
134 => '\\',
135 => ']',
136 => '^',
137 => '_',
140 => '`',
141 => 'a',
142 => 'b',
143 => 'c',
144 => 'd',
145 => 'e',
146 => 'f',
147 => 'g',
150 => 'h',
151 => 'i',
152 => 'j',
153 => 'k',
154 => 'l',
155 => 'm',
156 => 'n',
157 => 'o',
160 => 'p',
161 => 'q',
162 => 'r',
163 => 's',
164 => 't',
165 => 'u',
166 => 'v',
167 => 'w',
170 => 'x',
171 => 'y',
172 => 'z',
173 => '{',
174 => '|',
175 => '}',
176 => '~',
177 => 'del'
);
function convert ($input, $O2T = false)
{
if(!$O2T) {
// Convert from Octal to Text
if (array_key_exists($input, $this->octals)) {
return $this->octals[$input];
} else {
return false;
}
} else {
// Convert from Text to Octal
return array_search($input, $this->octals);
}
}
}
$data = $_POST['data'];
$result = "";
if(isset($data)){
$temp = explode(' ', $data);
$text = new Octal2Text();
if($_POST['type'] == 'O2T'){
foreach( $temp as $octal ){
$result .= " " . $text->convert($octal, false);
}
} else {
foreach( $temp as $octal ){
$result .= " " . $text->convert($octal, true);
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Decoding</title>
</head>
<body>
<p>Enter octal seperate by space</p>
<p>Example: 127 150 141 164 040 144 157 040 171 157 165 040 143 141 154 154 040</p>
<form method="post" action="decode.php">
<label for="data">Text</label><br />
<textarea name="data"></textarea> <br /><br /><br />
Text to Octal <input type="radio" name="type" value="T2O" placeholder="T2O">
Octal to Text <input type="radio" name="type" value="O2T" placeholder="O2T" checked="checked"> <br /><br />
<input type="submit">
</form>
<p><?php echo $result ?></p>
</body>
</html>
@jccube
Copy link

jccube commented Aug 4, 2017

127 150 141 164 040 144 151 147 151 164 040 144 151 144 040 101 162 141 142 040 155 141 164 150 145 155 141 164 151 143 151 141 156 040 141 154 055 113 150 167 141 162 151 172 155 151 040 147 151 166 145 040 164 157 040 164 150 145 040 127 145 163 164 040 141 162 157 165 156 144 040 070 060 060 040 102 057 102 056 077

@ABHIRAMCHOWDARY143
Copy link

127 150 141 164 040 106 055 167 157 162 144 040 151 163 040 144 145 146 151 156 145 144 040 151 156 040 160 150 171 163 151 143 163 040 141 163 040 141 040 042 156 165 143 154 145 141 162 040 162 145 141 143 164 151 157 156 040 151 156 040 167 150 151 143 150 040 156 165 143 154 145 151 040 143 157 155 142 151 156 145 040 164 157 040 146 157 162 155 040 155 157 162 145 040 155 141 163 163 151 166 145 040 156 165 143 154 145 151 042 077 answer this in 2 mins

@sabankaradeniz
Copy link

127 150 141 164 040 144 157 145 163 040 117 040 163 164 141 156 144 040 146 157 162 040 151 156 040 164 150 145 040 145 161 165 151 160 155 145 156 164 040 116 117 123 105 040 167 150 151 143 150 040 151 155 151 164 141 164 145 163 040 164 150 145 040 150 165 155 141 156 040 156 157 163 145 077

@OlegTommy
Copy link

127 150 141 164 040 144 157 040 171 157 165 040 143 141 154 154 040 141 040 163 165 142 163 164 141 156 143 145 040 143 157 156 164 141 151 156 151 156 147 040 157 156 154 171 040 157 156 145 040 153 151 156 144 040 157 146 040 141 164 157 155 077

@rhodford
Copy link

127 150 141 164 047 163 040 163 150 157 162 164 040 146 157 162 040 042 142 151 156 141 162 171 040 144 151 147 151 164 042 077

@christopher-besch
Copy link

110 157 154 171 40 163 150 151 164 54 40 164 150 141 164 40 141 143 164 165 141 154 154 171 40 150 145 154 160 145 144 40 167 151 164 150 40 141 145 62 67 146 146 41 12 124 150 141 156 153 163 41

@beban1
Copy link

beban1 commented Nov 16, 2020

150 164 164 160 163 072 057 057 144 151 163 143 157 162 144 056 147 147 057 131 123 164 166 062 162 070 164 071 132

@k4at3034
Copy link

k4at3034 commented Dec 4, 2020

101:156:144:40:164:150:165:163:40:163:160:157:153:145:40:115:145:162:154:151:156:72:40:141:156:141:141:154:40:156:141:164:150:162:141:153:54:40:165:164:150:166:141:163:40:142:145:164:150:165:144:54:40:144:157:40:143:150:145:55:157:154:40:144:151:55:145:156:166:145:56:40:106:114:101:107:40:154:151:163:164:145:156:145:144:54:40:141:156:144:40:154:145:141:162:156:145:144:56 Flag: Close

@gringoch-ui
Copy link

164 150 145

@christopher-besch
Copy link

157 156 151 157 156 163

@majenun123
Copy link

@juliencarb
Copy link

150 077 077 107 050 112 124 176 174 073 131 116 164 121 131 113 051 050 126 074 102 043 122 104 103 174 044 102 074 164 050 127 112 114 130 100 112 160 110 117 114 163 101 112 041 074 106 072 132 111 052 041 052 045 057 075 112 106 102 102 047 127 057 044 122 107 123 114 122 054 167 041 053 122 127 167 073 077 167 137 042 115 114 041 173 112 051 131 053 074 130 056 042 041 054 136 164 044 073 123 115 150 114 046 106 042 126 157 111 122 162 044 113 052 106 156 130 051 163 116 101 157 126 103 143 045 047 126 101 151 107 045 116 125 045 075 145 047 053 117 074 045 117 164 075 106 171 130 120 056 045 135 041 170 041 076 112 076 171 176 137 051 172 047 057 111 052 102 107 167 045 123 100 101 117 050 145 103 131 043 116 055 166 145 074 100 121 107 055 050 077 047 041 176 120 111 175 121 142 127 126 043 075 176 117 145 054 121 145 131 047 046 175 127 110 173 174 114 105 116 156 115 114 055 122 130 145 046 122 102 131 102 102 103 107 170 120 160 043 044 045 136 145 045 122 136 106 143 107 126 052 136 106 045 107 122 105 044 046 105 106 164 045 122 124 136 107 131 052 102 151 173 133 135 047 102 136 116 156 107 147 045 122 044 045 126 106 055 044 045 105 104 103 043 106 122 171 102 107 125 136 045 106 125 157 131 106 104 103 044 125 136 052 050 136 044 126 104 102 106 122 126 126 124 102 131 073 047 135 133 073 107 073 165 107 133 135 047 107 110 110 135 110 133 135 073 104 134 133 073 107 123 073 135 043 044 100 044 043 100 043

@yeisonasaas
Copy link

162 157 164 157 162 151 172 161 165 151 145 162 144 157 61 162 157 164 157 162 144 145 162 145 143 150 157 61 162 157 164 157 162 155 145 144 151 157 61

@kerlleqs
Copy link

123 151 147 156 141 164 165 162 145 40 165 156 145 162 164 141 151 156

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment