Skip to content

Commit

Permalink
Update ExtractIPAddresses.mjs to include Defanged IPv4 Addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
h45h-1nclud3 committed Jun 22, 2023
1 parent 1bc8872 commit 4fd8865
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/core/operations/ExtractIPAddresses.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ class ExtractIPAddresses extends Operation {
type: "boolean",
value: false
},
,

Check failure on line 43 in src/core/operations/ExtractIPAddresses.mjs

View workflow job for this annotation

GitHub Actions / main

Bad line breaking before and after ','
{
name: "Defanged IPv4 Addresses",
type: "boolean",
value: false
},
{
name: "Display total",
type: "boolean",
Expand All @@ -64,15 +70,20 @@ class ExtractIPAddresses extends Operation {
* @returns {string}
*/
run(input, args) {
const [includeIpv4, includeIpv6, removeLocal, displayTotal, sort, unique] = args,
const [includeIpv4, includeIpv6, removeLocal, includeDefangedIpv4, displayTotal, sort, unique] = args,
ipv4 = "(?:(?:\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d|\\d)(?:\\/\\d{1,2})?",
ipv4_defanged = "(?:(?:\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])\\[\\.\\]){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d|\\d)(?:\\/\\d{1,2})?",

Check failure on line 75 in src/core/operations/ExtractIPAddresses.mjs

View workflow job for this annotation

GitHub Actions / main

Identifier 'ipv4_defanged' is not in camel case
ipv6 = "((?=.*::)(?!.*::.+::)(::)?([\\dA-F]{1,4}:(:|\\b)|){5}|([\\dA-F]{1,4}:){6})((([\\dA-F]{1,4}((?!\\3)::|:\\b|(?![\\dA-F])))|(?!\\2\\3)){2}|(((2[0-4]|1\\d|[1-9])?\\d|25[0-5])\\.?\\b){4})";
let ips = "";

if (includeIpv4 && includeIpv6) {
ips = ipv4 + "|" + ipv6;
} else if (includeIpv4) {
ips = ipv4;
} else if (includeIpv4 && includeDefangedIpv4){

Check failure on line 83 in src/core/operations/ExtractIPAddresses.mjs

View workflow job for this annotation

GitHub Actions / main

This branch can never execute. Its condition is a duplicate or covered by previous conditions in the if-else-if chain

Check failure on line 83 in src/core/operations/ExtractIPAddresses.mjs

View workflow job for this annotation

GitHub Actions / main

Missing space before opening brace
ips = ipv4 + "|" + ipv4_defanged

Check failure on line 84 in src/core/operations/ExtractIPAddresses.mjs

View workflow job for this annotation

GitHub Actions / main

Identifier 'ipv4_defanged' is not in camel case

Check failure on line 84 in src/core/operations/ExtractIPAddresses.mjs

View workflow job for this annotation

GitHub Actions / main

Missing semicolon
} else if (includeIpv4 && includeDefangedIpv4 && includeIpv6){

Check failure on line 85 in src/core/operations/ExtractIPAddresses.mjs

View workflow job for this annotation

GitHub Actions / main

This branch can never execute. Its condition is a duplicate or covered by previous conditions in the if-else-if chain

Check failure on line 85 in src/core/operations/ExtractIPAddresses.mjs

View workflow job for this annotation

GitHub Actions / main

Missing space before opening brace
ips = ipv4 + "|" + ipv4_defanged + "|" + ipv6

Check failure on line 86 in src/core/operations/ExtractIPAddresses.mjs

View workflow job for this annotation

GitHub Actions / main

Identifier 'ipv4_defanged' is not in camel case
} else if (includeIpv6) {
ips = ipv6;
}
Expand Down

0 comments on commit 4fd8865

Please sign in to comment.