2016年12月12日 星期一

issue for pip install cryptography

when issue in 

Command "/home/andy/P_ENV1/env/bin/python3 -u -c "import setuptools, 
tokenize;__file__='/tmp/pip-build-kicuvik8/cryptography/setup.py';
exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 
'exec'))" install --record /tmp/pip-vebd4vda-record/install-record.txt 
--single-version-externally-managed --compile --install-headers 
/home/andy/P_ENV1/env/include/site/python3.5/cryptography" failed with error code 1 in 
/tmp/pip-build-kicuvik8/cryptography/




actually 
I am really the things going 



 solution ======**********************===========

sudo apt-get install build-essential libssl-dev libffi-dev python-dev

python

pip install -r requirement.txt



the requirement.txt looks likes:
=========================
ip==8.1.2
bumpversion==0.5.3
wheel==0.29.0
watchdog==0.8.3
flake8==2.6.0
tox==2.3.1
coverage==4.1
Sphinx==1.4.8
cryptography==1.4
PyYAML==3.11
click
requests
backtrader
=============================

git

~/.gitconfig

紀錄 local user 的相關資料及資訊

例如說 email 
           name


這些值 透過   git -global user.name=  "Andy" user.email= aaa@gmail.com


來設定 


to be continued



2016年10月11日 星期二

cuckoo sandbox installation trubleshooting

2016-10-11 15:01:49,668 [lib.cuckoo.core.guest] INFO: cuckoo1: analysis completed successfully
2016-10-11 15:01:54,137 [modules.processing.memory] ERROR: Cannot run volatility module: volatility library not available







solution :
sudo apt-get install  volatility 

and go to cuckoo_installed\cuckoo\cuckoo.conf set the memory_dump = on



though I tried to install Evolve python package   "sudo pip install Evolve"
but error still exists


2016年10月10日 星期一

cuckoo sandbox issue

pip install -r requirements.txt

issue for  cffi installation

$ sudo apt-get install build-essential libssl-dev libffi-dev python-dev
 
 
 

2016年10月4日 星期二

ubuntu install virtualbox

要先安裝
sudo apt-get install dkms

sudo apt-get install   virtualbox-dkms

使可以使用

2016年9月25日 星期日

python rrdtool install

when issue about pango,cario and libxml2 and something else
I use the following lib to fixed

https://ubuntuforums.org/showthread.php?t=1112365

that is

Install these packages:

libcairo2-dev
libpango1.0-dev
libxml2-dev 




2016年9月16日 星期五

how to use git ssh to clone a repository (permission deny )

this message us useful

when using the ssh to clone a repository, it first need to establish the rsa key pair ,that is you need to generate a key public and add this key on the remote website,
as you can see in the following instruction  "rnu  cd ~/.ssh && ssh-keygen"

and add this key on website,
after  when git clone ssh  it can verify your identification, resolving the permission deny problem

another easy to solve is use https to git clone a repository



