Outlook Express 在Windows中的相關資料

Outlook Express 參數的放置位置
HKEY_CURRENT_USER\Identities\
帳號相關設定值
HKEY_CURRENT_USER\Software\Microsoft\Internet Account Manager
郵件實體存放位置
C:\Documents and Settings\{UserName}\Local Settings\Application Data\Identities\{GID}\Microsoft\Outlook Express\
GID的號碼位置為
[HKEY_CURRENT_USER\Identities]
"Default User ID"="{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}"
通訊錄存放的位置為
C:\Documents and Settings\{UserName}\Application Data\Microsoft\Address Book\
郵件規則存放的位置為
HKEY_CURRENT_USER\Identities\{GID}\Software\Microsoft\Outlook Express\5.0\Rules\Mail
影響郵件規則的檔案為
Folder.dbx

MS Outlook 匯入帳號

PRF的產生
用Office 的 Resource Kit Tools 產生
匯入PRF
"C:\Program Files\Microsoft Office\OFFICE10\outlook.exe" /importprf \\share\outlook.prf
用 AutoIT 修改 PRF
===================================================== IniWrite("Default.PRF", "Account1", "AccountName", "Displayname")
IniWrite("Default.PRF", "Account1", "POP3Server", "Server FQDN")
IniWrite("Default.PRF", "Account1", "SMTPServer", "Server FQDN")
IniWrite("Default.PRF", "Account1", "POP3UserName", "login name")
IniWrite("Default.PRF", "Account1", "EmailAddress", "email")
IniWrite("Default.PRF", "Account1", "DisplayName", "Displayname")

PRF 長的樣子大約如下
============================================================ ;Automatically generated PRF file from the Microsoft Office Customization and Installation Wizard


; **************************************************************
; Section 1 - Profile Defaults
; **************************************************************

[General]
Custom=1
DefaultProfile=Yes
OverwriteProfile=Append
ModifyDefaultProfileIfPresent=TRUE
BackupProfile=No

; **************************************************************
; Section 2 - Services in Profile
; **************************************************************

[Service List]
;ServiceX=Microsoft Outlook Client

;***************************************************************
; Section 3 - List of internet accounts
;***************************************************************

[Internet Account List]
Account1=I_Mail

;***************************************************************
; Section 4 - Default values for each service.
;***************************************************************

;[ServiceX]
;FormDirectoryPage=
;-- The URL of Exchange Web Services Form Directory page used to create Web forms.
;WebServicesLocation=
;-- The URL of Exchange Web Services page used to display unknown forms.
;ComposeWithWebServices=
;-- Set to TRUE to use Exchange Web Services to compose forms.
;PromptWhenUsingWebServices=
;-- Set to TRUE to use Exchange Web Services to display unknown forms.
;OpenWithWebServices=
;-- Set to TRUE to prompt user before opening unknown forms when using Exchange Web Services.

;***************************************************************
; Section 5 - Values for each internet account.
;***************************************************************

[Account1]
UniqueService=No
AccountName=
POP3Server=
SMTPServer=
POP3UserName=
EmailAddress=
POP3UseSPA=0
DisplayName=
ReplyEMailAddress=
SMTPUseAuth=1
SMTPAuthMethod=0
ConnectionType=0
LeaveOnServer=0x0
ConnectionOID=MyConnection
POP3Port=110
POP3UseSSL=0
ServerTimeOut=60
SMTPPort=25
SMTPUseSSL=0

;***************************************************************
; Section 6 - Mapping for profile properties
;***************************************************************

[Microsoft Exchange Server]
ServiceName=MSEMS
MDBGUID=5494A1C0297F101BA58708002B2A2517
MailboxName=PT_STRING8,0x6607
HomeServer=PT_STRING8,0x6608
OfflineAddressBookPath=PT_STRING8,0x660E
OfflineFolderPath=PT_STRING8,0x6610

[Exchange Global Section]
SectionGUID=13dbb0c8aa05101a9bb000aa002fc45a
MailboxName=PT_STRING8,0x6607
HomeServer=PT_STRING8,0x6608

