cip.git

cip

~
git clone https://github.com/debuman/cip.git
commit 9abe25c812792da7464a232ab913f00ce5cd3c76
parent d421a96ec69c10dbdd5f3ea007cb04fe06e6f7dc
Author: Decoy Zero <110329244+devastator-x@users.noreply.github.com>
Date: Tue, 25 Feb 2025 10:08:32 +0900

Update cip.py

Diffstat:
Mcip.py | 90++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 85 insertion(+), 5 deletion(-)

diff --git a/cip.py b/cip.py
@@ -201,6 +201,66 @@ def print_port_info(data):
     else:
         print(f"{Fore.GREEN}개방된 포트가 없습니다.{Style.RESET_ALL}")
 
+# 도메인 기본 정보 가져오기
+def get_domain_summary(domain, api_key):
+    """도메인 기본 정보 조회"""
+    url = f"https://api.criminalip.io/v1/domain/summary?query={domain}"
+    headers = {"x-api-key": api_key}
+    response = requests.get(url, headers=headers)
+    response_data = response.json()
+    
+    # 전체 응답 JSON 출력
+    print("Full Domain Summary JSON Response:", json.dumps(response_data, indent=4))
+    return response.json()
+
+def print_domain_info(data):
+    """도메인 정보 출력"""
+    print_header("도메인 정보")
+    
+    domain_data = data.get("data", {})
+    
+    # 기본 정보 출력
+    registrar = domain_data.get("registrar", "N/A")
+    creation_date = domain_data.get("creation_date", "N/A")
+    expiration_date = domain_data.get("expiration_date", "N/A")
+    is_blacklisted = domain_data.get("is_blacklisted", False)
+    
+    # 블랙리스트 상태에 따른 색상 설정
+    blacklist_color = Fore.RED if is_blacklisted else Fore.GREEN
+    
+    print_field("등록 기관", registrar)
+    print_field("생성일", creation_date)
+    print_field("만료일", expiration_date)
+    print_field("블랙리스트 여부", str(is_blacklisted), blacklist_color)
+    
+    # DNS 레코드 정보 출력
+    print_header("DNS 레코드")
+    dns_records = domain_data.get("dns_records", {})
+    
+    if dns_records:
+        # A 레코드
+        a_records = dns_records.get("a", [])
+        if a_records:
+            print(f"\n{Fore.CYAN}A 레코드:{Style.RESET_ALL}")
+            for record in a_records:
+                print(f"  ∟ {Fore.WHITE}{record}{Style.RESET_ALL}")
+        
+        # MX 레코드
+        mx_records = dns_records.get("mx", [])
+        if mx_records:
+            print(f"\n{Fore.CYAN}MX 레코드:{Style.RESET_ALL}")
+            for record in mx_records:
+                print(f"  ∟ {Fore.WHITE}{record}{Style.RESET_ALL}")
+        
+        # NS 레코드
+        ns_records = dns_records.get("ns", [])
+        if ns_records:
+            print(f"\n{Fore.CYAN}NS 레코드:{Style.RESET_ALL}")
+            for record in ns_records:
+                print(f"  ∟ {Fore.WHITE}{record}{Style.RESET_ALL}")
+    else:
+        print(f"{Fore.YELLOW}DNS 레코드를 찾을 수 없습니다.{Style.RESET_ALL}")
+
 def main():
     if len(sys.argv) < 2 or sys.argv[1] == '-h':
         print(f"{Fore.CYAN}사용법:{Style.RESET_ALL}")
@@ -208,17 +268,16 @@ def main():
         print("\n명령어:")
         print(f"  {Fore.YELLOW}init <api_key>{Style.RESET_ALL}    - API 키를 초기화하고 저장합니다.")
         print(f"  {Fore.YELLOW}ip <ip_address> [options]{Style.RESET_ALL} - 지정된 IP 주소에 대한 정보를 분석합니다.")
-        print("\n옵션:")
+        print(f"  {Fore.YELLOW}domain <domain_name>{Style.RESET_ALL} - 지정된 도메인에 대한 정보를 분석합니다.")
+        print("\nIP 분석 옵션:")
         print(f"  {Fore.YELLOW}-c{Style.RESET_ALL}      - 취약성 정보 출력")
         print(f"  {Fore.YELLOW}-m{Style.RESET_ALL}      - 악성 정보 출력")
         print(f"  {Fore.YELLOW}-p{Style.RESET_ALL}      - 개방 포트 정보 출력")
         print(f"  {Fore.YELLOW}-a{Style.RESET_ALL}      - 기본 정보, 취약성, 악성, 개방 포트 정보를 모두 출력")
-        print(f"  {Fore.YELLOW}-cmp{Style.RESET_ALL}    - 취약성, 악성, 개방 포트 정보를 조합하여 출력")
-        print(f"  {Fore.YELLOW}-mpc{Style.RESET_ALL}    - 악성, 개방 포트, 취약성 정보를 조합하여 출력")
         print(f"\n예시:")
         print(f"  python script_name.py init <api_key>")
         print(f"  python script_name.py ip 1.1.1.1 -a")
-        print(f"  python script_name.py ip 8.8.8.8 -cmp\n")
+        print(f"  python script_name.py domain example.com\n")
         return
 
     command = sys.argv[1]
@@ -266,11 +325,32 @@ def main():
         
         print(f"\n{Fore.CYAN}[*] 분석 완료{Style.RESET_ALL}\n")
     
+    elif command == 'domain':
+        if len(sys.argv) < 3:
+            print(f"{Fore.RED}Usage: python script_name.py domain <domain_name>{Style.RESET_ALL}")
+            return
+
+        # API 키 로드
+        api_key = load_api_key()
+        if not api_key:
+            print(f"{Fore.RED}[-] API key not found. Please run 'python script_name.py init <api_key>' first{Style.RESET_ALL}")
+            return
+
+        domain_name = sys.argv[2]
+        print(f"\n{Fore.CYAN}[*] 도메인 {Fore.WHITE}{domain_name}{Fore.CYAN} 분석 중...{Style.RESET_ALL}")
+        
+        # 도메인 정보 조회 및 출력
+        domain_data = get_domain_summary(domain_name, api_key)
+        print_domain_info(domain_data)
+        
+        print(f"\n{Fore.CYAN}[*] 분석 완료{Style.RESET_ALL}\n")
+    
     else:
         print(f"{Fore.RED}Unknown command: {command}{Style.RESET_ALL}")
         print("Available commands:")
         print("  init <api_key>    Initialize API key")
         print("  ip <ip_address> [-c | -m | -p | -a | -cmp | -mpc | ...]    Analyze IP address")
-        
+        print("  domain <domain_name>    Analyze domain")
+
 if __name__ == "__main__":
     main()
\ No newline at end of file