First start by setting up your own public/private key pair set. This can use either DSA or RSA, so basically any key you setup will work. On most systems you can use ssh-keygen.
  • First you'll want to cd into your .ssh directory. Open up the terminal and run:
    cd ~/.ssh && ssh-keygen
  • Next you need to copy this to your clipboard.
    • On OS X run: cat id_rsa.pub | pbcopy
    • On Linux run: cat id_rsa.pub | xclip
    • On Windows (via Cygwin/Git Bash) run: cat id_rsa.pub | clip
  • Add your key to your account via the website.
  • Finally setup your .gitconfig.
    • git config --global user.name "bob"
    • git config --global user.email bob@... (don't forget to restart your command line to make sure the config is reloaded)
Thats it you should be good to clone and checkout.





the above message copies from

http://stackoverflow.com/questions/2643502/git-permission-denied-publickey

2016年9月11日 星期日

2016年8月17日 星期三

about how to use the dd command to clone a harddisk

as the titile

this websites describes lots of things


https://wiki.archlinux.org/index.php/disk_cloning

2016年3月9日 星期三

linux bash shell export

export JJJ=1234

這就是我們要把 JJJ設定成為一個環境變數值為1234 的變數

我們發現 JJJ 要在append 新的值

可以這樣

export JJJ=$JJJ:ABCD

此時 我們的 JJJ 會變成 1234:ABCD

用 env | grep "JJJ" 可以查看一下



最後 因為 JJJ一看就是測試用的
要把它清除 可以 用 unset JJJ



Linux bash shell : set declare unset

這裡實例說明一下 set declare  unset 的功用

declare VAR=Test

設定一個變數 叫做 VAR 她的值 等於 Test
利用 set  | vim -
檢查一下目前全部的變數清單中 是否有 VAR

set -a VAR



透過 set 把 VAR 變數 定成環境變數

ene | grep "VAR"

可以利用 env 來檢查是否有設定到

如果我不想要這個變數了

unset VAR

則  env | grep "VAR" 和 set | grep "VAR"
都會被 VAR 給消除了




export 是開大絕
直接把變數丟到環境變數裡面


shell 打印訊息與錯誤訊息

./stdtest > std.log 2>&1 

以上會把  執行 stdtest 所產生的  訊息 和錯誤訊息 都印到 std.log 上面



2016年3月7日 星期一

Makefile strip

$(strip string)
Removes leading and trailing whitespace from string and replaces each internal sequence of one or more whitespace characters with a single space. Thus, ‘$(strip a b c )’ results in ‘a b c’.


寫得很清楚的manul

makefile 裡面的 $(1)

按照字面上理解就是

弟一個傳進來的 argue

不過還是很抽象  就舉下列例子說明
/////// 我是 makefile ////////
define include-path-for 
$(foreach n,$(1),$(patsubst $(n):%,%,$(filter $(n):%,$(pathmap_INCL))))
endef
/////// makefile 節數//////

我們在makfile 裡面 定義一個  工具

在別的 makefile 我們利用call去呼叫他


////////////// 我是另外一個 malefile ///////
LOCAL_C_INCLUDES:= \
$(call include-path-for, dbus)
/////// makefile 結束//////



這邊就可以得知  對 nclude-path-for 這個 工具而言  第一個 arguement 就是 dbus
他就會傳進去 define 裡面中的 $(1)



詳細 的出處在下面 :



define include-path-for  #定义命令包, n 由调用者传递进来, 这个在 build/core/pathmap.mk
$(foreach n,$(1),$(patsubst $(n):%,%,$(filter $(n):%,$(pathmap_INCL))))
endef
// pathmap_INCL 在 build/core/pathmap.mk 文件中有定义,最后使用的时候可以看到


【函数内实现的解析】
foreach 遍历, patsubst 字符串替换, filter 过滤函数


【函数调用】
这里以external\dbus\bus 下的Android.mk 调用为例:
...
LOCAL_C_INCLUDES:= \
$(call include-path-for, dbus)

foreach




foreach 函數


注意他回傳的是 text 



foreach函數和別的函數非常的不一樣。因為這個函數是用來做循環用的,Makefile中的foreach函數幾乎是仿照於Unix標準Shell/bin/sh)中的for語句,或是C-Shell/bin/csh)中的foreach語句而構建的。它的語法是:
$(foreach <var>,<list>,<text>)
這個函數的意思是,把參數<list>中的單詞逐一取出放到參數<var>所指定的變量中,然後再執行<text>所包含的表達式。每一次<text>會返回一個字符串,循環過程中,<text>的所返回的每個字符串會以空格分隔,最後當整個循環結束時,<text>所返回的每個字符串所組成的整個字符串(以空格分隔)將會是foreach函數的返回值。
所以,<var>最好是一個變量名,<list>可以是一個表達式,而<text>中一般會使用<var>這個參數來依次枚舉<list>中的單詞。舉個例子:
names := a b c d
files := $(foreach n,$(names),$(n).o)
上面的例子中,$(name)中的單詞會被挨個取出,並存到變量「n」中,「$(n).o」每次根據「$(n)」計算出一個值,這些值以空格分隔,最後作為foreach函數的返回,所以,$(files)的值是「a.o b.o c.o d.o」。
注意,foreach中的<var>參數是一個臨時的局部變量,foreach函數執行完後,參數<var>的變量將不在作用,其作用域只在foreach函數當中

