2009年5月20日星期三

notice

blogspot 网站被封了,我登不上了。


2009年5月14日星期四

信息安全试验

人生是一个不断积累的过程!

1. 数字签名

在收发双方不能完全信任的情况下,数字签名是解决该问题的最好方法。其作用相当于手写签名。数字签名满足:必须能验证签名者、签名日期和时间;能认证被签的消息内容;应能由第三方仲裁,以解决争议。

数字签名必须是与消息相关的二进制位串,签名必须使用发送方某些独有的信息,以防止伪造和否认,产生数字签名比较容易,识别和验证签名比较容易,伪造数字签名在计算上是不可行的,保存数字签名的拷贝是可行的。

基于密码技术的数字签名一般采用具有数字签名功能的公开钥密码算法,如RSA、DSA等。其基本原理是使用秘密钥加密实现数字签名,使用公开钥解密实现签名验证。在实际应用中,数字签名包括两个步骤:(1)对待签名信息计算HASH值(2)对HASH值采用秘密钥加密得到数字签名值;验证过程是首先将数字签名值用对应的公开钥解密,并和重新计算的信息的HASH值进行比较,如果相同,证明验证签名正确,否则认为是错误。

2. 数字证书

数字证书是指利用数字签名技术实现的经由第三方可信的、权威的机构CA签发的,将被认证对象(用户)的身份信息和其公开钥进行有效捆绑而编码形成的数字认证信息。通过验证者对数字证书的验证,确保用户身份和用户公开钥的一一对应性,从而确认用户对该公开钥的合法拥有,从而利用该公钥进行安全的信息加密。

X509标准是数字证书的主要标准之一。在一个标准的数字证书中,包含证书版本号、证书序列号、证书签发者身份信息、证书拥有者(用户)身份信息、证书有效期、证书拥有者公钥信息、某些扩展信息、签名方法以及证书签发者用自己的私钥对以上信息所做的签名产生的签名信息。证书的验证主要包括验证数字签名是否正确(确认证书是否被修改)、证书有效期是否有效、证书签发者是否可信、证书中其他信息是否符合政策、证书是否已经被注销等,在证书链中,还应验证证书链中所有的证书是否符合信任链关系等。


3. 证书注销列表(黑名单)

数字证书在有效期内因各种原因(对应秘密钥丢失、身份信息变更等)可能变得不安全,需要申请注销。证书注销列表是由可信的、权威的第三方机构CA审核签发的所有在证书有效期内,但是被注销的证书的列表。该列表经由CA机构签名保证可信。用户通过定期下载,在验证证书有效性时使用。

4. CA中心

CA中心(Certificate Authority)即数字证书认证机构,是一个可信的、权威的第三方机构,其主要功能就是为用户(包括人和设备等)签发数字证书,并实施相应的管理。

CA 的核心功能就是发放和管理数字证书,具体描述如下:
(1)接收验证最终用户数字证书的申请。
(2)确定是否接受最终用户数字证书的申请—证书的审批。
(3)向申请者颁发、拒绝颁发数字证书—证书的发放。
(4)接收、处理最终用户的数字证书更新请求—证书的更新。
(5)接收最终用户数字证书的查询、撤销。
(6)产生和发布证书注销列表(CRL)。
(7)数字证书的归档。
(8)密钥归档。
(9)历史数据归档。

CA 的数字签名保证了证书的合法性和权威性。主体的公钥可有两种产生方式:(1)用户自己生成密钥对,然后将公钥以安全的方式传给 CA,该过程必须保证用户公钥的可验证性和完整性。(2)CA 替用户生成密钥对,然后将其以安全的方式传送给用户,该过程必须确保密钥的机密性、完整性和可验证性。该方式下由于用户的私钥为 CA 所产生,故对 CA 的可信性有更高的要求。

RA(Registry Authority,注册中心),是数字证书注册审批机构。RA 系统是 CA 的证书发放、管理的延伸。它负责证书申请者的信息录入、审核等工作;同时,对发放的证书完成相应的管理功能。

RA 系统是整个 CA 中心得以正常运营不可缺少的一部分。但有的系统中,将 RA 合并在 CA 中。一般说来,注册机构控制注册、证书传递、其他密钥和证书生命周期管理过程中主体、最终实体和 PKI间的交换。

2009年5月10日星期日

生态环境

生态环境恶化,物种消失,归根到底是人类的自私与贪婪。要怎么解决这个问题呢?对付自私和贪婪,我不认为单纯的讲道理搞宣传,会有好的效果。唯有极度的惩罚措施,辅以强力度的宣传,才有可能刹住滥杀野生动物的恶风。譬如,如果对于制作和食用鱼翅的人,一经发现,割掉舌头,我相信,他不会再想吃第二次。感受痛苦,方能理解痛苦。

