codeblock

2016年8月17日 星期三

Some learning notes in Fugle

* 快速簡單做網頁: express
* 自己架git: gitlab
* 簡單強大的資料庫: : mongoose
* windows 連 mongodb 小工具: robomongo
* 使用 JQuery : cheerio
* 好用的Promise(流程控制): bluebird
* Array好用的方法: map, foreach
* 好用的 linux service 管理器: pm2
* linux 啟動程式以後 seesion斷掉還能繼續運作: nohup
* 網頁微美化: bootstrap
* 網頁hide/show效果: toggle
* 網頁表格sorting: tablesort
* 網頁送POST : Ajax
* response render: ejs
* node module 管理器: npm
* nodejs 時間日期相關: moment

2016年6月16日 星期四

2016年6月1日 星期三

Add flow entries to OVS

- There are sample codes in Ryu teaching us how to install a flow entries into an ovs. However, the samples are very simple that they only show the matching rules limiting input port and destination MAC address.

2016年5月9日 星期一

2016年5月6日 星期五

Ryu Controller - Traffic Monitor (Cont.)

- Try to block a flow if the traffic of that flow is abnormally large!
- A traffic monitor request switches info for every 5 seconds

2016年5月3日 星期二

Ryu Controller - Traffic Monitor

- Traffic monitor provides a periodically triggered inspector to obtain the flow/port status of each switches.
- A simple sample code is available here: https://github.com/osrg/ryu-book/blob/master/en/source/sources/simple_monitor.py 
- Note that it should be executed in Openflow 1.3

2016年4月19日 星期二

Ryu controller - deal with openflow packets notes

- Controller receives a  packet from a switch if the switch failed to look up it's flow table
- Get incoming packet message, src mac/ip, dst mac/ip, ofproto, ... whatever you want
- Learn a switch-port-mac_address entry

Packets received in Ryu controller

- Use ryu as remote controller to listen packet_in event which is usually triggered when a open virtual switch failed to look up an legal entry in the flow table.
- Here are some packet examples sending from ovs:

Disable ipv6

- When starting mininet with arbitrary topology by using ryu as a remote controller, there are plenty of packets sends from each hosts to a set of strange mac addresses start with 33:33:XX:XX...
- I didn't send these pkts (they started sending immediately after mininet network was set up), and I didn't want they show up. These irritating messages kept refreshing the controller console and led to debug trouble.

2016年4月14日 星期四

Ryu -- Mininet Sample: k=4 Fat Tree

- Start Ryu manager (optional:with GUI needed files)
ryu-manager --verbose --observe-links ryu.app.simple_switch ryu.app.rest_topology  ryu.app.ofctl_rest ryu.topology.switches

2016年4月13日 星期三

2016年4月11日 星期一

Mininet OpenFlow Tutorial - Learn Development Tools

https://github.com/mininet/openflow-tutorial/wiki

- Start with a topology with 3 hosts and 1 switch (and 1 controller)
  • "sudo mn --topo single,3 --mac --switch ovsk --controller remote"
  • --switch ovsk: Open vSwitch 
  • --mac: set the MAC address to hosts' IP address

2016年4月7日 星期四

Ubuntu: Network Interface named "eno16777736"

Source: http://blog.csdn.net/a549569635/article/details/49968189

Try to modify it as "eth0"

Mininet Walkthrough

See also: http://mininet.org/walkthrough/

- Start wireshark:
  • "sudo wireshark &", an error message showed up: "Lua: Error during loading: dofile has been disabled due to running wireshark as superuser..."
  • Seems everybody tried to stop me to run run wireshark as root.

2016年4月6日 星期三

Mininet Installation

See also: http://mininet.org/download/

- There are four methods to install Mininet.
  Option 1: Mininet VM Installation (easy, recommended)
  Option 2: Native Installation from Source
  Option 3: Installation from Packages
  Option 4. Upgrading an existing Mininet Installation
- I already have a new-installed Ubuntu virtual machine, so I choose option 2. ( ubuntu version Ubuntu 15.10)

Simulator VS Emulator

According to Wikipedia, "'emulation' referred only to emulation with a hardware or microcode assist, while 'simulation' referred to pure software emulation."

2016年4月4日 星期一

Python Challenge level 19

http://www.pythonchallenge.com/pc/hex/bin.html (login:butter/fly)