[Microsoft Mail]
ServiceName=MSFS
ServerPath=PT_STRING8,0x6600
Mailbox=PT_STRING8,0x6601
Password=PT_STRING8,0x67f0
RememberPassword=PT_BOOLEAN,0x6606
ConnectionType=PT_LONG,0x6603
UseSessionLog=PT_BOOLEAN,0x6604
SessionLogPath=PT_STRING8,0x6605
EnableUpload=PT_BOOLEAN,0x6620
EnableDownload=PT_BOOLEAN,0x6621
UploadMask=PT_LONG,0x6622
NetBiosNotification=PT_BOOLEAN,0x6623
NewMailPollInterval=PT_STRING8,0x6624
DisplayGalOnly=PT_BOOLEAN,0x6625
UseHeadersOnLAN=PT_BOOLEAN,0x6630
UseLocalAdressBookOnLAN=PT_BOOLEAN,0x6631
UseExternalToHelpDeliverOnLAN=PT_BOOLEAN,0x6632
UseHeadersOnRAS=PT_BOOLEAN,0x6640
UseLocalAdressBookOnRAS=PT_BOOLEAN,0x6641
UseExternalToHelpDeliverOnRAS=PT_BOOLEAN,0x6639
ConnectOnStartup=PT_BOOLEAN,0x6642
DisconnectAfterRetrieveHeaders=PT_BOOLEAN,0x6643
DisconnectAfterRetrieveMail=PT_BOOLEAN,0x6644
DisconnectOnExit=PT_BOOLEAN,0x6645
DefaultDialupConnectionName=PT_STRING8,0x6646
DialupRetryCount=PT_STRING8,0x6648
DialupRetryDelay=PT_STRING8,0x6649

[Personal Folders]
ServiceName=MSPST MS
Name=PT_STRING8,0x3001
PathToPersonalFolders=PT_STRING8,0x6700
RememberPassword=PT_BOOLEAN,0x6701
EncryptionType=PT_LONG,0x6702
Password=PT_STRING8,0x6703

[Outlook Address Book]
ServiceName=CONTAB

[LDAP Directory]
ServiceName=EMABLT
ServerName=PT_STRING8,0x6600
UserName=PT_STRING8,0x6602
UseSSL=PT_BOOLEAN,0x6613
DisplayName=PT_STRING8,0x3001
ConnectionPort=PT_STRING8,0x6601
SearchTimeout=PT_STRING8,0x6607
MaxEntriesReturned=PT_STRING8,0x6608
SearchBase=PT_STRING8,0x6603

[Microsoft Outlook Client]
SectionGUID=0a0d020000000000c000000000000046
FormDirectoryPage=PT_STRING8,0x0270
WebServicesLocation=PT_STRING8,0x0271
ComposeWithWebServices=PT_BOOLEAN,0x0272
PromptWhenUsingWebServices=PT_BOOLEAN,0x0273
OpenWithWebServices=PT_BOOLEAN,0x0274

[Personal Address Book]
ServiceName=MSPST AB
NameOfPAB=PT_STRING8,0x001e3001
Path=PT_STRING8,0x001e6600
ShowNamesBy=PT_LONG,0x00036601

; ************************************************************************
; Section 7 - Mapping for internet account properties. DO NOT MODIFY.
; ************************************************************************

[I_Mail]
AccountType=POP3
;--- POP3 Account Settings ---
AccountName=PT_UNICODE,0x0002
DisplayName=PT_UNICODE,0x000B
EmailAddress=PT_UNICODE,0x000C
;--- POP3 Account Settings ---
POP3Server=PT_UNICODE,0x0100
POP3UserName=PT_UNICODE,0x0101
POP3UseSPA=PT_LONG,0x0108
Organization=PT_UNICODE,0x0107
ReplyEmailAddress=PT_UNICODE,0x0103
POP3Port=PT_LONG,0x0104
POP3UseSSL=PT_LONG,0x0105
; --- SMTP Account Settings ---
SMTPServer=PT_UNICODE,0x0200
SMTPUseAuth=PT_LONG,0x0203
SMTPAuthMethod=PT_LONG,0x0208
SMTPUserName=PT_UNICODE,0x0204
SMTPUseSPA=PT_LONG,0x0207
ConnectionType=PT_LONG,0x000F
ConnectionOID=PT_UNICODE,0x0010
SMTPPort=PT_LONG,0x0201
SMTPUseSSL=PT_LONG,0x0202
ServerTimeOut=PT_LONG,0x0209
LeaveOnServer=PT_LONG,0x1000

