Index.cshtml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. @using economy.Models.Whois.Domain
  2. @using economy.Models.Whois.IP
  3. @{
  4. ViewData["Title"] = "Whois IP/Doamin 조회";
  5. }
  6. <div id="whois" class="container">
  7. <h3>@ViewData["Title"]</h3>
  8. <br/>
  9. <form id="fSearch" method="post" accept-charset="UTF-8" rel="search" autocomplete="off" asp-controller="Whois" asp-action="Search">
  10. <div class="row justify-content-center">
  11. <div class="col col-md-4">
  12. <div class="input-group">
  13. <input type="text" name="query" class="form-control" value="@ViewBag?.Query" placeholder="예) 도메인 또는 IP" aria-label="예) 도메인 또는 IP" aria-describedby="IP or Domain Search" autofocus maxlength="120" />
  14. <button class="btn btn-outline-danger" type="submit"><i class="bi bi-search"></i></button>
  15. </div>
  16. </div>
  17. </div>
  18. @if (@ViewBag?.Query is not null && @ViewBag.isError)
  19. {
  20. <div class="no-data">
  21. 조회 결과가 없습니다.
  22. </div>
  23. }
  24. else
  25. {
  26. @if (ViewBag.result is not null && ViewBag.result.Result.ResultCode == 10000)
  27. {
  28. <div class="result w-75 m-auto mt-3 bg-transparent">
  29. @switch(ViewBag.type)
  30. {
  31. // 도메인 검색
  32. case 1:
  33. var result = (economy.Models.Whois.Domain.Response)ViewBag.result;
  34. <table class="table table-bordered">
  35. <caption class="caption-top">
  36. <h5>@result.Whois.KrDomain.Name</h5>
  37. </caption>
  38. <colgroup>
  39. <col width="30%"/>
  40. <col width="*"/>
  41. </colgroup>
  42. <tbody>
  43. <tr>
  44. <th>등록인 이름</th>
  45. <td>@result.Whois.KrDomain.RegName<br />(@result.Whois.KrDomain.ERegName)</td>
  46. </tr>
  47. <tr>
  48. <th>관리자 이름</th>
  49. <td>@result.Whois.KrDomain.AdminName<br />(@result.Whois.KrDomain.EAdminName)</td>
  50. </tr>
  51. <tr>
  52. <th>관리자 이메일</th>
  53. <td>@(result.Whois.KrDomain?.AdminEmail ?? "-")</td>
  54. </tr>
  55. <tr>
  56. <th>관리자 연락처</th>
  57. <td>@(result.Whois.KrDomain?.AdminPhone ?? "-")</td>
  58. </tr>
  59. <tr>
  60. <th>등록일자</th>
  61. <td>@result.Whois.KrDomain.RegDate</td>
  62. </tr>
  63. <tr>
  64. <th>최근 정보 변경일</th>
  65. <td>@result.Whois.KrDomain.LastUpdatedDate</td>
  66. </tr>
  67. <tr>
  68. <th>만료일자</th>
  69. <td>@result.Whois.KrDomain.EndDate</td>
  70. </tr>
  71. <tr>
  72. <th>정보공개여부</th>
  73. <td>@result.Whois.KrDomain.InfoYN</td>
  74. </tr>
  75. <tr>
  76. <th>등록대행자</th>
  77. <td>
  78. <a href="@result.Whois.KrDomain.AgencyUrl" target="_blank" rel="author">@result.Whois.KrDomain.Agency</a><br />(@result.Whois.KrDomain.EAgency)
  79. </td>
  80. </tr>
  81. <tr>
  82. <th>등록정보 보호</th>
  83. <td>@result.Whois.KrDomain.DomainStatus</td>
  84. </tr>
  85. <tr>
  86. <th>DNSSEC</th>
  87. <td>
  88. @if (@result.Whois.KrDomain.DNSSEC == "unsigned")
  89. {
  90. <text>미서명</text>
  91. }
  92. else
  93. {
  94. <text>서명</text>
  95. }
  96. </td>
  97. </tr>
  98. </tbody>
  99. </table>
  100. <!-- DNS 정보 -->
  101. <table class="table table-bordered">
  102. <colgroup>
  103. <col width="30%" />
  104. <col width="*" />
  105. </colgroup>
  106. <tbody>
  107. @if (@result.Whois != null
  108. && @result.Whois.KrDomain != null
  109. && @result.Whois.KrDomain.NameServers != null
  110. && @result.Whois.KrDomain.IPAddresses != null)
  111. {
  112. int count = Math.Min(@result.Whois.KrDomain.NameServers.Count, @result.Whois.KrDomain.IPAddresses.Count);
  113. for (int i = 0; i < count; i++)
  114. {
  115. <tr>
  116. <th colspan="2">@($"{i + 1}차 네임서버")</th>
  117. </tr>
  118. <tr>
  119. <td>호스트 이름</td>
  120. <td>@result.Whois.KrDomain.NameServers[i]</td>
  121. </tr>
  122. <tr>
  123. <td>IP 주소</td>
  124. <td>@result.Whois.KrDomain.IPAddresses[i]</td>
  125. </tr>
  126. }
  127. }
  128. else
  129. {
  130. <tr>
  131. <td colspan="2">네임서버 정보가 없습니다.</td>
  132. </tr>
  133. }
  134. </tbody>
  135. </table>
  136. break;
  137. // IP 검색
  138. case 2:
  139. var IP = (economy.Models.Whois.IP.Response)ViewBag.result;
  140. <h5>@IP.Whois.Query</h5>
  141. <small>IP 구분 : @IP.Whois.QueryType</small>
  142. <br />
  143. <small>등록대행사 : @IP.Whois.Registry</small>
  144. <br />
  145. <small>국가 코드 : @IP.Whois.CountryCode</small>
  146. <br />
  147. <hr/>
  148. <table class="table table-bordered">
  149. <caption class="caption-top ps-2">
  150. 조회하신 IPv4 주소는 한국인터넷진흥원으로 부터 아래의 관리대행자에게 할당되었으며, 할당 정보는 다음과 같습니다.
  151. </caption>
  152. <colgroup>
  153. <col width="30%" />
  154. <col width="*" />
  155. </colgroup>
  156. <tbody>
  157. <tr>
  158. <th>서비스 명</th>
  159. <td>@IP.Whois.Korean.ISP.NetInfo.ServName</td>
  160. </tr>
  161. <tr>
  162. <th>IPv4</th>
  163. <td>@IP.Whois.Korean.ISP.NetInfo.Range</td>
  164. </tr>
  165. <tr>
  166. <th>
  167. CIDR <i class="bi bi-info-circle" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="각각 CIDR(클래스 없는 도메인 라우팅, Classless Inter-Domain Routing) 표기법입니다. CIDR 표기법은 네트워크를 나누는 서브넷 마스크를 나타냅니다. 네트워크가 얼마나 세분화되어 있는지 나타내며, 숫자가 클수록 서브넷이 작아지고, 사용 가능한 IP 주소 수도 줄어듭니다."></i>
  168. </th>
  169. <td>@IP.Whois.Korean.ISP.NetInfo.Prefix</td>
  170. </tr>
  171. <tr>
  172. <th>기관 ID</th>
  173. <td>
  174. @IP.Whois.Korean.ISP.NetInfo.OrgID
  175. </td>
  176. </tr>
  177. <tr>
  178. <th>기관 명</th>
  179. <td>@IP.Whois.Korean.User.NetInfo.OrgName<br />(@IP.Whois.English.ISP.NetInfo.OrgName)</td>
  180. </tr>
  181. <tr>
  182. <th>주소</th>
  183. <td>
  184. (@IP.Whois.Korean.ISP.NetInfo.ZipCode) @IP.Whois.Korean.ISP.NetInfo.Addr<br />(@IP.Whois.English.ISP.NetInfo.ZipCode) @IP.Whois.English.ISP.NetInfo.Addr
  185. </td>
  186. </tr>
  187. <tr>
  188. <th>할당일자</th>
  189. <td>@IP.Whois.Korean.ISP.NetInfo.RegDate</td>
  190. </tr>
  191. </tbody>
  192. </table>
  193. <table class="table table-bordered">
  194. <caption class="caption-top ps-2">
  195. 위의 관리대행자로 부터 아래의 사용자에게 할당되었으며, 할당 정보는 다음과 같습니다.
  196. </caption>
  197. <colgroup>
  198. <col width="30%" />
  199. <col width="*" />
  200. </colgroup>
  201. <tbody>
  202. <tr>
  203. <th>네트워크 유형</th>
  204. <td>@IP.Whois.Korean.User.NetInfo.NetType</td>
  205. </tr>
  206. <tr>
  207. <th>IPv4</th>
  208. <td>@IP.Whois.Korean.User.NetInfo.Range</td>
  209. </tr>
  210. <tr>
  211. <th>CIDR <i class="bi bi-info-circle" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="각각 CIDR(클래스 없는 도메인 라우팅, Classless Inter-Domain Routing) 표기법입니다. CIDR 표기법은 네트워크를 나누는 서브넷 마스크를 나타냅니다. 네트워크가 얼마나 세분화되어 있는지 나타내며, 숫자가 클수록 서브넷이 작아지고, 사용 가능한 IP 주소 수도 줄어듭니다."></i></th>
  212. <td>@IP.Whois.Korean.User.NetInfo.Prefix</td>
  213. </tr>
  214. <tr>
  215. <th>기관 ID</th>
  216. <td>@IP.Whois.Korean.User.NetInfo.OrgID</td>
  217. </tr>
  218. <tr>
  219. <th>기관 명</th>
  220. <td>@IP.Whois.Korean.User.NetInfo.OrgName<br />(@IP.Whois.English.ISP.NetInfo.OrgName)</td>
  221. </tr>
  222. <tr>
  223. <th>주소</th>
  224. <td>(@IP.Whois.Korean.User.NetInfo.ZipCode) @IP.Whois.Korean.User.NetInfo.Addr</td>
  225. </tr>
  226. <tr>
  227. <th>할당일자</th>
  228. <td>@IP.Whois.Korean.User.NetInfo.RegDate</td>
  229. </tr>
  230. </tbody>
  231. </table>
  232. <table class="table table-bordered">
  233. <caption class="caption-top ps-2">
  234. @IP.Whois.Korean.ISP.TechContact.Name
  235. </caption>
  236. <colgroup>
  237. <col width="30%" />
  238. <col width="*" />
  239. </colgroup>
  240. <tbody>
  241. <tr>
  242. <th>전자주소</th>
  243. <td>@IP.Whois.Korean.ISP.TechContact.Email</td>
  244. </tr>
  245. <tr>
  246. <th>연락처</th>
  247. <td>@IP.Whois.Korean.ISP.TechContact.Phone</td>
  248. </tr>
  249. </tbody>
  250. </table>
  251. break;
  252. }
  253. </div>
  254. }
  255. else if (ViewBag.result is not null && ViewBag.result.Result.ResultCode != 10000)
  256. {
  257. <blockquote class="alert alert-danger mt-3" role="alert">
  258. @switch (ViewBag.type)
  259. {
  260. // 도메인 검색
  261. case 1:
  262. var domain = (economy.Models.Whois.Domain.Response)ViewBag.result;
  263. @domain.Result.ResultMsg;
  264. break;
  265. case 2:
  266. var ip = (economy.Models.Whois.IP.Response)ViewBag.result;
  267. @ip.Result.ResultMsg;
  268. break;
  269. }
  270. </blockquote>
  271. }
  272. else
  273. {
  274. <div class="row mt-2">
  275. <div class="col text-center">
  276. <small>국가 인터넷주소관리기관인 <a href="https://xn--c79as89aj0e29b77z.xn--3e0b707e/" target="_blank">한국인터넷진흥원</a>의 API를 사용합니다.</small>
  277. </div>
  278. </div>
  279. <br />
  280. <blockquote class="text-center">
  281. <strong>도메인 검색 예시</strong><br />
  282. <ul class="list-inline">
  283. <li class="list-inline-item">kisa.or.kr,</li>
  284. <li class="list-inline-item">ns0.kisa.or.kr,</li>
  285. <li class="list-inline-item">한국인터넷진흥원.kr</li>
  286. </ul>
  287. <strong>IP 검색 예시</strong><br />
  288. <ul class="list-inline">
  289. <li class="list-inline-item">202.30.50.51,</li>
  290. <li class="list-inline-item">2001:02B8::/32</li>
  291. </ul>
  292. </blockquote>
  293. }
  294. }
  295. </form>
  296. </div>
  297. @section Scripts {
  298. <script src="~/js/whois.js" asp-append-version="true"></script>
  299. }
  300. @section Styles {
  301. <link href="~/css/style.css" rel="stylesheet" asp-append-version="true" />
  302. }