main.go - dnsrecon - DNS reconnaissance tool written in golang, kinda scuffed.
(HTM) git clone git://jay.scot/dnsrecon
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
main.go (1678B)
---
1 package main
2
3 import (
4 "fmt"
5
6 "github.com/kataras/go-template/html"
7 "github.com/kataras/iris"
8 "github.com/miekg/dns"
9 )
10
11 type data struct {
12 Title string
13 Domain string
14 }
15
16 // Target - the target domain to scan.
17 type Target struct {
18 Domain string
19 }
20
21 func main() {
22
23 // default template
24 iris.UseTemplate(html.New(html.Config{
25 Layout: "layout.html",
26 }))
27
28 // assets
29 iris.StaticWeb("/static", "./static", 1)
30 iris.Favicon("./static/favicon.ico")
31
32 // main page
33 iris.Get("/", func(ctx *iris.Context) {
34 ctx.Render("main.html", nil)
35 })
36
37 iris.OnError(iris.StatusInternalServerError, func(ctx *iris.Context) {
38 iris.Logger.Printf("http status: 500 happened!")
39 ctx.RedirectTo("/")
40 })
41
42 /* Types:
43 *
44 * A Record = 1
45 * NS Records = 2
46 * MX Records = 15
47 * PTR Records = 12
48 */
49 iris.Get("/results/:id", func(ctx *iris.Context) {
50 id := ctx.Param("id")
51
52 hostDNS, status := Query(id, 2)
53 iris.Logger.Printf("Status is : %v", status)
54 iris.Logger.Printf("DNS : %v", hostDNS)
55
56 hostA, status := Query(id, 1)
57 iris.Logger.Printf("Status is : %v", status)
58 iris.Logger.Printf("A Records : %v", hostA)
59
60 rHost, _ := dns.ReverseAddr("216.58.201.46")
61 hostPtr, status := Query(rHost, 12)
62 iris.Logger.Printf("Status is : %v", status)
63 iris.Logger.Printf("Reverse DNS : %v", hostPtr)
64
65 ctx.Render("scan.html", data{"Results", id})
66 })
67
68 // get the form data & start scan
69 iris.Post("/start_scan", func(ctx *iris.Context) {
70 target := Target{}
71 err := ctx.ReadForm(&target)
72 if err != nil {
73 fmt.Println("Form Error : " + err.Error())
74 ctx.RedirectTo("/")
75 }
76 ctx.Redirect("/results/" + string(ctx.FormValue("Domain")))
77 })
78
79 iris.Listen(":3001")
80 }