[IMAP_I_Mail]
AccountType=IMAP
;--- IMAP Account Settings ---
AccountName=PT_UNICODE,0x0002
DisplayName=PT_UNICODE,0x000B
EmailAddress=PT_UNICODE,0x000C
;--- IMAP Account Settings ---
IMAPServer=PT_UNICODE,0x0100
IMAPUserName=PT_UNICODE,0x0101
IMAPUseSPA=PT_LONG,0x0108
Organization=PT_UNICODE,0x0107
ReplyEmailAddress=PT_UNICODE,0x0103
IMAPPort=PT_LONG,0x0104
IMAPUseSSL=PT_LONG,0x0105
; --- SMTP Account Settings ---
SMTPServer=PT_UNICODE,0x0200
SMTPUseAuth=PT_LONG,0x0203
SMTPAuthMethod=PT_LONG,0x0208
SMTPUserName=PT_UNICODE,0x0204
SMTPUseSPA=PT_LONG,0x0207
ConnectionType=PT_LONG,0x000F
ConnectionOID=PT_UNICODE,0x0010
SMTPPort=PT_LONG,0x0201
SMTPUseSSL=PT_LONG,0x0202
ServerTimeOut=PT_LONG,0x0209
CheckNewImap=PT_LONG,0x1100
RootFolder=PT_UNICODE,0x1101

[INET_HTTP]
AccountType=HOTMAIL
Account=PT_UNICODE,0x0002
HttpServer=PT_UNICODE,0x0100
UserName=PT_UNICODE,0x0101
Organization=PT_UNICODE,0x0107
UseSPA=PT_LONG,0x0108
TimeOut=PT_LONG,0x0209
Reply=PT_UNICODE,0x0103
EmailAddress=PT_UNICODE,0x000C
FullName=PT_UNICODE,0x000B
Connection Type=PT_LONG,0x000F
ConnectOID=PT_UNICODE,0x0010

安裝 Postgrey (Postfix Greylisting Policy Server)

起因
想要把一些廣告信的來源進行阻擋由不想誤檔正常的信件。

原理
Postgrey 的運作原理是讓 SMTP Server 在收到郵件後先回應 450 給來源 SMTP Server,若來源伺服器是正常的 SMTP Server 會在一段時間後自動重試,如果對方是使用發送垃圾郵件的工具不會將信件重送,如此可以達到有效阻擋垃圾郵件的目的。

安裝套件
postgrey-1.33-1.el4.rf.noarch.rpm
perl-BerkeleyDB-0.43-1.el4.rf.i386.rpm
perl-IO-Multiplex-1.10-1.el4.rf.noarch.rpm
perl-Net-Server-0.99-1.el4.rf.noarch.rpm
參考下載位置 http://pkgs.org/

設定
/etc/postfix/main.cf

smtpd_restriction_classes = greylisting
greylisting = check_policy_service unix:postgrey/socket
smtpd_recipient_restrictions =
...
check_client_access pcre:/etc/postfix/greylist
...

/etc/postfix/greylist

/(\-.+){4}$/ greylisting
/(\..+){4}$/ greylisting
# everything with 4 or more dots/hyphens in the hostname
/(^|[0-9.x_-])(abo|br(e|oa)dband|cabel|(hk)?cablep?|catv|cbl|cidr|d?client2?|cust(omer)?s?|dhcp|dial?(in|up)?|d[iu]p|[asx]?dsld?|dyn(a(dsl|mic)?)?|home|in-addr|modem(cable)?|(di)?pool|ppp|ptr|rev|static|user|YahooBB[0-9]{12}|c[[:alnum:]]{6,}(\.[a-z]{3})?\.virtua|[1-9]Cust[0-9]+|AC[A-Z][0-9A-F]{5}\.ipt|pcp[0-9]{6,}pcs|S0106[[:alnum:]]{12,}\.[a-z]{2})[0-9.x_-]/ greylisting
/^unknown$/ greylisting

/etc/sysconfig/postgrey (參數問男人)

OPTIONS="--unix=/var/spool/postfix/postgrey/socket \
--delay=120 \
--greylist-text=\"Policy Rejection- Please try later.\"
--auto-whitelist-clients=0"