linux bash sytax for

http://www.cyberciti.biz/faq/bash-for-loop/

linux shell unset

unset 取消一個 環境變數
舉例說明
export Andy= 1234
env | grep "Andy"
Andy=1234
unset Andy
env | grep "Andy"


Andy 這個環境變數就被 unset 掉了

相當直覺簡單吧  !!!

2016年3月3日 星期四

Makefile words

words 在 manual 中 寫得很清楚 如下

words 函式,回傳字串總字數(以空白區隔的字串),可以搭配 word 函式回傳字串最後一個字,例如:
text:=foo bar
b: 
    echo $(word $(words $(text)), $(text))


這邊要注意的是

因為 words 要回傳值
所以

正確用法 如下
count :=(=) $(word text1 text2)
或是
b:
         @echo  $(word text1 text2)  


否則會發生  missing separator
立如說
$(word text1 text2)    # <--- 這個ㄧ定措


makefile 在makefile 中使用bash

如題目,
$(shell echo "hello world")

這樣就對了

等同於

username@XXX-system : echo hello world




2016年3月2日 星期三

Makefile += ,:=, =,?=

好文一篇
請參考

http://www.cnblogs.com/wanqieddy/archive/2011/09/21/2184257.html


= 是最基本的赋值
:= 是覆盖之前的值
?= 是如果没有被赋值过就赋予等号后面的值
+= 是添加等号后面的值


      1、“=”

      make会将整个makefile展开后,再决定变量的值。也就是说,变量的值将会是整个makefile中最后被指定的值。看例子:

            x = foo
            y = $(x) bar
            x = xyz

      在上例中,y的值将会是 xyz bar ,而不是 foo bar 。

      2、“:=”

      “:=”表示变量的值决定于它在makefile中的位置,而不是整个makefile展开后的最终值。

            x := foo
            y := $(x) bar
            x := xyz

Makefile $(shell) echo "AAA"

在makefile中
  $(shell)  echo "AAA"

@echo "AAA"

對於 shell 所跑出來的情況貌似相同

詳情等理解

Makefile .Phony

.Phony 可以參考這邊的敘述
偽目標
最早先的一個例子中,我們提到過一個“clean”的目標,這是一個“偽目標”,

clean:
rm *.o temp
正像我們前面例子中的“clean”一樣,既然我們生成了許多文件編譯文件,我們也應該提供一個清除它們的“目標”以備完整地重編譯而用。 (以“make clean”來使用該目標)

因為,我們並不生成“clean”這個文件。“偽目標”並不是一個文件,只是一個標籤,由於“偽目標”不是文件,所以make無法生成它的依賴關係和決定它是否要執行。我們只有通過顯式地指明這個“目標”才能讓其生效。當然,“偽目標”的取名不能和文件名重名,不然其就失去了“偽目標”的意義了。

當然,為了避免和文件重名的這種情況,我們可以使用一個特殊的標記“.PHONY”來顯式地指明一個目標是“偽目標”,向make說明,不管是否有這個文件,這個目標就是“偽目標”。

.PHONY : clean
只要有這個聲明,不管是否有“clean”文件,要運行“clean”這個目標,只有“make clean”這樣。於是整個過程可以這樣寫:

.PHONY : clean
clean :
rm *.o temp
偽目標一般沒有依賴的文件。但是,我們也可以為偽目標指定所依賴的文件。偽目標同樣可以作為“默認目標”,只要將其放在第一個。一個示例就是,如果你的Makefile需要一口氣生成若干個可執行文件,但你只想簡單地敲一個make完事,並且,所有的目標文件都寫在一個Makefile中,那麼你可以使用“偽目標”這個特性:

all : prog1 prog2 prog3
.PHONY : all

prog1 : prog1.o utils.o
cc -o prog1 prog1.o utils.o

