-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
166 lines (156 loc) · 3.02 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
var app = angular.module('app', ['app.filter', 'ui.bootstrap', 'angular-flash.service', 'angular-flash.flash-alert-directive']);
app.config(function (flashProvider) {
flashProvider.errorClassnames.push('alert-danger');
flashProvider.successClassnames.push('alert-sucess');
});
app.controller('Decode', function($scope, $filter, flash) {
// list of categories
// Name : parent
$scope.categories = {
'Common': {
parent: null,
firstChild: 'Character',
},
'Character': {
parent: 'Common',
firstChild: 'Ascii',
},
'Base': {
parent: 'Common',
firstChild: 'Binary',
},
'Web': {
parent: 'Common',
firstChild: 'URLEncode',
},
'Language': {
parent: null,
firstChild: 'Human',
},
'Human': {
parent: 'Language',
firstChild: 'Morse',
},
'Obfuscation': {
parent: 'Language',
firstChild: 'ROT13',
},
}
$scope.selectedCategorie= 'Common';
$scope.setCategorie = function(name) {
$scope.selectedCategorie = name;
$scope.selectedSubCategorie = $scope.categories[name].firstChild;
$scope.type = $scope.categories[$scope.selectedSubCategorie].firstChild;
};
$scope.selectedSubCategorie= 'Character';
$scope.setSubCategorie = function(name) {
$scope.selectedSubCategorie = name;
$scope.type = $scope.categories[name].firstChild;
};
// list of supported codes
// 'Name': {
// steps: [
// 'Step',
// 'To',
// 'Get',
// 'Binary',
// ],
// example: 'Message'
// }
$scope.codes = {
'Ascii': {
steps: [
'Binary',
],
example: 'Message',
parent: 'Character',
},
'Decimal': {
steps: [
'Binary',
],
example: '77 101 115 115 97 103 101',
parent: 'Base',
},
'Binary': {
steps: [
'Binary',
],
example: '1001101 1100101 1110011 1110011 1100001 1100111 1100101',
parent: 'Base',
},
'Hexadecimal': {
steps: [
'Binary',
],
example: '4d 65 73 73 61 67 65',
parent: 'Base',
},
'Base64': {
steps: [
'Ascii',
'Binary',
],
example: 'TWVzc2FnZQ==',
parent: 'Base',
},
'Morse': {
steps: [
'Ascii',
'Binary',
],
example: '-- . ... ... .- --. .',
parent: 'Human',
},
'Shadok': {
steps: [
'Binary',
],
example: 'BUGAMEUBU BUZOBUBU BUMEUGAMEU BUMEUGAMEU BUZOGABU BUZOBUMEU BUZOBUBU',
parent: 'Obfuscation',
},
'Octal': {
steps : [
'Binary',
],
exemple: '115 145 163 163 141 147 145',
parent: 'Base',
},
'CharDec': {
steps : [
'Ascii',
'Binary',
],
example: '77 101 115 115 97 103 101',
parent: 'Character',
},
'URLEncode': {
steps : [
'Ascii',
'Binary',
],
example: 'Message',
parent: 'Web',
},
'ROT13': {
steps : [
'Ascii',
'Binary',
],
example: 'Zrffntr',
parent: 'Obfuscation',
},
};
// active type
$scope.type= 'Ascii';
$scope.setType = function(name) {
$scope.type = name;
};
$scope.flashSuccess = function(message) {
flash.success = message;
};
$scope.flashError = function(message) {
flash.error = message;
};
$scope.oneAccordionAtATime = true;
});