{"id":26851388,"url":"https://github.com/azizemir/ifconfig-color","last_synced_at":"2025-03-30T22:31:13.832Z","repository":{"id":251592878,"uuid":"837863103","full_name":"AzizEmir/ifconfig-color","owner":"AzizEmir","description":"`ifconfig-color` is a shell script that enhances the readability of `ifconfig` output by applying color to various elements. This makes it easier to interpret network interface details, packet counts, MAC addresses, and more.","archived":false,"fork":false,"pushed_at":"2024-12-31T11:59:23.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-31T12:29:19.780Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AzizEmir.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-04T09:08:19.000Z","updated_at":"2024-12-31T11:59:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"c93e9d98-0282-41ee-aa37-55cb54311e0e","html_url":"https://github.com/AzizEmir/ifconfig-color","commit_stats":null,"previous_names":["azizemir/ifconfig-color"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AzizEmir%2Fifconfig-color","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AzizEmir%2Fifconfig-color/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AzizEmir%2Fifconfig-color/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AzizEmir%2Fifconfig-color/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AzizEmir","download_url":"https://codeload.github.com/AzizEmir/ifconfig-color/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246390896,"owners_count":20769475,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-30T22:31:12.706Z","updated_at":"2025-03-30T22:31:13.825Z","avatar_url":"https://github.com/AzizEmir.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ifconfig-color\n\n`ifconfig-color` is a python code that enhances the readability of `ifconfig` output by applying color to various elements. This makes it easier to interpret network interface details, packet counts, MAC addresses, and more.\n\n![image](https://github.com/user-attachments/assets/3df7edc7-bdf2-4cf3-bea4-4d140bcd187f)\n\n\n```python3\nimport re\nimport subprocess\n\n# ifconfig çıktısını al\nifconfig_output = subprocess.check_output(['ifconfig'], text=True)\n\n# Regex desenleri ve renk kodlarını tutan bir sözlük\npatterns_and_colors = {\n    # 'prefixlen' değerini tespit et ve magenta (pembe) renkte vurgula\n    r'(?\u003c=prefixlen\\s)\\d+': \"\\033[38;2;255;0;255m\",  # magenta \t#FF00FF rgb(255,0,255)\n    \n    # 'scopeid' değerini tespit et ve magenta (pembe) renkte vurgula\n    r'(?\u003c=scopeid\\s0x)[a-fA-F0-9]+': \"\\033[38;2;255;0;255m\",  # magenta \t#FF00FF rgb(255,0,255)\n    \n    # 'KiB' veya 'MiB' ile biten sayıları tespit et ve magenta (pembe) renkte vurgula\n    r'\\(\\d+(\\.\\d+)?\\s(KiB|MiB|GiB|B)\\)': \"\\033[38;2;255;0;255m\",  # magenta \t#FF00FF rgb(255,0,255)\n    \n    # Ağ yapılandırma ile ilgili anahtar kelimeleri (inet6, ether, prefixlen, vb.) sarı renkte vurgula\n    r'\\b(inet6|inet|netmask|broadcast|ether|prefixlen|scopeid|RX packets|TX packets)\\b': \"\\033[38;2;255;200;0m\",  # yellow #FF8C00 rgb(255,140,0)\n    \n    # IPv4 adreslerini tespit et ve magenta (pembe) renkte vurgula\n    r'(\\b25[0-5]|\\b2[0-4][0-9]|\\b[01]?[0-9][0-9]?)(\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}': \"\\033[38;2;255;0;255m\",  # magenta #FF00FF rgb(255,0,255)\n    \n    # Arayüz isimlerini (örneğin 'eth0', 'wlan0') tespit et ve mavi renkte vurgula\n    r'^([\\w-]+):': \"\\033[38;2;30;144;255m\",  # rgb(30, 144, 255) mavi\n    \n    # MAC adreslerini tespit et ve yeşil renkte vurgula\n    r'(?:[0-9A-Fa-f]{2}[:-]){5}[0-9A-Fa-f]{2}': \"\\033[38;2;0;255;144m\",  # rgb(0, 255, 144) yeşil\n\n    # ipv6\n    r'(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])) ':\"\\033[38;2;255;0;255m\", # mediumpurple \t#9370DB \trgb(147,112,219)\n}\n\n# Her bir regex deseni ve renk kodu için işlemleri uygula\nhighlighted_output = ifconfig_output\n\nfor pattern, color_code in patterns_and_colors.items():\n    # Eşleşen kısımları renklendirmek için regex'i uygula\n    highlighted_output = re.sub(pattern, lambda match: f\"{color_code}{match.group(0)}\\033[0m\", highlighted_output, flags=re.M)\n\n# Renklendirilmiş çıktıyı terminale yazdır\nprint(highlighted_output)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazizemir%2Fifconfig-color","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazizemir%2Fifconfig-color","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazizemir%2Fifconfig-color/lists"}