📄 secpod_office_products_version_900032.nasl
字号:
################################################################################ MS Office Products Version Detection## Copyright: SecPod## Date Written: 2008/08/13## Revision: 1.1 ## Log: Detect script for word, excel and access.# Issue #0021# ------------------------------------------------------------------------# This program was written by SecPod and is licensed under the GNU GPL # license. Please refer to the below link for details,# http://www.gnu.org/licenses/gpl.html# This header contains information regarding licensing terms under the GPL, # and information regarding obtaining source code from the Author. # Consequently, pursuant to section 3(c) of the GPL, you must accompany the # information found in this header with any distribution you make of this # Program.# ------------------------------------------------------------------------##############################################################################if(description){ script_id(900032); script_version("$Revision: 1.0 $"); script_category(ACT_GATHER_INFO); script_family(english:"Windows"); script_name(english:"MS Office Products Version Detection"); script_summary(english:"Determines the version of WinWord, Excel, and Access"); desc["english"] = " Overview : Retrieve the version of MS Office products from file and sets KB. Risk factor : Informational"; script_description(english:desc["english"]); script_dependencies("secpod_reg_enum.nasl", "secpod_ms_office_detection_900025.nasl"); script_require_keys("SMB/WindowsVersion"); exit(0);} include("smb_nt.inc"); include("secpod_smb_func.inc"); if(!get_kb_item("SMB/WindowsVersion")){ exit(0); } function Get_FileVersion(file, share, offset) { name = kb_smb_name(); login = kb_smb_login(); pass = kb_smb_password(); domain = kb_smb_domain(); port = kb_smb_transport(); soc = open_sock_tcp(port); if(!soc){ exit(0); } r = smb_session_request(soc:soc, remote:name); if(!r) { close(soc); exit(0); } prot = smb_neg_prot(soc:soc); if(!prot) { close(soc); exit(0); } r = smb_session_setup(soc:soc, login:login, password:pass, domain:domain, prot:prot); if(!r) { close(soc); exit(0); } uid = session_extract_uid(reply:r); r = smb_tconx(soc:soc, name:name, uid:uid, share:share); tid = tconx_extract_tid(reply:r); if(!tid) { close(soc); exit(0); } fid = OpenAndX(socket:soc, uid:uid, tid:tid, file:file); if(!fid) { close(soc); exit(0); } v = GetVersion(socket:soc, uid:uid, tid:tid, fid:fid, verstr:"prod", offset:offset); return(v); } if(!get_kb_item("MS/Office/Ver")){ exit(0); } wordFile = registry_get_sz(key:"SOFTWARE\Microsoft\Windows\CurrentVersion" + "\App Paths\Winword.exe", item:"Path"); if(wordFile) { wordFile += "\winword.exe"; share = ereg_replace(pattern:"([A-Z]):.*", replace:"\1$", string:wordFile); word = ereg_replace(pattern:"[A-Z]:(.*)", replace:"\1", string:wordFile); wordVer = Get_FileVersion(file:word, share:share, offset:1500000); if(wordVer){ set_kb_item(name:"SMB/Office/Word/Version", value:wordVer); } } excelFile = registry_get_sz(key:"SOFTWARE\Microsoft\Windows\CurrentVersion" + "\App Paths\Excel.exe", item:"Path"); if(excelFile) { excelFile += "\excel.exe"; share = ereg_replace(pattern:"([A-Z]):.*", replace:"\1$", string:excelFile); excel = ereg_replace(pattern:"[A-Z]:(.*)", replace:"\1", string:excelFile); excelVer = Get_FileVersion(file:excel, share:share, offset:1500000); if(excelVer){ set_kb_item(name:"SMB/Office/Excel/Version", value:excelVer); } } accessFile = registry_get_sz(key:"SOFTWARE\Microsoft\Windows\CurrentVersion" + "\App Paths\MSACCESS.exe", item:"Path"); if(accessFile) { accessFile += "\msaccess.exe"; share = ereg_replace(pattern:"([A-Z]):.*", replace:"\1$", string:accessFile); access = ereg_replace(pattern:"[A-Z]:(.*)", replace:"\1", string:accessFile); accessVer = Get_FileVersion(file:access, share:share, offset:1500000); if(accessVer){ set_kb_item(name:"SMB/Office/Access/Version", value:accessVer); }} powerpointFile = registry_get_sz(key:"SOFTWARE\Microsoft\Windows\CurrentVersion" + "\App Paths\PowerPnt.exe", item:"Path"); if(powerpointFile) { powerpointFile+= "\powerpnt.exe"; share = ereg_replace(pattern:"([A-Z]):.*", replace:"\1$", string:powerpointFile); power = ereg_replace(pattern:"[A-Z]:(.*)", replace:"\1", string:powerpointFile); powerPptVer = Get_FileVersion(file:power, share:share, offset:1500000); if(powerPptVer){ set_kb_item(name:"SMB/Office/PowerPnt/Version", value:powerPptVer); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -