2017年4月26日 星期三

如何用ssh連線進入mininet中的主機

mininet安裝完後,在mininet\examples中有一個python範例檔sshd.py,此範例展示所建之主機可以由本機用ssh方式登入mininet內之虛擬機

執行sshd.py後進入mininet 命令列,不要退出。


另外用putty登入本機後,用ssh登入其中一台主機,其中參數 -l 後面設定登入使用的帳號(root)

登入後執行ifconfig,可以看到只列出h1的介面

所以可以依自季的需求來修改sshd.py做其他應用及設計

Chrome如何檢查網站憑證

網站網址如果使用https表示有使用SSL憑證加密,查看憑證的方式如下:

在網址列可以看到 綠色安全標籤,表示此網站是安全的



在網頁上按滑鼠右鍵,出現選單,選擇 [檢查]

然後點選 Security 頁籤
找到並點選 View Certificate 按鈕
就可以看到瀏覽網站的憑證內容了

ubuntu 14.04.5 Server install mininet

參考文件
https://yeasy.gitbooks.io/mininet_book/index.html

1.在VirtualBox安裝ubuntu 14.04.5 server x64,Package select openssh

2.讓root可以用putty login
vi /etc/ssh/sshd_config
修改
PermitRootLogin Yes
重新開機,讓root可以用putty login

3.OS更新
#apt-get update
#apt-get upgrade

4.安裝git
root@mininet:/etc/init.d# apt-get install git

5.安裝mininet
root@mininet:~# git clone git://github.com/mininet/mininet
root@mininet:~# mininet/util/install.sh -a
(會跑很久)

6.登入mininet

root@mininet:~# mn
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2
*** Adding switches:
s1
*** Adding links:
(h1, s1) (h2, s1)
*** Configuring hosts
h1 h2
*** Starting controller
c0
*** Starting 1 switches
s1 ...
*** Starting CLI:
mininet>

預設會建立2台主機h1、h2
1台交換器 s1
1台控制器 c1

7.查看節點數
mininet> nodes
available nodes are:
c0 h1 h2 s1

8.查看連結訊息
mininet> net
h1 h1-eth0:s1-eth1
h2 h2-eth0:s1-eth2
s1 lo:  s1-eth1:h1-eth0 s1-eth2:h2-eth0
c0

8.查看各節點訊息
mininet> dump



9.h1 ping h2
mininet> h1 ping -c 1 h2
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=1.96 ms

--- 10.0.0.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.969/1.969/1.969/0.000 ms

10.開啟h1終端機
mininet> xterm h1
Error: Cannot connect to display

出現錯誤,必須在GUI模式才能開啟

11.在h1建一個web Server,再從h2 get h1 資料

mininet> h1 python -m SimpleHTTPServer 80 &
mininet> h2 wget -O - h1

刪除web服務
mininet> h1 kill %python



12.cmd line自訂拓樸
http://sdnhub.org/resources/useful-mininet-setups/


1個控制器、1個交換器、3個主機

root@mininet:~# sudo mn --arp --topo single,3 --mac --switch ovsk --controller remote

In the above command, there are some important keywords worth paying attention to:
  • mac: Auto set MAC addresses
  • arp: Populate static ARP entries of each host in each other
  • switch: ovsk refers to kernel mode OVS
  • controller: remote controller can take IP address and port number as options

1個控制器、2個交換器、2個主機

root@mininet:~# sudo mn --topo linear --switch ovsk --controller remote
mininet> nodes
available nodes are:
c0 h1 h2 s1 s2

1個控制器、1個交換器、3個主機、1個Client

root@mininet:~# sudo mn --arp --topo single,4 --mac --switch ovsk --controller remote
mininet> nodes
available nodes are:
c0 h1 h2 h3 h4 s1

  • Virtual IP/MAC: Pick a virtual IP (VIP) and MAC for the load-balancer. This is the IP address to which the clients will make a HTTP request. The controller will push rules to rewrite the VIP with the selected HTTP server. To make this work, you need to static set an ARP entry for the VIP in the client. If ‘h1′ is the client and 10.0.0.5 is the VIP, the following command will add the static ARP entry:
    mininet> h1 arp -s 10.0.0.5 00:00:00:00:00:05
    
  • Server setup: The –arp keyword is very important to populate MAC addresses in each host. Besides that we need to run the following commands within mininet:
    mininet> h2 python -m CGIHTTPServer &
    mininet> h3 python -m CGIHTTPServer &
    mininet> h4 python -m CGIHTTPServer &
    
  • Warm-up controller learning: After the hosts are up, it is important to make the controller learn the location of each host. You can do this through a pingall command in mininet:
    mininet> pingall
    
  • Client request: In our custom VM, we have CGI script configured to report back which server is handling a particular client request. Thus, when a client performs the following command, you will receive the IP address of the handling server.
    mininet> h1 curl http://10.0.0.5:8000/cgi-bin/serverip.cgi

