mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-09 15:55:01 -04:00
Fixed errors
This commit is contained in:
parent
680650f86c
commit
3326329c29
1 changed files with 3 additions and 3 deletions
|
@ -396,11 +396,11 @@ export function strToIpv6(ipStr, retArr=true) {
|
||||||
* expandIpv6("5555:126f::0001");
|
* expandIpv6("5555:126f::0001");
|
||||||
*/
|
*/
|
||||||
export function expandIpv6(ipStr) {
|
export function expandIpv6(ipStr) {
|
||||||
const padHex = function(ipStr){
|
const padHex = function (ipStr) {
|
||||||
if (ipStr.length === 39) {
|
if (ipStr.length === 39) {
|
||||||
return ipStr;
|
return ipStr;
|
||||||
}
|
}
|
||||||
const blockArray = ipStr.split(':');
|
const blockArray = ipStr.split(":");
|
||||||
let reconstructed = "";
|
let reconstructed = "";
|
||||||
blockArray.forEach((a) => {
|
blockArray.forEach((a) => {
|
||||||
for (let i = a.length; i < 4; i++) {
|
for (let i = a.length; i < 4; i++) {
|
||||||
|
@ -416,7 +416,7 @@ export function expandIpv6(ipStr) {
|
||||||
return ipStr;
|
return ipStr;
|
||||||
}
|
}
|
||||||
const totalBlocks = ipStr.match(/:/g).length - (ipStr.startsWith(":") || ipStr.endsWith(":")),
|
const totalBlocks = ipStr.match(/:/g).length - (ipStr.startsWith(":") || ipStr.endsWith(":")),
|
||||||
reqBlocks = 8 - totalBlocks;
|
reqBlocks = 8 - totalBlocks;
|
||||||
let expandedBlocks = (ipStr.startsWith(":") ? "" : ":") + "0000";
|
let expandedBlocks = (ipStr.startsWith(":") ? "" : ":") + "0000";
|
||||||
for (let i = 1; i < reqBlocks; i++) {
|
for (let i = 1; i < reqBlocks; i++) {
|
||||||
expandedBlocks += ":0000";
|
expandedBlocks += ":0000";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue