File tree 2 files changed +17
-49
lines changed
2 files changed +17
-49
lines changed Original file line number Diff line number Diff line change @@ -24,18 +24,8 @@ class DefangIP extends Operation {
24
24
this . infoURL = "https://isc.sans.edu/forums/diary/Defang+all+the+things/22744/" ;
25
25
this . inputType = "string" ;
26
26
this . outputType = "string" ;
27
- this . args = [
28
- {
29
- name : "IPV4" ,
30
- type : "boolean" ,
31
- value : true
32
- } ,
33
- {
34
- name : "IPV6" ,
35
- type : "boolean" ,
36
- value : true
37
- }
38
- ] ;
27
+ this . args = [ ] ;
28
+
39
29
}
40
30
41
31
/**
@@ -44,18 +34,17 @@ class DefangIP extends Operation {
44
34
* @returns {string }
45
35
*/
46
36
run ( input , args ) {
47
- const [ IPV4 , IPV6 ] = args ;
48
-
49
- if ( IPV4 ) {
50
- input = input . replace ( IPV4_REGEX , x => {
51
- return x . replace ( / \. / g, "[.]" ) ;
52
- } ) ;
53
- }
54
- if ( IPV6 ) {
55
- input = input . replace ( IPV6_REGEX , x => {
56
- return x . replace ( / : / g, "[:]" ) ;
57
- } ) ;
58
- }
37
+
38
+
39
+ input = input . replace ( IPV4_REGEX , x => {
40
+ return x . replace ( / \. / g, "[.]" ) ;
41
+ } ) ;
42
+
43
+
44
+ input = input . replace ( IPV6_REGEX , x => {
45
+ return x . replace ( / : / g, "[:]" ) ;
46
+ } ) ;
47
+
59
48
return input ;
60
49
}
61
50
}
Original file line number Diff line number Diff line change 3
3
*
4
4
* @author h345983745
5
5
*
6
- * @copyright Crown Copyright 2017
6
+ * @copyright Crown Copyright 2019
7
7
* @license Apache-2.0
8
8
*/
9
9
import TestRegister from "../TestRegister" ;
@@ -16,7 +16,7 @@ TestRegister.addTests([
16
16
recipeConfig : [
17
17
{
18
18
op : "Defang IP" ,
19
- args : [ true , true ] ,
19
+ args : [ ] ,
20
20
} ,
21
21
] ,
22
22
} , {
@@ -26,7 +26,7 @@ TestRegister.addTests([
26
26
recipeConfig : [
27
27
{
28
28
op : "Defang IP" ,
29
- args : [ true , true ] ,
29
+ args : [ ] ,
30
30
} ,
31
31
] ,
32
32
} , {
@@ -36,29 +36,8 @@ TestRegister.addTests([
36
36
recipeConfig : [
37
37
{
38
38
op : "Defang IP" ,
39
- args : [ true , true ] ,
39
+ args : [ ] ,
40
40
} ,
41
41
] ,
42
42
} ,
43
- {
44
- name : "Defang IP: IPV4 Only" ,
45
- input : "192.168.1.1 2001:0db8:85a3:0000:0000:8a2e:0370:7343" ,
46
- expectedOutput : "192[.]168[.]1[.]1 2001:0db8:85a3:0000:0000:8a2e:0370:7343" ,
47
- recipeConfig : [
48
- {
49
- op : "Defang IP" ,
50
- args : [ true , false ] ,
51
- } ,
52
- ] ,
53
- } , {
54
- name : "Defang IP: IPV6 Only" ,
55
- input : "192.168.1.1 2001:0db8:85a3:0000:0000:8a2e:0370:7343" ,
56
- expectedOutput : "192.168.1.1 2001[:]0db8[:]85a3[:]0000[:]0000[:]8a2e[:]0370[:]7343" ,
57
- recipeConfig : [
58
- {
59
- op : "Defang IP" ,
60
- args : [ false , true ] ,
61
- } ,
62
- ] ,
63
- }
64
43
] ) ;
You can’t perform that action at this time.
0 commit comments