13.Python API 腳本自訂拓樸

在 mininet\custom目錄下有一個範例 topo-2sw-2host.py
文件中定义了一个 mytopo,则可以通过 --topo 选项来指定使用这一拓扑,命令为 
sudo mn --custom ~/mininet/custom/topo-2sw-2host.py --topo mytopo --test pingall

root@mininet:~# sudo mn --custom ~/mininet/custom/topo-2sw-2host.py --topo mytopo --test pingall
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2
*** Adding switches:
s3 s4
*** Adding links:
(h1, s3) (s3, s4) (s4, h2)
*** Configuring hosts
h1 h2
*** Starting controller
c0
*** Starting 2 switches
s3 s4 ...
*** Waiting for switches to connect
s3 s4
*** Ping: testing ping reachability
h1 -> h2
h2 -> h1
*** Results: 0% dropped (2/2 received)
*** Stopping 1 controllers
c0
*** Stopping 3 links
...
*** Stopping 2 switches
s3 s4
*** Stopping 2 hosts
h1 h2
*** Done

completed in 5.341 seconds


14.Mininet 範例程式介紹
http://yhhuanglab.blogspot.tw/2015/09/mininet.html










2017年4月23日 星期日

如何開啟 EXCEL 2007 的VBA編輯器

EXCEL每一個版本開啟VBA編輯器的方式都不一樣,EXCEL 2007的VBA編輯器預設是隱藏的,開啟方式如下:

選擇 Excel 選項

勾選 在功能區顯示 [開發人員] 索引標籤

然後功能選單就會出現 發人員頁籤,其中就含VBA相關工具。

點選 Virtual Basic 就會開啟VBA編輯器

也可以直接按 Alt + F11 直接開啟 VBA編輯器

2017年4月21日 星期五

Greenbone弱點掃描出現SCAP CERT database missing on OMP Server

安裝完Greenbone 4.0.5 登入web出現錯誤訊息

用google查詢,都說要執行 sudo openvas-certdata-sync
可是依照說明執行此指令,發現找不到此指令,後來發現以下圖片,說或是執行 sudo greenbone-certdata-sync


所以在主機上找到有 greenbone-certdata-sync 指令,趕快執行下去,看起來可正常執行,但最後出現了  sql::27: NOTICE:  schema "cert" does not exist 訊息。

我想可能是init時,會先做刪除動作,因為找不到才會出現此訊息,所以又在執行一次,這次就正常結束,沒出現錯誤訊息了。

可是網頁上的錯誤訊息仍然存在。還要再研究。

2017年4月20日 星期四

windows 的 echo service

今天使用Greenbone(openvas 9)對自己的個人電腦進行弱點掃描,發現有echo Service的弱點:

Google微軟說明,echo service是屬於微軟 Simple TCP/IP Services中˙一項,而 Simple TCP/IP Services 微軟建議除非有特殊需求,一般是不需要安裝的。

原先以為echo service是配合ping.exe等指令在做回應遠端icmp要求,可是停掉以後,本機還是可以正常互ping,都可以收到回應。

所以就直接將他關了,選擇程式集的開啟或關閉windows功能

將 簡單TCPIP服務取消勾選


網站如何防止中間人攻擊

中間人攻擊 MITM (Man-in-the-middle) attack
基本上就是駭客介入 client 與 server 的連線之中,所以連線中所有的資料都能聽到。

中間人攻擊(MITM)往往被用於竊聽資訊或串改資訊
ettercap可以實現區域網路中的MITM

因為網站的用戶都是客戶,客戶在Internet上,我們無從管理,所以只能加強我們自己網站的安全。
因為駭客會竊聽客戶電腦與網站連線的訊息,所以所有使用明碼傳送的訊息都可能被駭客知道,因此必須禁止使用http傳輸資料,而改用https,ftp、telnet等也都必須禁止使用,改用有加密的傳輸方式。

駭客不僅可以用中間人攻擊方式竊聽資料,還可以使用一些工具直接串改客戶電腦與網站間的傳輸資料,例如置換網頁圖片、內容等,以誤導客戶收到錯誤訊息或是自動轉至釣魚網站讓客戶在未察覺的情況下輸入帳號密碼而外洩資料,甚至強迫客戶電腦自動打開含有病毒或惡意程式的檔案,直接植入病毒及惡意程式。







