■ ■ ■ ■ ■ ■
Src/ES.Taipan.Application/Scan.fs
| skipped 13 lines |
14 | 14 | | open ES.Taipan.Discoverer |
15 | 15 | | open ES.Fslog |
16 | 16 | | open System.Runtime.Remoting.Messaging |
| 17 | + | open System.Net.NetworkInformation |
17 | 18 | | |
18 | 19 | | type ScanState = |
19 | 20 | | | Created |
| skipped 127 lines |
147 | 148 | | let webPageRequestor = _container.Value.Resolve<IWebPageRequestor>() |
148 | 149 | | message.Item.WebPageRequestor <- Some webPageRequestor |
149 | 150 | | |
| 151 | + | let getTaipanIp() = |
| 152 | + | let mutable ip = "<no network>" |
| 153 | + | if NetworkInterface.GetIsNetworkAvailable() then |
| 154 | + | NetworkInterface.GetAllNetworkInterfaces() |
| 155 | + | |> Seq.filter(fun network -> network.NetworkInterfaceType = NetworkInterfaceType.Ethernet) |
| 156 | + | |> Seq.map(fun network -> network.GetIPProperties().UnicastAddresses) |
| 157 | + | |> Seq.concat |
| 158 | + | |> Seq.filter(fun ip -> ip.Address.AddressFamily = System.Net.Sockets.AddressFamily.InterNetwork) |
| 159 | + | |> Seq.tryHead |
| 160 | + | |> function |
| 161 | + | | Some ipInfo -> ip <- ipInfo.Address.ToString() |
| 162 | + | | None -> () |
| 163 | + | ip |
| 164 | + | |
150 | 165 | | do |
151 | 166 | | _serviceMetrics.AddMetric("Status", "created") |
152 | 167 | | if scanContext.Template.CrawlerSettings.Scope <> NavigationScope.WholeDomain then |
| skipped 97 lines |
250 | 265 | | member internal this.StartScanIp(ip: String) = |
251 | 266 | | _serviceMetrics.AddMetric("Status", "running") |
252 | 267 | | _logger.ScanStarted(ip, scanContext) |
| 268 | + | _logger.TaipanIp(getTaipanIp()) |
253 | 269 | | _logger.UsedTemplate(scanContext.Template) |
254 | 270 | | |
255 | 271 | | this.State <- ScanState.Running |
| skipped 219 lines |