binproxy 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/bin/binproxy +135 -0
- data/lib/binproxy.rb +2 -0
- data/lib/binproxy/bd_util.rb +267 -0
- data/lib/binproxy/bindata.rb +44 -0
- data/lib/binproxy/class_loader.rb +64 -0
- data/lib/binproxy/connection.rb +105 -0
- data/lib/binproxy/connection/filters.rb +190 -0
- data/lib/binproxy/logger.rb +17 -0
- data/lib/binproxy/parser.rb +76 -0
- data/lib/binproxy/parsers/chat_demo.rb +14 -0
- data/lib/binproxy/parsers/dns.rb +70 -0
- data/lib/binproxy/parsers/dumb_http.rb +28 -0
- data/lib/binproxy/parsers/msgpack.rb +56 -0
- data/lib/binproxy/parsers/plain_text.rb +4 -0
- data/lib/binproxy/parsers/raw_message.rb +4 -0
- data/lib/binproxy/parsers/x11_proto.rb +134 -0
- data/lib/binproxy/parsers/zmq.rb +62 -0
- data/lib/binproxy/proxy.rb +242 -0
- data/lib/binproxy/proxy_event.rb +57 -0
- data/lib/binproxy/proxy_message.rb +191 -0
- data/lib/binproxy/session.rb +47 -0
- data/lib/binproxy/web_console.rb +194 -0
- data/public/bright_squares.png +0 -0
- data/public/ui/app.js +54910 -0
- data/public/ui/fixed-data-table.css +509 -0
- data/views/application.scss +335 -0
- data/views/common.scss +90 -0
- data/views/config.haml +54 -0
- data/views/config.scss +15 -0
- data/views/index.haml +15 -0
- metadata +325 -0
@@ -0,0 +1,335 @@
|
|
1
|
+
@import "common.scss";
|
2
|
+
|
3
|
+
* { box-sizing: border-box; }
|
4
|
+
html, body, #UIRoot {
|
5
|
+
height: 100%;
|
6
|
+
border: 0;
|
7
|
+
margin: 0;
|
8
|
+
padding: 0;
|
9
|
+
}
|
10
|
+
|
11
|
+
.BinProxyUI {
|
12
|
+
display: flex;
|
13
|
+
flex-flow: column nowrap;
|
14
|
+
margin: 0;
|
15
|
+
padding: 5px;
|
16
|
+
height: 100%;
|
17
|
+
|
18
|
+
> .StatusBar {
|
19
|
+
@include blue-box;
|
20
|
+
flex: 0 0 auto;
|
21
|
+
margin: 5px 0;
|
22
|
+
span { margin-right: 1em; }
|
23
|
+
input[type=checkbox] { vertical-align: text-bottom; }
|
24
|
+
|
25
|
+
.websocket { color: #800000 }
|
26
|
+
.websocket.active { color: #008000 }
|
27
|
+
|
28
|
+
.intercept.ready { color: #008000 }
|
29
|
+
.intercept.active { color: #800000 }
|
30
|
+
}
|
31
|
+
|
32
|
+
> .MessagesTable {
|
33
|
+
flex: 0 0 auto;
|
34
|
+
z-index: 0;
|
35
|
+
|
36
|
+
// Steal the important stuff from react-bootstrap-table.css, and fix broken
|
37
|
+
// hardcoded values with... better hardcoded values?
|
38
|
+
|
39
|
+
//common table attributes
|
40
|
+
table {
|
41
|
+
width: 100%;
|
42
|
+
th, td, .table-header-column {
|
43
|
+
line-height: 25px;
|
44
|
+
vertical-align: top;
|
45
|
+
overflow: hidden;
|
46
|
+
text-overflow: ellipsis;
|
47
|
+
white-space: nowrap;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
.table-header {
|
52
|
+
position: relative;
|
53
|
+
z-index: 2;
|
54
|
+
overflow: hidden;
|
55
|
+
table {
|
56
|
+
margin-bottom: 0;
|
57
|
+
th {
|
58
|
+
border: 1px solid black;
|
59
|
+
div {
|
60
|
+
padding-left: 1ex;
|
61
|
+
width: 100%;
|
62
|
+
height: 100%;
|
63
|
+
margin: 0;
|
64
|
+
background-color: #F2F9FF;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
.table-container {
|
71
|
+
position: relative;
|
72
|
+
z-index: 1;
|
73
|
+
table {
|
74
|
+
//min-height: 200px;
|
75
|
+
th { visibility: hidden }
|
76
|
+
}
|
77
|
+
margin-top: -29px;
|
78
|
+
overflow-y: scroll;
|
79
|
+
height: 100%;
|
80
|
+
}
|
81
|
+
|
82
|
+
table {
|
83
|
+
border-collapse: collapse;
|
84
|
+
border: 1px solid black;
|
85
|
+
> tbody > tr {
|
86
|
+
> td {
|
87
|
+
background-color: #FFFFFF;
|
88
|
+
border: 1px solid black;
|
89
|
+
padding-left: 2px;
|
90
|
+
}
|
91
|
+
&.selected > td { background-color: #FFFFDD; }
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
> .MessageMeta {
|
96
|
+
flex: 0 0 auto;
|
97
|
+
|
98
|
+
fieldset.msginfo {
|
99
|
+
@include blue-box;
|
100
|
+
display: flex;
|
101
|
+
flex-flow: column nowrap;
|
102
|
+
//flex: 0 0 auto;
|
103
|
+
margin: 0;
|
104
|
+
padding-left: 6px;
|
105
|
+
padding-right: 6px;
|
106
|
+
margin-bottom: 1ex;
|
107
|
+
&.pending {
|
108
|
+
background: $light_green;
|
109
|
+
}
|
110
|
+
|
111
|
+
> .msginfo-fields {
|
112
|
+
display: flex;
|
113
|
+
flex-flow: row nowrap;
|
114
|
+
justify-content: space-between;
|
115
|
+
|
116
|
+
> .msginfo-fieldgroup {
|
117
|
+
flex-grow: 0;
|
118
|
+
display: flex;
|
119
|
+
flex-flow: row wrap;
|
120
|
+
&:first-child { flex-wrap: nowrap;}
|
121
|
+
}
|
122
|
+
|
123
|
+
input {
|
124
|
+
margin-left: 0.5ex;
|
125
|
+
}
|
126
|
+
|
127
|
+
input[type="text"] {
|
128
|
+
width: 8ex;
|
129
|
+
margin-right: 2ex;
|
130
|
+
}
|
131
|
+
}
|
132
|
+
}
|
133
|
+
}
|
134
|
+
> .MessageContent {
|
135
|
+
flex: 1 1 100%;
|
136
|
+
@include flex;
|
137
|
+
|
138
|
+
> div.react-tabs {
|
139
|
+
flex: 1 1 100%;
|
140
|
+
@include flex;
|
141
|
+
@include blue-box(0);
|
142
|
+
|
143
|
+
> ul[role='tablist'] {
|
144
|
+
flex: 0 0 auto;
|
145
|
+
@include flex(row);
|
146
|
+
|
147
|
+
margin: 2px 2px 0 2px;
|
148
|
+
padding: 0;
|
149
|
+
|
150
|
+
> li[role='tab'] {
|
151
|
+
list-style: none;
|
152
|
+
padding: 6px 12px;
|
153
|
+
@include ui-element;
|
154
|
+
|
155
|
+
border: 1px solid black;
|
156
|
+
border-bottom: none;
|
157
|
+
border-radius: 5px 5px 0 0;
|
158
|
+
//margin-right: 1px;
|
159
|
+
|
160
|
+
&[aria-selected=true] {
|
161
|
+
background: $light_gray;
|
162
|
+
border-bottom: 1px solid $light_gray;
|
163
|
+
}
|
164
|
+
}
|
165
|
+
}
|
166
|
+
> div[role='tabpanel'] {
|
167
|
+
flex: 1 1 auto;
|
168
|
+
@include flex;
|
169
|
+
background: $light_gray;
|
170
|
+
margin: 0 1px 1px 1px;
|
171
|
+
padding: 2px;
|
172
|
+
overflow-y: scroll;
|
173
|
+
align-self: stretch;
|
174
|
+
|
175
|
+
|
176
|
+
}
|
177
|
+
}
|
178
|
+
.EscapedPane {
|
179
|
+
width: 100%;
|
180
|
+
height: 100%;
|
181
|
+
}
|
182
|
+
}
|
183
|
+
|
184
|
+
input:not([type=button]):disabled, textarea:disabled {
|
185
|
+
background: #F3F3F3;
|
186
|
+
}
|
187
|
+
}
|
188
|
+
|
189
|
+
[data-validation-error] {
|
190
|
+
background: #FEE;
|
191
|
+
}
|
192
|
+
|
193
|
+
.ParsedMessage {
|
194
|
+
@include flex;
|
195
|
+
|
196
|
+
.PMTreeNode {
|
197
|
+
@include flex(row);
|
198
|
+
margin-bottom: 5px;
|
199
|
+
}
|
200
|
+
|
201
|
+
.FieldName, {
|
202
|
+
flex: 1 1 10ex;
|
203
|
+
font-weight: bold;
|
204
|
+
}
|
205
|
+
|
206
|
+
.FieldContent {
|
207
|
+
flex: 0 1 100%;
|
208
|
+
@include flex(column);
|
209
|
+
> * { flex: 1 0 auto; }
|
210
|
+
}
|
211
|
+
}
|
212
|
+
|
213
|
+
|
214
|
+
.HexView {
|
215
|
+
@include flex(row);
|
216
|
+
|
217
|
+
pre:first-child {
|
218
|
+
text-align: right;
|
219
|
+
}
|
220
|
+
pre:last-child {
|
221
|
+
padding-left: 0.5ex;
|
222
|
+
}
|
223
|
+
|
224
|
+
pre, textarea {
|
225
|
+
padding: 2px;
|
226
|
+
font: 13px monospace;
|
227
|
+
}
|
228
|
+
pre {
|
229
|
+
margin-top: 0px;
|
230
|
+
border-top: 0px;
|
231
|
+
}
|
232
|
+
// bug/weirdness workaround
|
233
|
+
div {
|
234
|
+
position: relative;
|
235
|
+
> textarea {
|
236
|
+
height: 100%;
|
237
|
+
}
|
238
|
+
}
|
239
|
+
textarea {
|
240
|
+
height: 100%;
|
241
|
+
margin-top: 0px;
|
242
|
+
border-top: 1px solid black;
|
243
|
+
margin-left: 1ex;
|
244
|
+
margin-right: 1ex;
|
245
|
+
}
|
246
|
+
}
|
247
|
+
|
248
|
+
|
249
|
+
/*
|
250
|
+
}
|
251
|
+
}
|
252
|
+
/*
|
253
|
+
.headers {
|
254
|
+
border: 1px solid black;
|
255
|
+
flex: 0 0 auto;
|
256
|
+
|
257
|
+
> div {
|
258
|
+
display: inline-block;
|
259
|
+
margin: 0px;
|
260
|
+
text-align: center;
|
261
|
+
font-weight: bold;
|
262
|
+
white-space: nowrap;
|
263
|
+
|
264
|
+
border-left: 1px solid black;
|
265
|
+
&:first-child { border-left: none; }
|
266
|
+
|
267
|
+
}
|
268
|
+
}
|
269
|
+
|
270
|
+
.scroller {
|
271
|
+
height: 150px;
|
272
|
+
flex: 0 0 auto;
|
273
|
+
overflow-y: scroll;
|
274
|
+
//resize: vertical; need to not break the rest of the layout!
|
275
|
+
border-top: none;
|
276
|
+
outline: 0; //don't highlight when focused;
|
277
|
+
|
278
|
+
table {
|
279
|
+
width: 100%;
|
280
|
+
border-collapse: collapse;
|
281
|
+
cursor: default;
|
282
|
+
|
283
|
+
tr.pending { color: #AAAAAA; }
|
284
|
+
|
285
|
+
td { border: 1px solid black; }
|
286
|
+
tr:first-child td { border-top: none; }
|
287
|
+
tr:last-child td { border-bottom: none; }
|
288
|
+
td:first-child { border-left: none; }
|
289
|
+
td:last-child { border-right: none; }
|
290
|
+
}
|
291
|
+
}
|
292
|
+
|
293
|
+
|
294
|
+
#content_tabs {
|
295
|
+
*/
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
/*
|
301
|
+
//border: none; padding: 0; margin: 0;
|
302
|
+
|
303
|
+
display: flex;
|
304
|
+
flex-flow: column nowrap;
|
305
|
+
ul { flex: 0 0 auto; }
|
306
|
+
> div {
|
307
|
+
height: 100%;
|
308
|
+
flex: 1 1 auto;
|
309
|
+
overflow: auto;
|
310
|
+
//margin: 6px 0 0 0;
|
311
|
+
padding: 1ex;
|
312
|
+
}
|
313
|
+
|
314
|
+
fieldset {
|
315
|
+
margin: 0;
|
316
|
+
width: 100%;
|
317
|
+
@include blue-box;
|
318
|
+
}
|
319
|
+
&.pending fieldset {
|
320
|
+
background: $light_green;
|
321
|
+
}
|
322
|
+
|
323
|
+
label {
|
324
|
+
display: flex;
|
325
|
+
flex-flow: row nowrap;
|
326
|
+
:first-child { min-width: 120px; }
|
327
|
+
:last-child { flex-grow: 1; }
|
328
|
+
}
|
329
|
+
|
330
|
+
input, textarea {
|
331
|
+
&:disabled {
|
332
|
+
background: #EEE;
|
333
|
+
}
|
334
|
+
}
|
335
|
+
*/
|
data/views/common.scss
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
@mixin center-block {
|
2
|
+
margin-left: auto;
|
3
|
+
margin-right: auto;
|
4
|
+
}
|
5
|
+
|
6
|
+
@mixin ui-element {
|
7
|
+
cursor: pointer;
|
8
|
+
user-select: none;
|
9
|
+
-moz-user-select: none;
|
10
|
+
-webkit-user-select: none;
|
11
|
+
-ms-user-select: none;
|
12
|
+
}
|
13
|
+
|
14
|
+
$light_blue: #F2F9FF;
|
15
|
+
$light_green: #F2FFF9;
|
16
|
+
$light_gray: #EEE;
|
17
|
+
|
18
|
+
@mixin blue-box($pad: 6px) {
|
19
|
+
border: 1px solid black;
|
20
|
+
background: $light_blue;
|
21
|
+
padding-left: $pad;
|
22
|
+
padding-right: $pad;
|
23
|
+
}
|
24
|
+
|
25
|
+
@mixin flex($dir: column) {
|
26
|
+
display: flex;
|
27
|
+
flex-flow: $dir;
|
28
|
+
//border: 1px dashed red;
|
29
|
+
}
|
30
|
+
|
31
|
+
//classes from jQueryUI
|
32
|
+
@mixin tab-box {
|
33
|
+
ul.ui-tabs-nav {
|
34
|
+
margin: 0px;
|
35
|
+
padding-left: 0px;
|
36
|
+
:focus {
|
37
|
+
outline: none;
|
38
|
+
color: darken($light_blue, 60%);
|
39
|
+
}
|
40
|
+
li {
|
41
|
+
display: inline-block;
|
42
|
+
padding: 2px;
|
43
|
+
border-top: 1px solid black;
|
44
|
+
border-left: 1px solid black;
|
45
|
+
border-right: 1px solid black;
|
46
|
+
a {
|
47
|
+
color: inherit;
|
48
|
+
font-weight: bold;
|
49
|
+
text-decoration: none;
|
50
|
+
}
|
51
|
+
&.ui-tabs-active {
|
52
|
+
background-color: $light_blue;
|
53
|
+
border-bottom: 1px solid $light_blue;
|
54
|
+
margin-bottom: -1px;
|
55
|
+
a {
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
60
|
+
div.ui-tabs-panel {
|
61
|
+
@include blue-box;
|
62
|
+
margin-top: 0px;
|
63
|
+
padding-bottom: 2px;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
body {
|
68
|
+
background: url('/bright_squares.png');
|
69
|
+
font-size: 14px;
|
70
|
+
font-family: 'Helvetica Neue', sans-serif;
|
71
|
+
}
|
72
|
+
|
73
|
+
div.error {
|
74
|
+
color: red;
|
75
|
+
border: 2px solid red;
|
76
|
+
background: yellow;
|
77
|
+
padding: 2px;
|
78
|
+
}
|
79
|
+
|
80
|
+
@mixin form-grid($label-width, $input-width) {
|
81
|
+
label {
|
82
|
+
display: inline-block;
|
83
|
+
min-width: $label-width;
|
84
|
+
}
|
85
|
+
input[type="text"],
|
86
|
+
select {
|
87
|
+
display: inline-block;
|
88
|
+
min-width: $input-width;
|
89
|
+
}
|
90
|
+
}
|
data/views/config.haml
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
:ruby
|
2
|
+
presets = {
|
3
|
+
'Generic Text' => 'PlainText',
|
4
|
+
'Generic Binary' => 'RawMessage' ,
|
5
|
+
'DNS (TCP)' => 'Dns::TcpPacket' ,
|
6
|
+
'HTTP (Text)' => 'DumbHttp::Message',
|
7
|
+
'HTTP (Binary)' => 'DumbHttp::BinMessage',
|
8
|
+
}
|
9
|
+
opt_fields = {
|
10
|
+
lhost: 'Proxy Host',
|
11
|
+
lport: 'Proxy Port',
|
12
|
+
dhost: 'Destination Host',
|
13
|
+
dport: 'Destination Port',
|
14
|
+
class_name: 'Parser Class Name',
|
15
|
+
class_file: 'Parser Class File (optional)'
|
16
|
+
}
|
17
|
+
%html
|
18
|
+
%head
|
19
|
+
%meta(charset="UTF-8")
|
20
|
+
%title Custom Protocol Proxy Configuration
|
21
|
+
%link(rel="stylesheet" type="text/css" media="all" href="/config.css")
|
22
|
+
%body
|
23
|
+
%h1 Proxy Configuration
|
24
|
+
%div.main
|
25
|
+
- if defined? err_msg and !err_msg.nil?
|
26
|
+
%div.error= err_msg
|
27
|
+
%form.grid(action="/config" method='post')
|
28
|
+
%div
|
29
|
+
%label(for="preset")
|
30
|
+
%b Preset Classes
|
31
|
+
%select(id="preset_selector")
|
32
|
+
%option
|
33
|
+
- presets.each do |k,v|
|
34
|
+
%option(value=v)= k
|
35
|
+
:javascript
|
36
|
+
var ps = document.getElementById('preset_selector');
|
37
|
+
ps.onchange = function() {
|
38
|
+
document.getElementById('config_class_name').value = ps.value;
|
39
|
+
document.getElementById('config_class_file').value = '';
|
40
|
+
}
|
41
|
+
%hr
|
42
|
+
- opt_fields.each do |k, name|
|
43
|
+
%div
|
44
|
+
%label(for="config_#{k}")= name
|
45
|
+
%input(id="config_#{k}" name=k value="#{opt_vals[k]}")
|
46
|
+
%div
|
47
|
+
%label
|
48
|
+
%input(type="submit" value="Update")
|
49
|
+
%p
|
50
|
+
Configuration for UDP, SSL, debugging, and other options is still to-do.
|
51
|
+
Please use command line flags for now.
|
52
|
+
%p
|
53
|
+
Note: Changing host/port options when UDP flag is specified is
|
54
|
+
currently broken; please restart BinProxy to change UDP host/port.
|