1、ATM取出假钱--->银行无责
2、网上银行被盗--->储户责任
3、银行多给了钱--->储户义务归还
4、银行少给了钱--->离开柜台概不负责
5、ATM机出现故障少给钱--->用户负责
6、ATM机出现故障多给钱--->用户盗窃
7、广东开平银行行长贪污4亿--->判12年
8、清洁工捡到14公斤金饰--->判无期

如果此生,我可以改变这一切,我将死而无憾

2009年5月9日星期六

软件工程

 UML中类有三种主要的版型:边界类、控制类和实体类。引入边界类、控制类及实体类的概念有助于分析和设计人员确定系统中的类。

    边界类位于系统与外界的交界处,窗体、报表、以及表示通讯协议的类、直接与外部设备交互的类、直接与外部系统交互的类等都是边界类。通过用例图可以确定需要 的边界类,每个Actor/Use Case对至少要一个边界类,但并非每个Actor/Use Case对要唯一的边界类。

   实体类保存要放进持久存储体的信息。持久存储体就是数据库、文件等可以永久存储数据的介质。实体类可以通过事件流和交互图发现。通常每个实体类在数据库中有相应的表,实体类中的属性对应数据库表中的字段。

控制类是控制其他类工作的类。每个用例通常有一个控制类,控制用例中的事件顺序,控制类也可以在多个用例间共用。其他类并不向控制类发送很多消息,而是由控制类发出很多消息。

 例如在考试系统中 当学生在考试时 ,学生与试卷交互 那么 学生和试卷都是实体类,而考试时间 ,规则,分数都是边界类; 当考试完了将试卷提交给试卷保管者 ,则 试卷则成了边界类.

 状态图和时序图 区别在于 时序图体现时间顺序的正常情况. 而状态图则体现所以可能的交互.例如 搜索 删除 增加 修改 不太可能受时间约束 就用状态图表示

http://www.woodpecker.org.cn:9081/doc/RationalUnifiedProcess.zh_cn/process/modguide/md_bcls.htm

2009年5月8日星期五

vi command

linux 技巧与命令

其实最好的使用方式:#man # ..... --help

indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs

参数说明:
-npro或--ignore-profile  不要读取indent的配置文件.indent.pro。
-kr  指定使用Kernighan&Ritchie的格式。
-i8  --indent-level 设置缩排的格数为8。
-ts8 设置tab的长度
-sob或--swallow-optional-blank-lines  删除多余的空白行。
-l80 代码超过80换行
-ss或--space-special-semicolon  若for区段只有一行时,在分号前加上空格。
-ncs或--no-space-after-casts  不要在cast之后空一格。

可以使用dos2unix命令,转换程序。

c++

windlx实验

实验报告要求:实验目的、内容、程序、流程图、中间结果、最终结果、步骤

Single Cycle F7 单步执行

IF ID EX MEM WB READ WRITE

sw SaveR2,r2 R2M(SaveR2)

sw PrintfPar,r1 R1PrintfPar 没有WB?不需要写内存

PrintfPar: .space 4 变量PrintfPar 保留4个字节

laddEX 加 lmulEX 乘 ldivEX 除

trap 0x5 清空流水线,输出结果。

?intEX 与 laddEX ...的关系 ,这鸟实验做的,鸟实验指导书写的,唉!

trap 0x3 从键盘接受输入,也要清空流水线

lbu r3,0x0[r2] 装入无符号字节 REG[r3]<-MEM[0+REG[r2]]

seqi r5,r3,0xa IF(R3=立即数10) 1R5 ELSE 0R5

bnez r5,input.Finish IF(R3=立即数10) 1R5 ELSE 0R5 输出结果

trap 0x0 无论何时遇到一条trap指令时,流水线将被清空。结束程序。

PC 程序计数器 IR 指令寄存器

文件分析:

input.s , 将存储的数放在r1中。

jr r31 ; R31PC 从子程序返回

0xa 10 NL line feed, new line

终于把代码看懂了!

跳转指令中会出现流水线气泡;



当定向硬件检测到前一个 ALU 运算结果的写入寄存器就是当前 ALU 操作的源寄存器时,那么控制逻辑将前一个 ALU 运算结果定向到 ALU 的输入端,后一个 ALU 操作就不必从源寄存器中读取操作数。

trap 0x3 接受的输入存到了哪里?
数字i对应的ascii码是i+30
0xa对应回车键

