ip 주소로 국가 조회하는 방법 about.ip2c.org API

Open API/그 외 |2018. 8. 30. 17:08
반응형

아이피주소로 국가 조회하기


서비스하는 내용이 국가별로 제한되는 부분이라


DB를 구축하자니 그 업데이트관리가 문제이고


API가 있지 않을까 해서 구글링을 통해 알게된 사이트입니다.



https://about.ip2c.org



Request : 


https://ip2c.org/8.8.8.8


Response : 


1;US;USA;United States


; 로 구분자가 지정되어있으며


0 : WRONG INPUT , 1 : NORMAL , 2 : UNKNOWN 


US : ISO 국가코드 








아래 내용은 about.ip2c.org 사이트에서 발췌한 INPUT/OUTPUT 설명입니다.

 
==== Accepted inputs: ============================================================

You can use http or https.

https://ip2c.org/XXX.XXX.XXX.XXX
or
https://ip2c.org/?ip=XXX.XXX.XXX.XXX
|
+ standard IPv4 from 0.0.0.0 to 255.255.255.255
+ e.g. we take your IP:
    |
    + URL looks like this:  https://ip2c.org/128.134.3.161
    |                       or
    |                       https://ip2c.org/?ip=128.134.3.161
    |
    + resulting string is:  1;KR;KOR;Korea Republic of


https://ip2c.org/XXXXXXXXXX
or
https://ip2c.org/?dec=XXXXXXXXXX
|
+ decimal number from 0 to 4294967295 (MAX_INT)
+ faster than ?ip= option, less server-side processing
+ to convert IPv4 to decimal you only need to know this:
    |
    + (IPv4) A.B.C.D == A*256^3 + B*256^2 + C*256 + D (decimal)
    + e.g.   5.6.7.8 == 5*256^3 + 6*256^2 + 7*256 + 8
                     == 5*16777216 + 6*65536 + 7*256 + 8
                     == 83886080 + 393216 + 1792 + 8
                     == 84281096


https://ip2c.org/s
or
https://ip2c.org/self
or
https://ip2c.org/?self
|
+ processes caller's IP
+ faster than ?dec= option but limited to one purpose - give info about yourself


Caution
Some clients (e.g. ASP) may have issues while trying to open a file over HTTP.
In that case a slash / preceding ?ip= is obligatory.
==== Possible outputs: ===========================================================

You can use http or https.

0;;;WRONG INPUT
|
+ your request has not been processed due to invalid syntax
    |
    + e.g. bad IPv4 like 300.400.abc.256
    + e.g. bad decimal like 2a3b4c or bigger than MAX_INT


1;CD;COD;COUNTRY
|
+ contains two-letter (ISO 3166) and three-letter country codes, and a full country name
+ country name may be multi-word and contain spaces
+ e.g. we take your IP:
    |
    + URL looks like this:  https://ip2c.org/128.134.3.161
    |                       or
    |                       https://ip2c.org/?ip=128.134.3.161
    |
    + resulting string is:  1;KR;KOR;Korea Republic of


2;;;UNKNOWN
|
+ given ip/dec not found in database or not yet physically assigned to any country


The first digit indicates status so you don't have to always parse the whole string.
Output is always semicolon delimited text/plain - you can pass it to any type of application.


댓글()

cmd 창에서 파일 속성 변경하기 - ATTRIB

OS/Microsoft|2018. 8. 30. 16:01
반응형


ATTRIB 명령어를 사용하면 파일의 속성을 변경할 수 있습니다.


우선 이 옵션을 찾아보게 된 계기가...


여러위치에 위치한 파일들의 읽기 전용 속성을 일괄 변경하기 위함이었습니다.



패치파일을 하나 생성 한뒤 r 옵션을 적용하는데 매우 간단 명료하게 

- , + 로 옵션을 적용 해제 합니다.


# 읽기전용 해제 시 
attrib -r "파일경로 및 파일명"

#읽기전용 적용 시
attrib +r "파일경로 및 파일명"




프롬프트창에서 확인 가능한 상세 옵션입니다.


(c) 2017 Microsoft Corporation. All rights reserved.


C:\Users\Administrator>Attrib /?

Displays or changes file attributes.


ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] [+O | -O] [+I | -I] [+P | -P] [+U | -U]

       [drive:][path][filename] [/S [/D]] [/L]


  +   Sets an attribute.

  -   Clears an attribute.

  R   Read-only file attribute.

  A   Archive file attribute.

  S   System file attribute.

  H   Hidden file attribute.

  O   Offline attribute.

  I   Not content indexed file attribute.

  X   No scrub file attribute.

  V   Integrity attribute.

  P   Pinned attribute.

  U   Unpinned attribute.

  [drive:][path][filename]

      Specifies a file or files for attrib to process.

  /S  Processes matching files in the current folder

      and all subfolders.

  /D  Processes folders as well.

  /L  Work on the attributes of the Symbolic Link versus

      the target of the Symbolic Link



C:\Users\Administrator>




댓글()