2017年4月13日 星期四

Google推出開源專案網站

Google推出開源專案網站上線,包含18年來所有專案內容,可供開發者尋找資源。

PROJECT頁
專案檢視方式有兩種

1.漂移式選取,點選周邊飄移之小圈圈,會在中間大圈圈顯示專案名稱,點選VIEW PROJECT即可開啟專案內容

2.方塊導覽式選取,專案以方塊形式排列,選擇所要看的專案,點選VIEW PROJECT即可開啟專案內容


以下是每個專案的頁面




COMMUMITY頁,描述Google推廣開源產品以及參與開源社群組織



DOC頁

此部分說明Google如何公開關於Google開源的內部文件檔案,除了原始程式碼外,還包含每個開源專案的規劃、開發歷程、所需軟硬體環境、資源等,以及推廣使用和開源社群的互動等。


最後是BLOG頁
Google會將開源專案相關文章在此發佈

2017年4月7日 星期五

centos 6.8 install ntopng

1.在ESXi安裝CentOS6.8 x86_64 mininal Server虛擬機
2.停用iptables
[root@ntop-u ~]# service iptables stop
[root@ntop-u ~]# chkconfig iptables off

3.OS更新
[root@ntop-u ~]# yum update

4.安裝ntop

參考資料
http://packages.ntop.org/centos/
http://shaurong.blogspot.tw/2013/11/ntopng-11-yum-centos-64-x64.html

[root@ntop-u ~]# cd /etc/yum.repos.d/
[root@ntop-u yum.repos.d]# yum install wget
[root@ntop-u yum.repos.d]# wget http://packages.ntop.org/centos/ntop.repo -O ntop.repo
[root@ntop-u yum.repos.d]# wget https://copr.fedorainfracloud.org/coprs/saltstack/zeromq4/repo/epel-6/saltstack-zeromq4-epel-6.repo
[root@ntop-u yum.repos.d]# rpm -ivh http://packages.ntop.org/rpm6/extra/hiredis-0.10.1-3.el6.x86_64.rpm http://packages.ntop.org/rpm6/extra/hiredis-devel-0.10.1-3.el6.x86_64.rpm
[root@ntop-u yum.repos.d]# yum erase zeromq3
[root@ntop-u yum.repos.d]# yum clean all
[root@ntop-u yum.repos.d]# yum update
[root@ntop-u yum.repos.d]# yum install pfring n2disk nprobe ntopng ntopng-data cento

[root@ntop-u yum.repos.d]# chkconfig ntopng on
[root@ntop-u yum.repos.d]# chkconfig redis on

[root@ntop-u yum.repos.d]# chkconfig --list | grep ntopng
ntopng          0:關閉  1:關閉  2:開啟  3:開啟  4:開啟  5:開啟  6:關閉

[root@ntop-u yum.repos.d]# chkconfig --list | grep redis
redis           0:關閉  1:關閉  2:開啟  3:開啟  4:開啟  5:開啟  6:關閉


[root@ntop-u ntopng]# vi /etc/ntopng/ntopng.start

--local-networks "126.3.10.239"
--interface 1

[root@ntop-u ntopng]# vi /etc/ntopng/ntopng.conf
-G=/var/run/ntopng.pid

[root@ntop-u ntopng]# service redis start
[root@ntop-u ntopng]# service ntopng restart

用瀏覽器連上 port 3000
http://126.3.10.239:3000

username: admin 
password: admin 




2017年4月6日 星期四

資安-網頁置換受害資料庫 zone-h

http://www.zone-h.org/

網站 zone-h ,它提供了一個置換攻擊受害者的資料庫。這個資料庫除了有受害者的網址與被發現的時間,甚至還有事發當時的網頁快照。
這個資料庫也支援簡單的查詢功能 (ENABLE FILTERS),可以找出特定的時間或特定的網址。
若要查詢哪些網站有發生網頁被置換,點選Onhold頁籤


然後點選 [ENABLE FILTERS] 進行篩選

篩選結果,可以看到台灣有22191個網站被駭。

點選每筆被駭清單的mirror連結,可看到被駭後的網頁樣子

動畫及影像設計網站-DeviantArt

這個網站提供會員上傳及分享所設計的動畫及影像設計圖片
http://www.deviantart.com/



ubuntu 安裝完kubernetes後做apt-get update會出現錯誤

root@k8s02:~# sudo apt-get update 已有:1 http://tw.archive.ubuntu.com/ubuntu xenial InRelease 已有:2 http://tw.archive.ubuntu.com/ubuntu xenia...