2016年2月9日 星期二

用script 執行ns2 & 載入 lib

好難下標題&解說.....

就當作是給自己看的!? XDDD

好處就是可以在電腦上安裝多個不同版本的ns2


#!/bin/bash
export PATH=/bin:/sbin:/usr/bin:/usr/sbin

NS2_FOLDER=/ns2/ns-allinone-2.34.ubuntu

export PATH=$PATH:$NS2_FOLDER/bin:$NS2_FOLDER/tcl8.4.18/unix:$NS2_FOLDER/tk8.4.18/unix

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$NS2_FOLDER/otcl-1.13:$NS2_FOLDER/lib

export TCL_LIBRARY=$TCL_LIBRARY:$NS2_FOLDER/tcl8.4.18/library

/ns2/ns-allinone-2.34.ubuntu/ns-2.34/ns $@



2016年2月8日 星期一

ns2 的 GOD

好像該開始學ns3了... (離題 XD)


在tcl裡, 會有這個參數
set god_ [create-god $val(nn)]

這邊的god全名是 General Operations Director

這個網頁有GOD的介紹
http://www.mathcs.emory.edu/~cheung/Courses/558/Syllabus/18-WirelessSim/intro.html

以下是那個網頁提到的內容 (貼過來順便當備份)

"God (General Operations Director) is the object that is used to store global information about the state of the environment, network or nodes that an omniscent observer would have, but that should not be made known to any participant in the simulation."
  • Currently, the God object stores:
    • the total number of mobilenodes
    • a table of shortest number of hops required to reach from one node to another.
  • The next hop information is normally loaded into god object from movement pattern files, before simulation begins.That is because calculating this on the fly during simulation runs can be quite time consuming.

2016年2月3日 星期三

ath9k_htc 的意思 XD

這個htc, 不是那個htc喔 XDDD

HTC - host target communications

Responsible for:
    Communication between host and target
    Registering services. For example WMI, RX, TX, Beacon...
    Routing messages to services
    credits system.


https://github.com/qca/open-ath9k-htc-firmware/wiki/HTC

2016年2月2日 星期二

用 curl 上傳資料到 ftp 裡面

本地端有一個 file5566.py
然後要上傳到 ftp 裡面的 /upload 裡面

語法:
curl -T file5566.py ftp://username:password@ftp.ip.address/upload/

2016年2月1日 星期一

用 command line 設定 wifi 密碼

最近都在用TTL控制PI, 不能使用圖形介面來設定wifi
 
後來發現其實也蠻簡單的(!?)
 
去修改 /etc/wpa_supplicant/wpa_supplicant.conf 這個檔案
然後再最後面加上這些  
 
network={
    ssid="your_AP_essid"
    psk="your_password"
}
 
修改完後, 再重新啟動網路
sudo /etc/init.d/networking restart

然後就連上了 XD
 
https://kerneldriver.wordpress.com/2012/10/21/configuring-wpa2-using-wpa_supplicant-on-the-raspberry-pi/ 

2016年1月27日 星期三

PI & TTL

最近一直使用 TTL 的方式來控制PI

可是前一陣子的時候發現, 螢幕上有看到畫面, 可是輸入指令完全沒有反應. 囧!!!!!

然後看到這邊
https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=79573

There's a similar-sounding problem here where it turns out the problem was actually a physically damaged RX pin on the Pi.

該不會真的GG吧, pin腳出問題.... QAQ

後來在這邊看到
https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=79512

The most likely is you haven't connected the Pi's RXD to the dongles TX pin, or you haven't connected the grounds.

然後再檢查一下pin腳.......
還真的有一個pin腳鬆脫了  ˊ______>ˋ

默默的把線接回去, 就恢復正常了 orz

看樣子以後遇到這種情形要先檢查線有沒有接好 XD

2016年1月21日 星期四

PI, Wifite

這種東西好像不太適合寫詳細說明(!?)

