mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 23:06:16 -04:00
Tidied up 'Defang IP Addresses' operation
This commit is contained in:
parent
a4e9025b8e
commit
43472394c7
2 changed files with 7 additions and 10 deletions
|
@ -180,7 +180,7 @@
|
||||||
"Encode NetBIOS Name",
|
"Encode NetBIOS Name",
|
||||||
"Decode NetBIOS Name",
|
"Decode NetBIOS Name",
|
||||||
"Defang URL",
|
"Defang URL",
|
||||||
"Defang IP"
|
"Defang IP Addresses"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,19 +8,19 @@ import Operation from "../Operation";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defang IP operation
|
* Defang IP Addresses operation
|
||||||
*/
|
*/
|
||||||
class DefangIP extends Operation {
|
class DefangIPAddresses extends Operation {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DefangIP constructor
|
* DefangIPAddresses constructor
|
||||||
*/
|
*/
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.name = "Defang IP";
|
this.name = "Defang IP Addresses";
|
||||||
this.module = "Default";
|
this.module = "Default";
|
||||||
this.description = "Takes a IPV4 or IPV6 address and 'Defangs' it; meaning the IP becomes invalid, removing the risk of accidentally utilising it as an IP address.";
|
this.description = "Takes a IPv4 or IPv6 address and 'Defangs' it, meaning the IP becomes invalid, removing the risk of accidentally utilising it as an IP address.";
|
||||||
this.infoURL = "https://isc.sans.edu/forums/diary/Defang+all+the+things/22744/";
|
this.infoURL = "https://isc.sans.edu/forums/diary/Defang+all+the+things/22744/";
|
||||||
this.inputType = "string";
|
this.inputType = "string";
|
||||||
this.outputType = "string";
|
this.outputType = "string";
|
||||||
|
@ -34,13 +34,10 @@ class DefangIP extends Operation {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
run(input, args) {
|
run(input, args) {
|
||||||
|
|
||||||
|
|
||||||
input = input.replace(IPV4_REGEX, x => {
|
input = input.replace(IPV4_REGEX, x => {
|
||||||
return x.replace(/\./g, "[.]");
|
return x.replace(/\./g, "[.]");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
input = input.replace(IPV6_REGEX, x => {
|
input = input.replace(IPV6_REGEX, x => {
|
||||||
return x.replace(/:/g, "[:]");
|
return x.replace(/:/g, "[:]");
|
||||||
});
|
});
|
||||||
|
@ -49,7 +46,7 @@ class DefangIP extends Operation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default DefangIP;
|
export default DefangIPAddresses;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
Loading…
Add table
Add a link
Reference in a new issue