[출처 : http://windowsforum.kr/ ]
장치 및 프린터 검색이되지 않을 경우
아래 서비스를 시작해 주면 정상적으로 열리게 됩니다.
<#
This script will monitor your IP for change, and email you if/when it changes
The email send feature uses a valid Gmail account to send the emails, if you don't have one it's easy to get one.
#>
#Get your current public IP address. I use 1and1.com here as they are a large provider and reply to ping requests.
$a = ping -r 1 1and1.com | Select-String "Route: *." | Get-Unique | Out-String
#In order to check your IP against it's last value it's written to a file each time it is checked. If the file or folder do not exist they are created.
#confirm that the file c:\temp\ip.txt exists, if not create it
$path = Test-Path C:\temp\
If ($PATH -ne 'True'){mkdir c:\temp}
$path = Test-Path C:\temp\ip.txt
If ($PATH -ne 'True'){New-Item -ItemType file C:\temp\ip.txt}
$b = Get-Content "C:\temp\ip.txt" | Select-String "Route: *." | Out-String
#compare $a to $b
$c = $a.compareTo($b)
#If $a and $b are not the same, email new IP address
If ($c -ne '0') {
$data = $a
$a > C:\temp\ip.txt
#Email
$EmailFrom = "Yoursendingaccoutn@gmail.com"
$EmailTo = "recipient@domain.com"
$Subject = "IP Has Changed"
$Body = $data | Out-String
$SMTPServer = "smtp.gmail.com"
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
$SMTPClient.EnableSsl = $true
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("username", "password");
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)
EXIT
}
ELSE {
#If $a and $b are the same, exit
echo 'IP Address has not changed'
EXIT
}
curl ifconfig.me | mailx -s "my IP" login@gmail.com
이외의 사이트 :icanhazip.com
#!/bin/sh
# PlusGenie Ltd
#set -x
DB_FILE=mac_dbfile.txt
DOOR=24810
# port example, 135:139 for range
function filter_one {
iptables $1 INPUT $2 --protocol tcp --destination-port $DOOR -m mac --mac-source $3 -j ACCEPT > /dev/null 2>&1
iptables $1 INPUT $2 --protocol tcp --source-port $DOOR -m mac --mac-source $3 -j ACCEPT > /dev/null 2>&1
iptables $1 INPUT $2 --protocol udp --destination-port $DOOR -m mac --mac-source $3 -j ACCEPT > /dev/null 2>&1
iptables $1 INPUT $2 --protocol udp --source-port $DOOR -m mac --mac-source $3 -j ACCEPT > /dev/null 2>&1
}
#deny all other traffic
function filter_other {
iptables $1 INPUT --protocol tcp --destination-port $DOOR -j DROP
iptables $1 INPUT --protocol tcp --source-port $DOOR -j DROP
iptables $1 INPUT --protocol udp --destination-port $DOOR -j DROP
iptables $1 INPUT --protocol udp --source-port $DOOR -j DROP
}
if [ ! -e $DB_FILE ]; then
echo "There is no config file"
exit 1
fi
function setup_first_rule {
echo "\n=====SETUP INIT RULES==========================="
echo "Allow established sessions to receive traffic"
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
# We need to insert this rule before that. Since this is a lot of traffic
# we'll insert it as the first rule so it's processed first.
echo "\n================================================"
iptables -I INPUT 2 -i lo -j ACCEPT
echo "\n================================================"
echo "allow incoming traffic on the default SSH port (22)"
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
echo "\n================================================"
# echo "let's allow all incoming web traffic "
# iptables -A INPUT -p tcp --dport 80 -j ACCEPT
}
#Just check whether we already set the rules or not
SETUP_DONE=0
for MAC in `cat $DB_FILE`; do
if iptables -L | grep -q $MAC; then
echo "checking configs"
# Already add drop rules before
SETUP_DONE=1
fi
done
# let's set up the first rule
if [ $SETUP_DONE -eq 0 ]; then
setup_first_rule
fi
for MAC in `cat $DB_FILE`; do
if iptables -L | grep -q $MAC; then
echo "already found in rules"
else
echo "\n================================================"
echo "Inserting new rules"
filter_one -I 4 $MAC
fi
done
if [ $SETUP_DONE -eq 0 ]; then
filter_other -A
fi
#Showing what we done:
#iptables -L -v