Skip to content

Commit d8251b3

Browse files
committed
fix: add error handling for invalid URLs in target host parsing
1 parent 3f13880 commit d8251b3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/run/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@ export default async (cmd) => {
3636
return;
3737
}
3838

39-
const targetHost = new URL(cmd.url).host.replace(":", "_");
39+
let targetHost;
40+
try {
41+
targetHost = new URL(cmd.url).host.replace(":", "_");
42+
} catch (e) {
43+
console.log(chalk.red(`[!] Invalid URL: ${cmd.url}`));
44+
process.exit(1);
45+
}
4046

4147
console.log(chalk.bgGreenBright("[+] Starting analysis..."));
4248

0 commit comments

Comments
 (0)