-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.ts
More file actions
79 lines (67 loc) · 1.96 KB
/
main.ts
File metadata and controls
79 lines (67 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import { parseArgs } from "jsr:@std/cli/parse-args"
import { scanner } from './tools/scanner.ts'
import getCredentials from "./utils/getCredentials.ts"
import { removeAuthCredentials } from "./utils/removeAuthenticationFiles.ts"
import logger from "./utils/logger.ts"
import getHelp from "./utils/getHelp.ts"
import banner from "./utils/banner.ts"
const args = parseArgs(Deno.args, {
alias: {
startUrl: "u",
followRedirects: "r",
headless: "e",
sqliScan: "s",
verbose: "v",
findForms: "f",
paramSQLIScan: "p",
outputToFile: "o",
crawl: "c",
help: "h"
}
})
const startUrl = args.startUrl as keyof typeof String
const followRedirects = args.followRedirects as keyof typeof String
const sqliScan = args.sqliScan as keyof typeof String
async function main() {
if(args.help){
banner()
getHelp()
Deno.exit(0)
}
if (!startUrl || typeof startUrl !== "string" || !args) {
logger(
"You must provide a valid URL using the -u flag (example: -u http://example.com)\nFor more information, use the -h flag",
"red"
)
getHelp()
Deno.exit(1)
}
await getCredentials()
const redirect = followRedirects ? false : true
const sqliInit = sqliScan ? true : false
const outputToFile = args.outputToFile ? true : false
const verbose = args.verbose ? true : false
const findForms = args.findForms ? true : false
const paramSQLIScan = args.paramSQLIScan ? true : false
const headless = args.headless ? false : true
const crawl = args.crawl ? true : false
const results = await scanner(
startUrl,
redirect,
sqliInit,
findForms,
paramSQLIScan,
crawl,
headless,
verbose
)
if(results && outputToFile){
Deno.writeFileSync("./results.json", new TextEncoder().encode(JSON.stringify(results, null, 2)), { append: false })
logger("Results saved to results.json", "orange")
}
removeAuthCredentials()
logger("\n")
logger("Done!", "orange")
logger("\n")
}
main()