那就貼連結當備份好了 XD

http://m-jorgensen.dk/wifite-and-raspberry/
https://code.google.com/p/wifite/

wget https://raw.github.com/derv82/wifite/master/wifite.py
chmod +x wifite.py
./wifite.py

http://python-chan.appspot.com/2012/02/10/post_126001.phtml
apt-get install libssl-dev libpcap-dev make
wget http://www.willhackforsushi.com/code/cowpatty/4.6/cowpatty-4.6.tgz
tar zxvf cowpatty-4.6.tgz
cd cowpatty-4.6
make
cp cowpatty /usr/local/bin
cp genpmk /usr/local/bin
http://blog.petrilopia.net/linux/raspberry-pi-install-aircrackng-suite/
wget http://download.aircrack-ng.org/aircrack-ng-1.2-beta1.tar.gz
tar -zxvf aircrack-ng-1.2-beta1.tar.gz
cd aircrack-ng-1.2-beta1
make
make install
airodump-ng-oui-update

2015年11月10日 星期二

用pi安裝OM2M

http://wiki.eclipse.org/OM2M/Clone
  1.     裝java: apt-get install oracle-java7-jdk
  2.     裝Apache Maven (mvn): http://www.xianic.net/post/installing-maven-on-the-raspberry-pi/
  3.     用git抓source code下來安裝: http://wiki.eclipse.org/OM2M/Clone (command line的方式)
  4.     花了45min XD……
  5.     打開 127.0.0.1:8080, 可以看到畫面耶, 應該就可以了(!?)

用pi安裝DHT11 & 讀取資料

http://yehnan.blogspot.tw/2015/05/raspberry-pidht11.html

先安裝所需套件:
sudo apt-get update
sudo apt-get install build-essential python-dev git-core

下載程式,進入該目錄,然後安裝:
git clone https://github.com/adafruit/Adafruit_Python_DHT.git
cd Adafruit_Python_DHT
sudo python setup.py install

讀取DHT11的溫溼度資訊
cd examples
sudo ./AdafruitDHT.py 11 4


2015年4月13日 星期一

在ubuntu上安裝遠端桌面程式 x2go

原本freenx用得好好的, 後來好像系統更新(!?), 變成14.04

結果連過去之後整個都是黑畫面!!!  囧~~~~~~~~~~~ (我還沒跑完程式耶 QAQ)

找了幾篇文章, 試著修復 & 安裝新版的nx-server, 一樣沒辦法 (GG惹)

後來找到另一個遠端程式 x2go
一開始也是完全都是黑畫面, 後來才讓畫面正常顯示 (終於~~~)

不過問題好像是 gnome 的樣子!?!?

-----------------------------------------------------

這次的解決方法, 簡單說就是安裝 x2go (遠端程式) 和 mate (桌面程式)


MATE
http://wiki.mate-desktop.org/download#ubuntu_1404_lts_trusty_thar

[步驟]
sudo apt-add-repository ppa:ubuntu-mate-dev/ppa
sudo apt-add-repository ppa:ubuntu-mate-dev/trusty-mate
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install ubuntu-mate-core ubuntu-mate-desktop


X2Go
http://wiki.x2go.org/doku.php/wiki:repositories:ubuntu

[步驟]
sudo apt-get install python-software-properties
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:x2go/stable
sudo apt-get update
apt-cache search x2go


接著下載X2Go-client, 然後開啟程式, 設定IP, username


"工作階段類型" -> 選擇 MATE !!!!!!!!

然後遠端桌面就復活了wwwwwwwwwwwwwwwww
(可以明天再跑程式嗎 QQ)


補充:
後來發現, 如果在跑大量程式時, 有很高的機率會無法建立連線. 簡單說就是無法遠端.
至於解決方法... 不知道~ 囧~~~~~ 等程式跑完就可以遠端了 XD
或者是電腦一直開著遠端的畫面不要關掉, 這也算一種方法(!?) XDD