prog2 : prog2.o
cc -o prog2 prog2.o

prog3 : prog3.o sort.o utils.o
cc -o prog3 prog3.o sort.o utils.o
我們知道,Makefile中的第一個目標會被作為其默認目標。我們聲明了一個“all”的偽目標,其依賴於其它三個目標。由於默認目標的特性是,總是被執行的,但由於“all”又是一個偽目標,偽目標只是一個標籤不會生成文件,所以不會有“all”文件產生。於是,其它三個目標的規則總是會被決議。也就達到了我們一口氣生成多個目標的目的。“.PHONY : all”聲明了“all”這個目標為“偽目標”。(注:這裏的顯式 “.PHONY : all" 不寫的話一般情況也可以正確的執行,這樣 make 可通過隱式規則推導出, “all" 是一個偽目標,執行 make 不會生成 ”all" 文件,而執行後面的多個目標。建議:顯式寫出是一個好習慣。)

隨便提一句,從上面的例子我們可以看出,目標也可以成為依賴。所以,偽目標同樣也可成為依賴。看下面的例子:

.PHONY : cleanall cleanobj cleandiff

cleanall : cleanobj cleandiff
rm program

cleanobj :
rm *.o

cleandiff :
rm *.diff
“make cleanall”將清除所有要被清除的文件。“cleanobj”和“cleandiff”這兩個偽目標有點像“子程式”的意思。我們可以輸入“make cleanall”和“make cleanobj”和“make cleandiff”命令來達到清除不同種類文件的目的。

shell expr 使用方式

根據  man expr 可以列出下列的相關資訊

其實寫得很清楚

但有個重點 , 如果 operator 在 shell 有功用的話要加上 「\」 斜線

例如說

expr  3 > 5       這樣沒有回應 音為 > 在 shell 是個cat output 的功能

expr 3 \> 5 這樣才會顯示  0

AME
       expr - evaluate expressions

SYNOPSIS
       expr EXPRESSION
       expr OPTION

DESCRIPTION
       --help display this help and exit

       --version
              output version information and exit

       Print  the  value of EXPRESSION to standard output.  A blank line below separates increasing precedence groups.
       EXPRESSION may be:

       ARG1 | ARG2
              ARG1 if it is neither null nor 0, otherwise ARG2

       ARG1 & ARG2
              ARG1 if neither argument is null or 0, otherwise 0

       ARG1 < ARG2
              ARG1 is less than ARG2

       ARG1 <= ARG2
              ARG1 is less than or equal to ARG2

       ARG1 = ARG2
              ARG1 is equal to ARG2





附錄 :
REF
http://yuanann.pixnet.net/blog/post/13533610-linux-%3Aexpr-%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95

2016年2月25日 星期四

sed 使用方式 未完成

可以先參考這篇

http://dywang.csie.cyut.edu.tw/dywang/linuxProgram/node36.html


要注意是情是  sed  的 input file 是 stdout 例如說  ls -al 後 在螢幕上所顯示出來的

可以這樣說   ls -al | sed  "s/target/replacement"    

以上面的例子 就是說  ls -al 所印出來的 會先經過 把 target 字串被 replacement 給取代掉

再 從螢幕上面顯示



wget 待續 ....

wegt  -O  test.out   http://111111.com


把從111111.com 載到的變成  檔名 為 test,out



wget -S  http://1111.com   下列 紅字部分 即是  加上 -S 所印出來的東西

Resolving source.android.com (source.android.com)... 64.233.189.101, 64.233.189.138, 64.233.189.100, ...
Connecting to source.android.com (source.android.com)|64.233.189.101|:80... connected.
HTTP request sent, awaiting response...
  HTTP/1.1 200 OK
  Vary: Accept-Encoding
  Content-Type: text/html
  Date: Thu, 25 Feb 2016 11:58:51 GMT
  Expires: Thu, 25 Feb 2016 11:58:51 GMT
  Cache-Control: private, max-age=14400
  Last-Modified: Wed, 26 Aug 2015 23:45:00 GMT
  X-Content-Type-Options: nosniff
  Server: sffe
  X-XSS-Protection: 1; mode=block
  Accept-Ranges: none
  Transfer-Encoding: chunked
Length: unspecified [text/html]
Saving to: ‘test’

    [ <=>                                                                             ] 2,551       --.-K/s   in 0s

2016-02-25 19:58:51 (89.8 MB/s) - ‘test’ saved [2551]


2016年2月23日 星期二

用 apt-get下載 openjvc 8.0

http://ubuntuhandbook.org/index.php/2015/01/install-openjdk-8-ubuntu-14-04-12-04-lts/


先把 repository 加入 ppa
再用 apt-get install 等相關指令 下載




http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html

wget usage

這個網頁對於 wget 寫得非常詳細  值得參閱
http://www.computerhope.com/unix/wget.htm


http://www.ewdna.com/2012/04/wget.html

unmanged wired

不知為何
我的 ifocnfig 下的 eth0 inet 消失
也就是 ipv4不能使用

我上網找了一下
看到這篇 http://www.blackmoreops.com/2013/11/25/how-to-fix-wired-network-interface-device-not-managed-error/

就猜 把 這檔案改掉

vim /etc/network/interfaces

把這行住記掉
#iface eth0 inet manual
就好了

目前尚未釐清

2016年2月22日 星期一

pppoe linux 使用教學

如題:
     一開始設定的時候:
 sudo pppoeconf  皆下來只要下一步 下一步 即可

想關掉的時候  sudo poff  dsl-provider 
想打開的時候  sudo pon dsl-provider



2016年2月21日 星期日

奮戰許久的android driver

如提
我載了很多檔案和瀏覽很多網頁
最後發現有這招
http://j796160836.pixnet.net/blog/post/29610725-%5Bandroid%5D-google%E5%87%BA%E7%9A%84android%E8%90%AC%E7%94%A8%E9%A9%85%E5%8B%95%EF%BC%8C%E9%A9%85%E5%8B%95%E8%A3%9D%E4%B8%8D%E4%B8%8A


在 裝置管理員 安裝的時候

先選 從電腦 中 的 資料匣 去

選定好 後

在選下面的 從磁碟片安裝 驅動程式

指定到目標檔案所提供的驅動程式

最後 才得以順利安裝

網頁上面的案例 是使用google所提供的





2016年2月3日 星期三

2016年1月31日 星期日

LS_COLOR 的參數意義

其實我們可以改變 BASH 中的 LS_COLORS 環境變數,這樣無論使用什麼軟體也會有相同顯示效果。</p>
 首先,登入後修改 ~/.bashrc 檔,加入或修改 ls, LS_COLOR 變數,如下:


LS_COLORS='di=1:fi=0:ln=31:pi=5:so=5:bd=5:cd=5:or=31:mi=0:ex=35:*.rpm=90'<br />
export LS_COLORS
LS_COLORS 參數有:
 di = directory
fi = file
ln = symbolic link
pi = fifo file
so = socket file
bd = block (buffered) special file
cd = character (unbuffered) special file
or = symbolic link pointing to a non-existent file (orphan)
mi = non-existent file pointed to by a symbolic link (visible when you type ls -l)
ex = file which is executable (ie. has 'x' set in permissions)
顏色方面,代碼如下:
0 = default colour
1 = bold
4 = underlined
5 = flashing text
7 = reverse field
31 = red
32 = green
33 = orange
34 = blue
35 = purple
36 = cyan
37 = grey
40 = black background
41 = red background
42 = green background
43 = orange background
44 = blue background
45 = purple background
46 = cyan background
47 = grey background
90 = dark grey
91 = light red
92 = light green
93 = yellow
94 = light blue
95 = light purple
96 = turquoise
100 = dark grey background
101 = light red background
102 = light green background
103 = yellow background
104 = light blue background
105 = light purple background
106 = turquoise background

http://linux-sxs.org/housekeeping/lscolors.html
http://linux.about.com/od/bgb_guide/a/gdebgb29t00.htm