fluent_command_builder 0.1.14 → 0.1.15
Sign up to get free protection for your applications and to get access to all the features.
@@ -11,6 +11,9 @@ module FluentCommandBuilder
|
|
11
11
|
def advfirewall
|
12
12
|
Advfirewall.new @builder
|
13
13
|
end
|
14
|
+
def http
|
15
|
+
Http.new @builder
|
16
|
+
end
|
14
17
|
def to_s
|
15
18
|
@builder.to_s
|
16
19
|
end
|
@@ -48,17 +51,17 @@ module FluentCommandBuilder
|
|
48
51
|
@builder = builder
|
49
52
|
@builder.append ' firewall'
|
50
53
|
end
|
51
|
-
def
|
52
|
-
|
54
|
+
def add_rule_name rule_name, direction, action
|
55
|
+
AddRuleName.new @builder, rule_name, direction, action
|
53
56
|
end
|
54
|
-
def
|
55
|
-
|
57
|
+
def delete_rule_name rule_name
|
58
|
+
DeleteRuleName.new @builder, rule_name
|
56
59
|
end
|
57
60
|
def set_rule
|
58
61
|
SetRule.new @builder
|
59
62
|
end
|
60
|
-
def
|
61
|
-
|
63
|
+
def show_rule_name rule_name
|
64
|
+
ShowRuleName.new @builder, rule_name
|
62
65
|
end
|
63
66
|
def to_s
|
64
67
|
@builder.to_s
|
@@ -72,22 +75,10 @@ module FluentCommandBuilder
|
|
72
75
|
end
|
73
76
|
end
|
74
77
|
end
|
75
|
-
class
|
76
|
-
def initialize builder
|
78
|
+
class AddRuleName
|
79
|
+
def initialize builder, rule_name, direction, action
|
77
80
|
@builder = builder
|
78
|
-
@builder.append
|
79
|
-
end
|
80
|
-
def name rule_name
|
81
|
-
@builder.append " name=#{@builder.format rule_name}"
|
82
|
-
self
|
83
|
-
end
|
84
|
-
def dir direction
|
85
|
-
@builder.append " dir=#{@builder.format direction}"
|
86
|
-
self
|
87
|
-
end
|
88
|
-
def action action
|
89
|
-
@builder.append " action=#{@builder.format action}"
|
90
|
-
self
|
81
|
+
@builder.append " add rule name=#{@builder.format rule_name} dir=#{@builder.format direction} action=#{@builder.format action}"
|
91
82
|
end
|
92
83
|
def program path
|
93
84
|
@builder.append " program=#{@builder.format path}"
|
@@ -109,20 +100,20 @@ module FluentCommandBuilder
|
|
109
100
|
@builder.append " profile=#{@builder.format profile}"
|
110
101
|
self
|
111
102
|
end
|
112
|
-
def
|
113
|
-
@builder.append "
|
103
|
+
def local_ip address
|
104
|
+
@builder.append " localIp=#{@builder.format address, ','}"
|
114
105
|
self
|
115
106
|
end
|
116
|
-
def
|
117
|
-
@builder.append "
|
107
|
+
def remote_ip address
|
108
|
+
@builder.append " remoteIp=#{@builder.format address, ','}"
|
118
109
|
self
|
119
110
|
end
|
120
|
-
def
|
121
|
-
@builder.append "
|
111
|
+
def local_port port
|
112
|
+
@builder.append " localPort=#{@builder.format port, ','}"
|
122
113
|
self
|
123
114
|
end
|
124
|
-
def
|
125
|
-
@builder.append "
|
115
|
+
def remote_port port
|
116
|
+
@builder.append " remotePort=#{@builder.format port, ','}"
|
126
117
|
self
|
127
118
|
end
|
128
119
|
def protocol protocol
|
@@ -161,14 +152,10 @@ module FluentCommandBuilder
|
|
161
152
|
end
|
162
153
|
end
|
163
154
|
end
|
164
|
-
class
|
165
|
-
def initialize builder
|
155
|
+
class DeleteRuleName
|
156
|
+
def initialize builder, rule_name
|
166
157
|
@builder = builder
|
167
|
-
@builder.append
|
168
|
-
end
|
169
|
-
def name rule_name
|
170
|
-
@builder.append " name=#{@builder.format rule_name}"
|
171
|
-
self
|
158
|
+
@builder.append " delete rule name=#{@builder.format rule_name}"
|
172
159
|
end
|
173
160
|
def dir direction
|
174
161
|
@builder.append " dir=#{@builder.format direction}"
|
@@ -186,20 +173,20 @@ module FluentCommandBuilder
|
|
186
173
|
@builder.append " service=#{@builder.format service_short_name}"
|
187
174
|
self
|
188
175
|
end
|
189
|
-
def
|
190
|
-
@builder.append "
|
176
|
+
def local_ip address
|
177
|
+
@builder.append " localIp=#{@builder.format address, ','}"
|
191
178
|
self
|
192
179
|
end
|
193
|
-
def
|
194
|
-
@builder.append "
|
180
|
+
def remote_ip address
|
181
|
+
@builder.append " remoteIp=#{@builder.format address, ','}"
|
195
182
|
self
|
196
183
|
end
|
197
|
-
def
|
198
|
-
@builder.append "
|
184
|
+
def local_port port
|
185
|
+
@builder.append " localPort=#{@builder.format port, ','}"
|
199
186
|
self
|
200
187
|
end
|
201
|
-
def
|
202
|
-
@builder.append "
|
188
|
+
def remote_port port
|
189
|
+
@builder.append " remotePort=#{@builder.format port, ','}"
|
203
190
|
self
|
204
191
|
end
|
205
192
|
def protocol protocol
|
@@ -243,20 +230,20 @@ module FluentCommandBuilder
|
|
243
230
|
@builder.append " service=#{@builder.format service_short_name}"
|
244
231
|
self
|
245
232
|
end
|
246
|
-
def
|
247
|
-
@builder.append "
|
233
|
+
def local_ip address
|
234
|
+
@builder.append " localIp=#{@builder.format address, ','}"
|
248
235
|
self
|
249
236
|
end
|
250
|
-
def
|
251
|
-
@builder.append "
|
237
|
+
def remote_ip address
|
238
|
+
@builder.append " remoteIp=#{@builder.format address, ','}"
|
252
239
|
self
|
253
240
|
end
|
254
|
-
def
|
255
|
-
@builder.append "
|
241
|
+
def local_port port
|
242
|
+
@builder.append " localPort=#{@builder.format port, ','}"
|
256
243
|
self
|
257
244
|
end
|
258
|
-
def
|
259
|
-
@builder.append "
|
245
|
+
def remote_port port
|
246
|
+
@builder.append " remotePort=#{@builder.format port, ','}"
|
260
247
|
self
|
261
248
|
end
|
262
249
|
def protocol protocol
|
@@ -315,20 +302,20 @@ module FluentCommandBuilder
|
|
315
302
|
@builder.append " profile=#{@builder.format profile}"
|
316
303
|
self
|
317
304
|
end
|
318
|
-
def
|
319
|
-
@builder.append "
|
305
|
+
def local_ip address
|
306
|
+
@builder.append " localIp=#{@builder.format address, ','}"
|
320
307
|
self
|
321
308
|
end
|
322
|
-
def
|
323
|
-
@builder.append "
|
309
|
+
def remote_ip address
|
310
|
+
@builder.append " remoteIp=#{@builder.format address, ','}"
|
324
311
|
self
|
325
312
|
end
|
326
|
-
def
|
327
|
-
@builder.append "
|
313
|
+
def local_port port
|
314
|
+
@builder.append " localPort=#{@builder.format port, ','}"
|
328
315
|
self
|
329
316
|
end
|
330
|
-
def
|
331
|
-
@builder.append "
|
317
|
+
def remote_port port
|
318
|
+
@builder.append " remotePort=#{@builder.format port, ','}"
|
332
319
|
self
|
333
320
|
end
|
334
321
|
def protocol protocol
|
@@ -367,14 +354,10 @@ module FluentCommandBuilder
|
|
367
354
|
end
|
368
355
|
end
|
369
356
|
end
|
370
|
-
class
|
371
|
-
def initialize builder
|
357
|
+
class ShowRuleName
|
358
|
+
def initialize builder, rule_name
|
372
359
|
@builder = builder
|
373
|
-
@builder.append
|
374
|
-
end
|
375
|
-
def name rule_name
|
376
|
-
@builder.append " name=#{@builder.format rule_name}"
|
377
|
-
self
|
360
|
+
@builder.append " show rule name=#{@builder.format rule_name}"
|
378
361
|
end
|
379
362
|
def profile profile
|
380
363
|
@builder.append " profile=#{@builder.format profile}"
|
@@ -400,6 +383,63 @@ module FluentCommandBuilder
|
|
400
383
|
end
|
401
384
|
end
|
402
385
|
end
|
386
|
+
class Http
|
387
|
+
def initialize builder
|
388
|
+
@builder = builder
|
389
|
+
@builder.append ' http'
|
390
|
+
end
|
391
|
+
def add_urlacl_url url
|
392
|
+
AddUrlaclUrl.new @builder, url
|
393
|
+
end
|
394
|
+
def delete_urlacl_url url
|
395
|
+
@builder.append " delete urlacl url=#{@builder.format url}"
|
396
|
+
self
|
397
|
+
end
|
398
|
+
def to_s
|
399
|
+
@builder.to_s
|
400
|
+
end
|
401
|
+
def execute
|
402
|
+
begin
|
403
|
+
require 'rake'
|
404
|
+
sh to_s
|
405
|
+
rescue LoadError
|
406
|
+
system to_s
|
407
|
+
end
|
408
|
+
end
|
409
|
+
end
|
410
|
+
class AddUrlaclUrl
|
411
|
+
def initialize builder, url
|
412
|
+
@builder = builder
|
413
|
+
@builder.append " add urlacl url=#{@builder.format url}"
|
414
|
+
end
|
415
|
+
def user user
|
416
|
+
@builder.append " user=#{@builder.format user}"
|
417
|
+
self
|
418
|
+
end
|
419
|
+
def listen listen
|
420
|
+
@builder.append " listen=#{@builder.format listen}"
|
421
|
+
self
|
422
|
+
end
|
423
|
+
def delegate delegate
|
424
|
+
@builder.append " delegate=#{@builder.format delegate}"
|
425
|
+
self
|
426
|
+
end
|
427
|
+
def sddl sddl
|
428
|
+
@builder.append " sddl=#{@builder.format sddl}"
|
429
|
+
self
|
430
|
+
end
|
431
|
+
def to_s
|
432
|
+
@builder.to_s
|
433
|
+
end
|
434
|
+
def execute
|
435
|
+
begin
|
436
|
+
require 'rake'
|
437
|
+
sh to_s
|
438
|
+
rescue LoadError
|
439
|
+
system to_s
|
440
|
+
end
|
441
|
+
end
|
442
|
+
end
|
403
443
|
def netsh
|
404
444
|
Netsh.new CommandBuilder.new
|
405
445
|
end
|