清單
/etc/postfix/postgrey_whitelist_clients (預設白名單)
/etc/postfix/postgrey_whitelist_recipients (預設可不阻擋之收件人)
/etc/postfix/postgrey_whitelist_clients.local (自訂白名單)
# 1111.com.tw
202.153.190.210
# 104.com.tw
202.8.15.60
202.8.15.61
202.8.15.62
202.8.15.63
202.8.15.64
202.8.15.65
202.8.15.66
202.8.15.67
202.8.15.68
202.8.15.69
202.8.15.71
202.8.15.72
202.8.15.73
202.8.15.74
202.8.15.75
202.8.15.76
202.8.15.77
202.8.15.78
202.8.15.79

開機啟動
chkconfig --add postgrey

啟動
/etc/rc.d/init.d/postgrey start

檢查
cat /var/log/mail/maillog



參考資料
http://wiki.centos.org/HowTos/postgrey#head-314ceecc5ece27e0f0a4bf1abcd8ee9356cd1a5e
http://www.arschkrebs.de/postfix/postfix_greylisting.shtml
http://rimuhosting.com/knowledgebase/linux/mail/greylisting%20with%20postgrey
http://ssorc.tw/rewrite.php/read-573.html
http://www.postfix.org/SMTPD_POLICY_README.html

用Fail2ban阻擋特定來源位址

起因
由於 POP3 的 services 常常被猜密碼覺得煩麻煩的,所以想要把這些猜密碼的位址阻擋。