实验二 用WinDLX模拟器执行程序求最大公约数

trap 0x5; 和r14相关。

实验报告的内容应包括:实验目的、实验内容、实验程序、程序流程图、实验步骤、实验中间结果、实验最终结果。

-----------------------------------------input.s---------------------------------------------------------------------------------

;*** determine value
addi r2,r0,ReadBuffer ;r2=ReadBuffer+0
addi r1,r0,0 ;r1=0,r1清零
addi r4,r0,10 ;Decimal system; r4=10;

Loop: ;*** reads digits to end of line
lbu r3,0(r2) ;载入无符号字节 r3 <- mem[0+[r2]] 即:r3 = ReadBuffer(输入数的十六进制) seqi r5,r3,10 ;LF(r3==10) r5=1(exit);else r5=0 bnez r5,Finish ;if(r5==1) j Finish; subi r3,r3,48 ;r3 = r3-48 multu r1,r1,r4 ;r1=r1*r4 add r1,r1,r3 ;r1=r1+r3,r1==0,相当于r1=r3 addi r2,r2,1 ;increment pointer;r2=r2+1;而mem[[r2]]=0xa j Loop

----------------------------------fact.s---------------------------------------------------------------

;*** init values
movi2fp f10,r1 ;f10=[r1];R1 -> D0 D0..Count register;将32位整型寄存器中的内容移入浮点寄存器;
cvti2d f0,f10 ;f0=[f10]=[r1];转换指令,CVTx2y表示从类型x转换到类型y,其中x和y可以是I(整型)、D(双精度浮点)、F(单精度浮点)
addi r2,r0,1 ;r2=1; D2..result;r2=r0+1
movi2fp f11,r2 ;f11 = [r2]
cvti2d f2,f11 ;f2=[f11]=[r2]
movd f4,f2 ;1-> D4 D4..Constant 1;f4=[f2];

;*** Break loop if D0 = 1
Loop: led f0,f4 ;if(f0<=f4) fps=1;else fps=0; bfpt Finish ;视fps而定 ;*** Multiplication and next loop multd f2,f2,f0 ;f2=[f2]*[f0] subd f0,f0,f4 ;f0=[f0]-1 j Loop ; Finish: ;*** write result to stdout sd PrintfValue,f2 ; addi r14,r0,PrintfPar ;r14 = r0 + &PrintfPar trap 5 ;stdout, trap 5 输出r14中的内容 ------------------------------------prim.s-------------------------------------------------------------------------

;*********** WINDLX Exp.2: Generate prime number table *************
;*********** (c) 1991 G黱ther Raidl *************
;*********** Modified 1992 Maziar Khosravipour *************

;-------------------------------------------------------------------
; Program begins at symbol main
; generates a table with the first 'Count' prime numbers from 'Table'
;-------------------------------------------------------------------

.data

;*** size of table
.global Count
Count: -----------------0x1000
.word 10
.global Table
Table: -----------------0x1004
.space Count*4


.text
.global main
main:
;*** Initialization
addi r1,r0,0 ;Index in Table; [r1]=[r0]+0;
addi r2,r0,2 ;Current value; [r2]=[r0]+2;

;*** Determine, if R2 can be divided by a value in table
NextValue:
addi r3,r0,0 ;Helpindex in Table; [r3]=[r0]+0
Loop:
seq r4,r1,r3 ;End of Table? if(r1==r3) r4=1;else r4=0;
bnez r4,IsPrim ;R2 is a prime number;如果r1==r3;if(r4==1) j IsPrim;
lw r5,Table(R3); 从主存里读数(以前存放的素数),存到r5
divu r6,r2,r5; r6=r2/r5
multu r7,r6,r5 r7=r6*r5
subu r8,r2,r7 r8=r2-r7
beqz r8,IsNoPrim if(r8==0) j IsNoPrim
addi r3,r3,4 r3+=4; 读取下一个素数
j Loop

IsPrim: ;*** Write value into Table and increment index
sw Table(r1),r2 存数
addi r1,r1,4; r1=r1+4;

;*** 'Count' reached?
lw r9,Count; 从主存中取数放到r9, 0x0a,10
srli r10,r1,2; 移位,右移高位填0,r10 = r1>>2 = r1/4
sge r11,r10,r9; if(r10>r9) r11=1; else r11=0;
bnez r11,Finish if(r11==1) j Finish

IsNoPrim: ;*** Check next value
addi r2,r2,1 ;increment R2
j NextValue ;

Finish: ;*** end
trap 0