- A map of India. An email with an attachment (wav file). Very straightforward, we should convert the mess in the attachment into a voice file.

2016年4月1日 星期五

Python Challenge level 18

http://www.pythonchallenge.com/pc/return/balloons.html (logib:huge/file)

- Two picture, one is brighter. "Can you tell the difference?" and a comment says it's more easy than I think.
- Just visit http://www.pythonchallenge.com/pc/return/brightness.html and you will see the same page.....wait! The comment changes..."maybe consider deltas.gz"!

Python Challenge level 17

http://www.pythonchallenge.com/pc/return/romance.html (login:huge/file)

- A plenty of cookies. There is also a small picture on the lower left corner, remember it? It's the same photo as level 4. (I don't remember. Really.)
- Obviously, we should find out the cookies sent by level 4 webpage.

Python Challenge level 16

http://www.pythonchallenge.com/pc/return/mozart.html (login: huge/file)

- Only a meaning less image. A title refers that "let me get this straight", so maybe I need to find something NOT straight ... this picture?
- Observe that there are many pink segments in this picture.

2016年3月31日 星期四

Python Challenge level 15

http://www.pythonchallenge.com/pc/return/uzi.html (login: huge/file)

- A calendar. January 26. Don't know which year it is. "he ain't the youngest, he is the second". "todo: buy flowers for tomorrow".
- I have to buy flowers on January 27 for a man who is the second and not the youngest one. What?

2016年3月30日 星期三

Python Challenge level 14


http://www.pythonchallenge.com/pc/return/italy.html (login: huge/file)

