{"id":34,"date":"2024-12-01T08:00:54","date_gmt":"2024-12-01T08:00:54","guid":{"rendered":"http:\/\/211.230.203.47\/wordpress\/?p=34"},"modified":"2024-12-01T08:00:54","modified_gmt":"2024-12-01T08:00:54","slug":"%ec%a3%bc%ea%b8%b0%ec%a0%81%ec%9c%bc%eb%a1%9c-%ed%98%84%ec%9e%ac-ip-%ec%a3%bc%ec%86%8c%eb%a5%bc-%ed%99%95%ec%9d%b8%ed%95%98%ea%b3%a0-%ec%9d%b4%ec%a0%84-ip%ec%99%80-%eb%b9%84%ea%b5%90%ed%95%98%ec%97%ac","status":"publish","type":"post","link":"https:\/\/www.soon7shop.kr\/wordpress\/?p=34","title":{"rendered":"\uc8fc\uae30\uc801\uc73c\ub85c \ud604\uc7ac IP \uc8fc\uc18c\ub97c \ud655\uc778\ud558\uace0 \uc774\uc804 IP\uc640 \ube44\uad50\ud558\uc5ec \ubcc0\uacbd\uc774 \uac10\uc9c0&#8230;."},"content":{"rendered":"<p>Bash \uc2a4\ud06c\ub9bd\ud2b8\ub97c \uc791\uc131\ud55c \uc608\uc81c\uc785\ub2c8\ub2e4. \uc774 \uc2a4\ud06c\ub9bd\ud2b8\ub294 \uc8fc\uae30\uc801\uc73c\ub85c \ud604\uc7ac IP \uc8fc\uc18c\ub97c \ud655\uc778\ud558\uace0 \uc774\uc804 IP\uc640 \ube44\uad50\ud558\uc5ec \ubcc0\uacbd\uc774 \uac10\uc9c0\ub418\uba74 \uc774\uba54\uc77c\ub85c \uc54c\ub9bc\uc744 \ubcf4\ub0c5\ub2c8\ub2e4.<\/p>\n<h3>1. <strong>\uc2a4\ud06c\ub9bd\ud2b8 \ub0b4\uc6a9 (<code>notify_ip_change.sh<\/code>)<\/strong><\/h3>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\"><\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\"><code class=\"!whitespace-pre hljs language-bash\"><\/code><\/code>#!\/bin\/bash<\/p>\n<p><code class=\"!whitespace-pre hljs language-bash\"><code class=\"!whitespace-pre hljs language-bash\"><\/code><\/code># \uc124\uc815<br \/>\nLOG_FILE=&#8221;\/var\/log\/ip_change.log&#8221;<br \/>\nIP_FILE=&#8221;\/tmp\/current_ip.txt&#8221;<br \/>\nCHECK_INTERVAL=300 # \uccb4\ud06c \uac04\uaca9 (\ucd08 \ub2e8\uc704)<br \/>\nSMTP_SERVER=&#8221;smtp.example.com&#8221; # SMTP \uc11c\ubc84 \uc8fc\uc18c<br \/>\nSMTP_PORT=587 # SMTP \ud3ec\ud2b8<br \/>\nEMAIL_FROM=&#8221;your_email@example.com&#8221; # \ubc1c\uc2e0 \uc774\uba54\uc77c<br \/>\nEMAIL_TO=&#8221;target_email@example.com&#8221; # \uc218\uc2e0 \uc774\uba54\uc77c<br \/>\nEMAIL_USER=&#8221;your_email@example.com&#8221; # \uc774\uba54\uc77c \uc0ac\uc6a9\uc790\uba85<br \/>\nEMAIL_PASS=&#8221;your_email_password&#8221; # \uc774\uba54\uc77c \ube44\ubc00\ubc88\ud638<\/p>\n<p><code class=\"!whitespace-pre hljs language-bash\"><code class=\"!whitespace-pre hljs language-bash\"><\/code><\/code># IP \ubcc0\uacbd \uc2dc \uc774\uba54\uc77c \ubcf4\ub0b4\uae30 \ud568\uc218<br \/>\nsend_email() {<br \/>\nlocal new_ip=&#8221;$1&#8243;<br \/>\necho -e &#8220;Subject: IP \ubcc0\uacbd \uc54c\ub9bc\\n\\n\uc0c8\ub85c\uc6b4 IP \uc8fc\uc18c: $new_ip&#8221; | \\<br \/>\ncurl &#8211;url &#8220;smtp:\/\/${SMTP_SERVER}:${SMTP_PORT}&#8221; \\<br \/>\n&#8211;ssl \\<br \/>\n&#8211;mail-from &#8220;$EMAIL_FROM&#8221; \\<br \/>\n&#8211;mail-rcpt &#8220;$EMAIL_TO&#8221; \\<br \/>\n&#8211;upload-file &#8211; \\<br \/>\n&#8211;user &#8220;$EMAIL_USER:$EMAIL_PASS&#8221;<br \/>\n}<\/p>\n<p><code class=\"!whitespace-pre hljs language-bash\"><code class=\"!whitespace-pre hljs language-bash\"><\/code><\/code># \ucd08\uae30 IP \uc124\uc815<br \/>\nif [[ ! -f &#8220;$IP_FILE&#8221; ]]; then<br \/>\ncurrent_ip=$(curl -s ifconfig.me)<br \/>\necho &#8220;$current_ip&#8221; &gt; &#8220;$IP_FILE&#8221;<br \/>\necho &#8220;$(date): \ucd08\uae30 IP \uc8fc\uc18c \uc124\uc815 &#8211; $current_ip&#8221; &gt;&gt; &#8220;$LOG_FILE&#8221;<br \/>\nfi<\/p>\n<p><code class=\"!whitespace-pre hljs language-bash\"><code class=\"!whitespace-pre hljs language-bash\"><\/code><\/code># \ubc31\uadf8\ub77c\uc6b4\ub4dc \uc2e4\ud589 \ub8e8\ud504<br \/>\nwhile true; do<br \/>\nnew_ip=$(curl -s ifconfig.me)<br \/>\nsaved_ip=$(cat &#8220;$IP_FILE&#8221;)<\/p>\n<p>if [[ &#8220;$new_ip&#8221; != &#8220;$saved_ip&#8221; ]]; then<br \/>\necho &#8220;$new_ip&#8221; &gt; &#8220;$IP_FILE&#8221;<br \/>\necho &#8220;$(date): IP \uc8fc\uc18c \ubcc0\uacbd \uac10\uc9c0 &#8211; $new_ip&#8221; &gt;&gt; &#8220;$LOG_FILE&#8221;<br \/>\nsend_email &#8220;$new_ip&#8221;<br \/>\nfi<\/p>\n<p>sleep &#8220;$CHECK_INTERVAL&#8221;<br \/>\ndone<\/p>\n<p><code class=\"!whitespace-pre hljs language-bash\"><br \/>\n<\/code><\/div>\n<\/div>\n<hr \/>\n<h3>2. <strong>\uc0ac\uc6a9 \ubc29\ubc95<\/strong><\/h3>\n<ol>\n<li><strong>\uc2a4\ud06c\ub9bd\ud2b8 \uc0dd\uc131 \ubc0f \uad8c\ud55c \ubd80\uc5ec<\/strong>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">nano notify_ip_change.sh<br \/>\n<\/code><\/div>\n<\/div>\n<p>\uc704 \ucf54\ub4dc\ub97c \ubd99\uc5ec\ub123\uace0 \uc800\uc7a5\ud569\ub2c8\ub2e4.<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\"><span class=\"hljs-built_in\">chmod<\/span> +x notify_ip_change.sh<br \/>\n<\/code><\/div>\n<\/div>\n<\/li>\n<li><strong>\ud544\uc218 \ud328\ud0a4\uc9c0 \uc124\uce58<\/strong>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">sudo apt update<br \/>\nsudo apt install curl<br \/>\n<\/code><\/div>\n<\/div>\n<\/li>\n<li><strong>\ubc31\uadf8\ub77c\uc6b4\ub4dc \uc2e4\ud589<\/strong>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\"><span class=\"hljs-built_in\">nohup<\/span> .\/notify_ip_change.sh &amp;<br \/>\n<\/code><\/div>\n<\/div>\n<\/li>\n<li><strong>\ub85c\uadf8 \ud655\uc778<\/strong>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\"><span class=\"hljs-built_in\">tail<\/span> -f \/var\/log\/ip_change.log<br \/>\n<\/code><\/div>\n<\/div>\n<\/li>\n<li><strong>\uc2a4\ud06c\ub9bd\ud2b8 \uc885\ub8cc<\/strong> \ud504\ub85c\uc138\uc2a4\ub97c \uc885\ub8cc\ud558\ub824\uba74 \ub2e4\uc74c\uc744 \uc2e4\ud589\ud569\ub2c8\ub2e4.\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">bash<\/div>\n<div class=\"sticky top-9 md:top-[5.75rem]\">\n<div class=\"absolute bottom-0 right-2 flex h-9 items-center\">\n<div class=\"flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary\"><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"!whitespace-pre hljs language-bash\">pkill -f notify_ip_change.sh<br \/>\n<\/code><\/div>\n<\/div>\n<\/li>\n<\/ol>\n<hr \/>\n<h3>3. <strong>\ucd94\uac00 \ucc38\uace0<\/strong><\/h3>\n<ul>\n<li><code>curl<\/code>\uc744 \uc0ac\uc6a9\ud558\uc5ec SMTP \uc11c\ubc84\ub97c \ud1b5\ud574 \uc774\uba54\uc77c\uc744 \ubcf4\ub0c5\ub2c8\ub2e4. \uc678\ubd80 POP3\/SMTP \uc815\ubcf4\ub97c \uc62c\ubc14\ub974\uac8c \uc124\uc815\ud558\uc138\uc694.<\/li>\n<li>\uc774\uba54\uc77c \ube44\ubc00\ubc88\ud638\ub294 \ubcf4\uc548 \ubb38\uc81c\ub85c \uc778\ud574 \uc554\ud638\ud654\ub41c \ud30c\uc77c\uc774\ub098 \ud658\uacbd \ubcc0\uc218\ub85c \uad00\ub9ac\ud558\ub294 \uac83\uc774 \uc88b\uc2b5\ub2c8\ub2e4. \ud544\uc694 \uc2dc \uc54c\ub824\uc8fc\uc138\uc694.<\/li>\n<li>IP \ud655\uc778 API (<code>ifconfig.me<\/code>)\ub97c \ubcc0\uacbd\ud560 \uc218\ub3c4 \uc788\uc2b5\ub2c8\ub2e4. \uc608: <code>ipinfo.io\/ip<\/code> \ub610\ub294 <code>api64.ipify.org<\/code>.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Bash \uc2a4\ud06c\ub9bd\ud2b8\ub97c \uc791\uc131\ud55c \uc608\uc81c\uc785\ub2c8\ub2e4. \uc774 \uc2a4\ud06c\ub9bd\ud2b8\ub294 \uc8fc\uae30\uc801\uc73c\ub85c \ud604\uc7ac IP \uc8fc\uc18c\ub97c \ud655\uc778\ud558\uace0 \uc774\uc804 IP\uc640 \ube44\uad50\ud558\uc5ec \ubcc0\uacbd\uc774 \uac10\uc9c0\ub418\uba74 \uc774\uba54\uc77c\ub85c \uc54c\ub9bc\uc744 \ubcf4\ub0c5\ub2c8\ub2e4. 1. \uc2a4\ud06c\ub9bd\ud2b8 \ub0b4\uc6a9 (notify_ip_change.sh) bash #!\/bin\/bash # \uc124\uc815 LOG_FILE=&#8221;\/var\/log\/ip_change.log&#8221; IP_FILE=&#8221;\/tmp\/current_ip.txt&#8221; CHECK_INTERVAL=300 # \uccb4\ud06c \uac04\uaca9 (\ucd08 \ub2e8\uc704) SMTP_SERVER=&#8221;smtp.example.com&#8221; # SMTP \uc11c\ubc84 \uc8fc\uc18c SMTP_PORT=587 # SMTP \ud3ec\ud2b8 EMAIL_FROM=&#8221;your_email@example.com&#8221; # \ubc1c\uc2e0 \uc774\uba54\uc77c EMAIL_TO=&#8221;target_email@example.com&#8221; # \uc218\uc2e0 \uc774\uba54\uc77c EMAIL_USER=&#8221;your_email@example.com&#8221; # \uc774\uba54\uc77c &hellip; <a href=\"https:\/\/www.soon7shop.kr\/wordpress\/?p=34\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;\uc8fc\uae30\uc801\uc73c\ub85c \ud604\uc7ac IP \uc8fc\uc18c\ub97c \ud655\uc778\ud558\uace0 \uc774\uc804 IP\uc640 \ube44\uad50\ud558\uc5ec \ubcc0\uacbd\uc774 \uac10\uc9c0&#8230;.&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-34","post","type-post","status-publish","format-standard","hentry","category-4"],"_links":{"self":[{"href":"https:\/\/www.soon7shop.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/34","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.soon7shop.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.soon7shop.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.soon7shop.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.soon7shop.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=34"}],"version-history":[{"count":1,"href":"https:\/\/www.soon7shop.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/34\/revisions"}],"predecessor-version":[{"id":35,"href":"https:\/\/www.soon7shop.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/34\/revisions\/35"}],"wp:attachment":[{"href":"https:\/\/www.soon7shop.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=34"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.soon7shop.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=34"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.soon7shop.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=34"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}