// 0x1000 Count里面存10 0x1004 Table里面存放找到的素数
// 本程序用于寻找素数,从2开始找,初始值放到r2,
// 除法用了19个节拍,导致后续依赖其数值的后续指令等待,流水线断流:
multu r7,r6,r5 r7=r6*r5 R-stall
subu r8,r2,r7 r8=r2-r7 stall

2009年5月7日星期四

一些话

必须控制住自己,我不是缺乏胆量的人,有些事情必须去做,而且只能在某个时间做,就必须去做。

essay

I do not know why I choose to take part in the entrance exams for postgraduate schools. I heard that Tsinghua University has the best computer college in china, so I select Tsinghua. Maybe I want to prove that I am not worse than others. In fact I have no interest in Tsinghua and postgraduate. But what I can do except this? Frequently I feel that life mean nothing, it is tedious to live in the world.
Money is important to a poor guy like me, to be a postgraduate means no money or less money in three years, which is not a good thing. So if I failed to pass the entrance exam, I would not have too much discomfort.

2009年5月6日星期三

emacs 使用

1 insert time
(defun my-insert-date ()
(interactive)
(insert (format-time-string "%Y/%m/%d %H:%M:%S" (current-time))))

(global-set-key (kbd "C-c m d") 'my-insert-date)

emacs配置

参考:http://www.caole.net/diary/emacs_setting.html
color-theme配置
#apt-get install emacs-goodies-el
(require 'color-theme)
;;(color-theme-initialize)
;;(color-theme-tty-dark)
;;(color-theme-comidia)
;;(color-theme-dark-laptop)
;;(color-theme-sitaramv-solaris)

(set-face-background 'default "#334455")
(set-face-foreground 'default "wheat")
(set-cursor-color "white")



;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(browse-url-mozilla-program "firefox")
'(case-fold-search-t nil)
'(column-number-mode t)
'(compilation-scroll-output t)
'(compile-command "make")
'(current-language-environment "Chinese-GB")
'(display-time-mode t)
'(ecb-options-version "2.32")
'(global-font-lock-mode t)
'(show-paren-mode t)
'(tab-width 4)
'(tool-bar-mode nil)
'(transient-mark-mode t)




;;;; 显示行号:
(setq column-number-mode t)
(setq line-number-mode t)

;;;; 显示时间
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(display-time)

;;;; 关闭启动画面
(setq inhibit-startup-message t)

;;;;设置大的kill ring
(setq kill-ring-max 150)


;;;;自动补齐策略

(defun my-indent-or-complete ()
(interactive)
(if (looking-at "\\>")
(hippie-expand nil)
(indent-for-tab-command))
)

(global-set-key [(control tab)] 'my-indent-or-complete)

(autoload 'senator-try-expand-semantic "senator")

(setq hippie-expand-try-functions-list
'(
senator-try-expand-semantic
try-expand-dabbrev
try-expand-dabbrev-visible
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill
try-expand-list
try-expand-list-all-buffers
try-expand-line
try-expand-line-all-buffers
try-complete-file-name-partially
try-complete-file-name
try-expand-whole-kill
)
)




;;;; CC-mode配置 http://cc-mode.sourceforge.net/
(require 'cc-mode)
(c-set-offset 'inline-open 0)
(c-set-offset 'friend '-)
(c-set-offset 'substatement-open 0)

;;;;根据后缀判断所用的mode
;;;;注意:我在这里把.h关联到了c++-mode
(setq auto-mode-alist
(append '(("\\.h$" . c++-mode)) auto-mode-alist))



;;;;我的C/C++语言编辑策略

(defun my-c-mode-common-hook()
(setq tab-width 4 indent-tabs-mode nil)
;;; hungry-delete and auto-newline
(c-toggle-auto-hungry-state 1)
;;按键定义
(define-key c-mode-base-map [(control \`)] 'hs-toggle-hiding)
(define-key c-mode-base-map [(return)] 'newline-and-indent)
(define-key c-mode-base-map [(f7)] 'compile)
(define-key c-mode-base-map [(f8)] 'ff-get-other-file)
(define-key c-mode-base-map [(meta \`)] 'c-indent-command)
;; (define-key c-mode-base-map [(tab)] 'hippie-expand)
(define-key c-mode-base-map [(tab)] 'my-indent-or-complete)
(define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu)
;;预处理设置
(setq c-macro-shrink-window-flag t)
(setq c-macro-preprocessor "cpp")
(setq c-macro-cppflags " ")
(setq c-macro-prompt-flag t)
(setq hs-minor-mode t)
(setq abbrev-mode t)
(setq tab-width 4 indent-tabs-mode nil)
)
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

;;;;我的C++语言编辑策略
(defun my-c++-mode-hook()
(setq tab-width 4 indent-tabs-mode nil)
(c-set-style "stroustrup")
;; (define-key c++-mode-map [f3] 'replace-regexp)
)

(add-hook 'c++-mode-hook 'my-c++-mode-hook)

;;;;C/C++语言启动时自动加载semantic对/usr/include的索引数据库
(setq semanticdb-search-system-databases t)
(add-hook 'c-mode-common-hook
(lambda ()
(setq semanticdb-project-system-databases
(list (semanticdb-create-database
semanticdb-new-database-class
"/usr/include")))))
;;;;我的Java语言编辑策略
(defun my-java-mode-hook()
(setq tab-width 4 indent-tabs-mode nil)
)

(setq visible-bell 't) ;用闪屏代替振铃

(show-paren-mode 't) ;括号配对显示

2009年5月2日星期六

metasploit

nepenthes configure

log-irc.conf:
use-tor "1"; //change 1 to 0, use no proxy to connect irc

nepenthes configure is really hard, for it is hard to get enough information!
I do not understand why nobody try to attack my nepenthes until now! It shoud be insteresing.

I get many .bin file in directory: /var/lib/nepenthes/hexdumps, but nothing in /var/lib/nepenthes/binaries.

-----------------------1
uncomment "logirc.so" in nepenthes.conf and edit log-irc.conf
-----------------------2
in irc I get:
(10时51分10秒) nep-noname: Handler http download handler will download http://213.92.8.7:31204/
(10时51分11秒) nep-noname: HTTP ERROR header found 12

-----------------------3
if I use metasploit to exploit honeypot, it should get shellcode , and i should see it on irc. try! 143 smtp !but I still get nothing in /var/lib/nepenthes/binaries.


----- I failed to find anthing valuable, so I decide to reinstall nepenthes.
#sudo su
#apt-get purge nepenthes //do not use remove
#cp /etc/nepenthes /etc/nepenthes.bak

change
/etc/nepenthes/nepenthes.conf:
uncomment the line "submitnorman.so", "submit-norman.conf"
uncomment the line "logirc.so","log-irc.conf",
/etc/nepenthes/submit-norman.conf
change email to "dongfangjack@gmail.com"
/etc/nepenthe/log-irc.conf
use-tor "0";
....configure irc server and channel

#cd /etc/nepenthes
#rm *~
#/etc/init.d/nepenthes start

irc display:
(19时57分28秒) nep-noname: Handler http download handler will download http://213.92.8.7:31204/
(19时57分32秒) nep-noname: HTTP ERROR header found 12

irc command

加入某个聊天室
输入
/join #聊天室名称

   
退出某个聊天室
/part #聊天室名称

列出聊天室名称
/list

向某人发出密聊话语,或者对某个闲聊室的所有人说话
/msg 昵称 消息内容
/msg 消息内容

用来向某人发出密聊话语
/query 昵称 消息内容

用来向某人发出注意信息
/notice 昵称 消息内容


改变昵称
/nick 昵称

退出连接
/quit

暂时离开
/away
查询当前IRC服务器上Admin,IRC里最高级别的管理员)的相关信息
/admin

邀请某人到你指定的闲聊室
/invite <别名> <#闲聊室>

把某人从你指定的闲聊室赶出去,管理员做的事
/kick <#闲聊室> <别名> [踢他的原因]

--------------------------------------------------------------------------------------------------
create a new channel
1 Create your separate channel by typing /join #channel, where channel is the name of your new channel.
2 Register it with /cs register #channel .
3 Inside the new channel, assign a topic to it by typing /topic #quantum This channel is about recent change patrol where This channel is about recent changes patrol is the the topic of the new channel.
4 Invite others to join. In the larger, public channel, type /Invite john #channel, where john is the user name and #channel is your channel.'
  • If you want your channel to be invitation only, type /mode #channel +i where #channel is the name of your channel.
5 Set your new channel to private or secret by typing /mode #mynewchannel +s for secret and /mode #mynewchannel +p for private. If you don't mind your new channel being public, don't do anything. All new channels are automatically public.

2009年5月1日星期五

英语单词积累

2009-5-7 21:24:29
vowel
[ˈvauəl]
n.元音(符号,字母)
vicinity [viˈsiniti]
n.周围地区,临近地区
ventilate [ˈventileit]
vt.使通风;把…公开,公开讨论
van [væn]
n.运货车,(载客的)面包车
goodness criteria