- "Walk around" is the title. A spiral bread. A 10000*1 picture named "wire.png" presented as a 100*100 one. An equation: 100*100 = (100+99+99+98) + (...
- What we should do is rearrange the pixels in wire.png in a spiral manner like that bread and make it a 100*100 picture!

Python Challenge level 13

http://www.pythonchallenge.com/pc/return/disproportional.html (logon:huge/file)

- "call him"... click number 5 on the phone, and then a xml error page shows up!
- Google the fault code (105) and knowing that it is a XMLRPC module error. According to http://stackoverflow.com/questions/7950297/faultcode-105-faultstring-xml-error-invalid-document-end-at-line-1-column-1, I should send some "xml request" to this page rather than just browsing the page.

Python Challenge level 12

http://www.pythonchallenge.com/pc/return/evil.html (login:huge/file)

- I downloaded evil1.jpg and checked this picture over and over again, but I still don't know how to deal with the EVIL here.
- After searching for some tips on Google, there is a person said, "The picture is evil1.jpg, so not surprisingly there will be evil2.jpg." Well, for me, at least, it has little sense.

Python Challenge level 11

http://www.pythonchallenge.com/pc/return/5808.html (login:huge/file)

- No much tips, just "odd even" in the title and a very vague picture. Seems like this picture is processed for a certain purpose.
- Divide the picture into 4 parts according to the pixel coordinate. (00, 01, 10, 11)

Python Challenge level 10

http://www.pythonchallenge.com/pc/return/bull.html (login:huge/file)

- Click the bull in the picture, you will see "a = [1, 11, 21, 1211, 111221, "
- This is so called "look and say sequence", please refer to https://en.wikipedia.org/wiki/Look-and-say_sequence

2016年3月29日 星期二

Python Challenge level 9

http://www.pythonchallenge.com/pc/return/good.html (login:huge/file)

- "connect the dots", remember me a little game i played when i was young...
- See also: http://pillow.readthedocs.org/en/3.1.x/reference/ImageDraw.html
- Draw a picture according to two lists: "first" and "second"

Python Challenge level 8

http://www.pythonchallenge.com/pc/def/integrity.html

- "Where is the missing link?" If you click the bee in the picture, you will be asked to input a pair of username and password.
- Find the 'un' and 'pw' data streams in the source page.

Python Challenge level 7

http://www.pythonchallenge.com/pc/def/channel.html

- To do this challenge, please make sure you have already installed PILLOW.
https://pypi.python.org/pypi/Pillow
- This is such a huge task. First of all, the code is hidden in the picture. See the grayscale bar across the picture?

Python Challenge level 6

http://www.pythonchallenge.com/pc/def/channel.html

- Visit the source page, and just see "zip" is useful
http://www.pythonchallenge.com/pc/def/channel.zip -> get a zip file
- Unzip the file, you will know that it is just like challenge level 4. According the readme.txt, you should start from 90052

2016年3月28日 星期一

Python Challenge level 5

http://www.pythonchallenge.com/pc/def/peak.html

- Pronounce "peak hell". What?? I pronounced it in my room, and nothing happened...
- Google "peak hell", it turns out to be "pickle."
- See also: https://docs.python.org/2/library/pickle.html
- The target that should be pickled is banner.p (showed in the source page)

Python Challenge level 4

http://www.pythonchallenge.com/pc/def/linkedlist.php

- click the picture, you will know that it will be an exhausted work
- knowing from source page, we should keep modifying the nothing value for at most 400 times

Python Challenge level 3

http://www.pythonchallenge.com/pc/def/equality.html

- See also: https://docs.python.org/2/library/re.html
- As the previous level, copy the mess message in the page source
- Try to find " 3 uppercase + 1 lowercase + 3 uppercase" pattern
  - For example, "AAAaAAA"
  - They emphasize "EXACTLY 3 bodyguards," so string like "AAAAaAAA" is not acceptable
- Finally, concat all lowercase letters

2016年3月25日 星期五

Python Challenge level 2


http://www.pythonchallenge.com/pc/def/ocr.html

- find the mess message in the page source (commend), copy the content and save it as a file
- "find rare characters in the mess below", so find the letter frequency of this message

2016年3月24日 星期四

Python Challenge level 1

http://www.pythonchallenge.com/pc/def/map.html

- observe the picture, there are all 2 lexicographical difference between each pairs of letters
- not sure what the tip means is
  1. k should be changed to m
  2. in the cipher text, k is changed to m

Python Challenge level 0

http://www.pythonchallenge.com/pc/def/0.html

- just calculate 2^38
g = lambda x, y:x**y
print g(2, 38)

2016年3月16日 星期三

Vocabulary

vulnerability 易受攻擊的
wreak havoc 造成破壞
forensic 法庭的, 辯論的, 鑑識
falsification 竄改;偽造;曲解
depletion 消耗;用盡
repudiation 否認
countermeasures 對策
ossification 僵化;鈣化
convolution 迴旋;盤繞
delegate 授權;委託
anomalous 不規則的;異常的
unprecedented 史無前例的
impasse 僵局
unorthodox 非正統的
susceptible 易受影響的
rudimentary 早期的;未成熟的
albeit 雖然
vantage points 有利的位置

2016年3月15日 星期二

Integer Linear Programing - Using Binary Vaviables

Some tips about ILP transformaion using binary variables.

- Logic
  - Conjunction, A and B, A∩B => a+b = 2
  - Disjunction, A or B, A∪B => a+b ≥ 1
  - if A then B, A→B, ~A∪B => a ≤ b
  - A if only if B, A↔B => a = b
  - A = ~B => a+b = 1
  - C = A∩B => c ≤ a, c ≤ b, c ≥ a+b-1
  - C = A∪B => c ≥ a, c ≥ b, c ≤ a+b

Integer Linear Programming - Duality

Main Resource: Applied Mathematical Programming by Bradley, Hax, and Magnanti (Addison-Wesley, 1977), provided by MIT

A canonical form of duality of an Integer Linear Programming problem:




2016年3月9日 星期三

IP address, Subnet, Netmask

- Classes of IP address:

- There are also class D and E, and the leading bits are 1110 and 1111 respectively.
- IP address is divided into two parts, net id and host id.
- Hosts with the same net id are within the same subnet.

2016年3月8日 星期二

L2/L3 Switching

See https://en.wikipedia.org/wiki/LAN_switching

L2 switching - see MAC address only
L3 switching - see IP address

Comparison between L2/L3 switching, see also:
 - Cisco Meraki documentation
 - IThome
 - http://www.networkpcworld.com/differences-between-layer-2-3-4-switching-multilayer-switching-layer-3-routing/


Virtual Machine setup


Got a new homework as below:

1. 從官方網站下載"Oracle VM VirtualBox" 或 "VMware Workstation Player"
2. 從官方網站下載linux作業系統,可選 ubuntu、centos 或其他你熟悉的
3. 新增一個虛擬機器,至少要有兩張虛擬網卡,第一張使用nat功能,第二張指定成內部網路。接著設定一台虛擬光碟機,並將光碟檔案指定為在第二步下載的光碟映像檔。