安裝套件
fail2ban-0.8.4-23.el4.noarch.rpm (http://www.fail2ban.org/wiki/index.php/Downloads)
gamin-0.1.7-1.4.EL4.i386.rpm (CentOS 4.6 CD#1)
gamin-python-0.1.7-1.4.EL4.i386.rpm (CentOS 4.6 CD#3)
shorewall-4.4.18-1.noarch.rpm (http://www.shorewall.net/)

設定
/etc/fail2ban/jail.conf
[dovecot-check]
enabled = true
filter = dovecot-check
action = iptables-multiport[name=dovecot-check, port="pop3,pop3s,imap,imaps", protocol=tcp]
logpath = /var/log/mail/dovecot
ignoreip = 168.192.0.1 192.168.1.0/24
bantime  = 1800
findtime  = 300
maxretry = 3
/etc/fail2ban/fail2ban.conf
logtarget = /var/log/fail2ban.log
/etc/fail2ban/filter.d/dovecot-check.conf
[Definition]
failregex = (?: pop3-login|imap-login): .*(?:Authentication failure|Aborted login \(auth failed|Aborted login \(tried to use disabled|Disconnected \(auth failed).*rip=(?P<host>\S*),.*
ignoreregex =
啟動
/etc/rc.d/init.d/fail2ban start
檢查
1./etc/rc.d/init.d/fail2ban status
2.cat  /var/log/fail2ban.log
3.iptables -L


參考資料
http://wiki.dovecot.org/HowTo/Fail2Ban
http://cha.homeip.net/blog/archives/2007/06/_fail2ban_ip.html
http://www.mamu.com.tw/blog/2008/06/12/fail2ban-install/

重新產生 SEP 使用的 ID

#NoTrayIcon
$program_stop = "C:\Program Files\Symantec\Symantec Endpoint Protection\Smc.exe -stop"
$program_start = "C:\Program Files\Symantec\Symantec Endpoint Protection\Smc.exe -start"
$del_file = "C:\Program Files\Common Files\Symantec Shared\HWID\sephwid.xml"
$pass = "123456"
run($program_stop, "", @SW_HIDE)
WinWaitActive("密碼")
ControlSend("密碼", "", "Edit1", $pass)
ControlClick("密碼", "", "[CLASS:Button; INSTANCE:1]")
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Symantec\Symantec Endpoint Protection\SMC\SYLINK\SyLink", "HardwareID", "REG_SZ", "")
FileDelete($del_file)
ProcessWaitClose("Smc.exe")
run($program_start)

用 WSH 新增MS Outlook 資料夾

Set objOutlook = CreateObject("Outlook.Application")
Set myNameSpace = objOutlook.GetNamespace("MAPI")
Set myInboxFolder = myNameSpace.GetDefaultFolder(6)
Set myNewFolder = myInboxFolder.Folders.Add("資料夾一")
Set myNewFolder = myInboxFolder.Folders.Add("資料夾二")
Set myNewFolder = myInboxFolder.Folders.Add("資料夾三")

Windows 自動登入免密碼

方法一:
1.執行 netplwiz
2. 在使用者帳戶的視窗中,取消 「必須輸入使用者名稱和密碼,才能使用這台電腦」,套用後選擇要自動登入的帳戶,並輸入選擇帳戶的密碼。
方法二:
1.Windows+R   > 開起執行
2.執行 rundll32 netplwiz.dll,UsersRunDll
3.在使用者帳戶的視窗中,取消 「必須輸入使用者名稱和密碼,才能使用這台電腦」,套用後選擇要自動登入的帳戶,並輸入選擇帳戶的密碼。

AutoIT 檢查網路連線狀態

基本檢查:
Global Const $NETWORK_ALIVE_LAN = 0x1
Global Const $NETWORK_ALIVE_WAN = 0x2
$x =DLLCall("sensapi.dll","int","IsNetworkAlive","str",$NETWORK_ALIVE_LAN)
msgbox (4096,"測試",$x[0])

應用:
While 1 $connect = _GetNetworkConnect()
If $connect Then
    MsgBox(64, "Connections", $connect)
Else
    MsgBox(48, "Warning", "There is no connection")
EndIf
sleep(5000)
Wend
Func _GetNetworkConnect()
    Local Const $NETWORK_ALIVE_LAN = 0x1  ;net card connection
    Local Const $NETWORK_ALIVE_WAN = 0x2  ;RAS (internet) connection
    Local Const $NETWORK_ALIVE_AOL = 0x4  ;AOL
   
    Local $aRet, $iResult
   
    $aRet = DllCall("sensapi.dll", "int", "IsNetworkAlive", "int*", 0)
   
    If BitAND($aRet[1], $NETWORK_ALIVE_LAN) Then $iResult &= "LAN connected" & @LF
    If BitAND($aRet[1], $NETWORK_ALIVE_WAN) Then $iResult &= "WAN connected" & @LF
    If BitAND($aRet[1], $NETWORK_ALIVE_AOL) Then $iResult &= "AOL connected" & @LF
   
    Return $iResult
EndFunc

 應用2:

While 1
$connect = _GetNetworkConnect()
If $connect Then
    MsgBox(64, "Connections", $connect)
Else
    MsgBox(48, "Warning", "There is no connection")
EndIf
sleep(5000)
Wend
Func _GetNetworkConnect()
    Local Const $NETWORK_ALIVE_LAN = 0x1  ;net card connection
    Local Const $NETWORK_ALIVE_WAN = 0x2  ;RAS (internet) connection
    Local Const $NETWORK_ALIVE_AOL = 0x4  ;AOL
   
    Local $aRet, $iResult
   
    $aRet = DllCall("sensapi.dll", "int", "IsNetworkAlive", "int*", 0)
   
    If BitAND($aRet[1], $NETWORK_ALIVE_LAN) Then $iResult &= "LAN connected" & @LF
    If BitAND($aRet[1], $NETWORK_ALIVE_WAN) Then $iResult &= "WAN connected" & @LF
    If BitAND($aRet[1], $NETWORK_ALIVE_AOL) Then $iResult &= "AOL connected" & @LF
   
    Return $iResult
EndFunc

AutoIT UDF(excel.au3)修正

原本的值
Global Const $xlCSVMSDOS = 24
Global Const $xlTextWindows = 20
修改為
Global Const $xlCSVMSDOS = 6
Global Const $xlTextWindows = -4158
修正使用 excel.au3 存檔成 csv 及 txt 檔案格式的問題

AutoIT 內建系統變數

@UserProfileDir
說明: Path to current user's Profile folder.
WinXP: C:\Documents and Settings\UserName
@MyDocumentsDir
說明: path to My Documents target
WinXP: 我的文件實際指向的位置
@ProgramFilesDir
說明: path to Program Files folder
WinXP: C:\Program Files
@TempDir
說明: Path to the temporary files folder.
WinXP: C:\Documents and Settings\UserName\Local Settings\Temp
@UserName
說明: ID of the currently logged on user.
WinXP: 登入系統的使用者名稱