femto's space
百度空间 | 百度首页 
               
 
文章列表
 
2009-03-17 06:20

How to becoming a great hacker

http://giraffesoft.ca/blog/2009/03/10/4-core-competencies-of-great-hackers.html

At giraffesoft we do a lot of pair-programming collaborative development, both internally and when hired to coach or audit teams. After working closely with dozens of programmers, it's time to draw some conclusions.

Here are 4 traits that appear to be universal amongst great hackers:

Typing over 60 wpm

Thousands of hours spent on IM and IRC make you a faster typist. It's a skill that can be learned in school or with specialized software in 20 to 40 hours. So why are so many programmers glancing at their keyboards for common symbols?

Bringing up typing speed in conversation meets some resistance amongst some programmers. I've tried arguing that the micro-interruptions to your programming can knock you out of your flow and kill your productivity. For those that do not listen, I offer the example of people that google hotmail. It seems noobish, doesn't it?

Owning the command-line

Some developers need a pretty GUI or IDE to wrap every command-line utility. During one audit at a consulting company I saw a programmer wrestle with his IDE for 10 minutes in front of two CTOs. Verdict? His IDE didn't yet have support for the last version of Ruby on Rails, which we needed for specific functionality (ActiveResource). He was stuck.

In contrast, every great hacker we know has a customized environment, and they routinely compose unix commands. Even those stuck on Windows because of corporate policy still run Linux at home or on their servers.

Knowing your editor

Let's not pick editor fights: the only 3 editors we know to be used by great hackers are TextMate, vim and emacs. The most productive hackers will often customize their editor heavily.

We haven't met a single great hacker that relied on an IDE, although we hear they exist.

Reading code: owning your tools

We've noticed more people ignoring documentation and going straight to the source code. It's a great start.

Diving into a large code base to quickly understand what it does is a skill that can be practiced. People do get much faster at it with a little bit of practice. So fast that using a debugger to step through code seems slow by comparison; I've been chided by one hacker for using a debugger. "It's slow and it doesn't help you understand the code." Ouch.

Most hackers we know routinely read the source of plugins and frameworks before using them. By choosing better architected tools it's easier to add new functionality or discover security flaws. They also appear rather nonchalant about modifying framework code. They understand what it does, and feel free to modify it as if it was their code.

But, but...

The list isn't final or perfect, just the result of observations and discussions. A check-list for self-improvement.

I don't pretend to fit the description of "great hacker" that I've offered up: I don't read enough code, haven't done much work customizing my editor and barely know some CLI utilities like awk or sed. While I won't claim that learning these 4 skills will make you a great hacker, it seems unlikely you can become one without them.

 
2009-02-20 21:25

最近在研究PE文件格式(也就是Exe文件的格式)

typedef struct _IMAGE_DOS_HEADER { // DOS的.EXE头部
  USHORT e_magic; // 魔术数字
  USHORT e_cblp; // 文件最后页的字节数
  USHORT e_cp; // 文件页数
  USHORT e_crlc; // 重定义元素个数
  USHORT e_cparhdr; // 头部尺寸,以段落为单位
  USHORT e_minalloc; // 所需的最小附加段
  USHORT e_maxalloc; // 所需的最大附加段
  USHORT e_ss; // 初始的SS值(相对偏移量)
  USHORT e_sp; // 初始的SP值
  USHORT e_csum; // 校验和
  USHORT e_ip; // 初始的IP值
  USHORT e_cs; // 初始的CS值(相对偏移量)
  USHORT e_lfarlc; // 重分配表文件地址
  USHORT e_ovno; // 覆盖号
  USHORT e_res[4]; // 保留字
  USHORT e_oemid; // OEM标识符(相对e_oeminfo)
  USHORT e_oeminfo; // OEM信息
  USHORT e_res2[10]; // 保留字
  LONG e_lfanew; // 新exe头部的文件地址
} IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
稍微写了一个脚本查看
$: << File.join(File.dirname(__FILE__), "..", "lib")
#require "dynamic-struct"
require 'core-ext'
 
#class DynamicStruct
# class_inheritable_accessor :fields_spec
#end
#DynamicStruct.fields_spec ||= []

class DynamicStruct
attr_accessor :fields
module ClassMethods
    attr_accessor :fields_spec
    def u2(symbol, options=nil)
       @fields_spec ||= []
       @fields_spec << [:u2, symbol, options ]
    end
    alias :USHORT :u2
      def u4(symbol, options=nil)
      @fields_spec ||= []
      @fields_spec << [:u4, symbol, options ]
    end
    alias :ULONG :u4
end
extend ClassMethods
def read(file)
    @fields ||= []
      #puts self.class.fields_spec.inspect
    self.class.fields_spec.each do |field_spec|
    options = field_spec[2]
        options||={}
       if field_spec[0] == :u2
          value = file.sysread(2)
          value = value.unpack("s")[0] unless options[:format] == :string
          @fields << [value, field_spec] #options
       elsif field_spec[0] == :u4
          value = file.sysread(4)
          value = value.unpack("i")[0] unless options[:format] == :string
          @fields << [value, field_spec] #options
       end
    end
end
def to_s(format=nil)
    result = ""
    if(format.nil?)
      @fields.each do |value, field_spec|
        #puts "converting #{value.inspect}"
      result << "#{field_spec[1]}:#{value.to_s}\n"
      end
    end
    result
end

end

class Image_Dos_Header < DynamicStruct
u2 :e_magic, :format=>:string;
u2 :e_cblp; #// 文件最后页的字节数
u2 :e_cp; #// 文件页数
u2 :e_crlc; #// 重定义元素个数
u2 :e_cparhdr; #// 头部尺寸,以段落为单位
u2 :e_minalloc; #// 所需的最小附加段
u2 :e_maxalloc; #// 所需的最大附加段
u2 :e_ss; #// 初始的SS值(相对偏移量)
u2 :e_sp; #// 初始的SP值
u2 :e_csum; #// 校验和
u2 :e_ip; #// 初始的IP值
u2 :e_cs; #// 初始的CS值(相对偏移量)
u2 :e_lfarlc; #// 重分配表文件地址
u2 :e_ovno; #// 覆盖号
u2 :e_res_0; #// 保留字
u2 :e_res_1; #// 保留字
u2 :e_res_2; #// 保留字
u2 :e_res_3; #// 保留字
u2 :e_oemid; #// OEM标识符(相对e_oeminfo)
u2 :e_oeminfo; #// OEM信息
u2 :e_res2_0; #// 保留字
u2 :e_res2_1; #// 保留字
u2 :e_res2_2; #// 保留字
u2 :e_res2_3; #// 保留字
u2 :e_res2_4; #// 保留字
u2 :e_res2_5; #// 保留字
u2 :e_res2_6; #// 保留字
u2 :e_res2_7; #// 保留字
u2 :e_res2_8; #// 保留字
u2 :e_res2_9; #// 保留字
u4 :e_lfanew; #// 新exe头部的文件地址
#field_type :image_dos_header
end
class PEFile < DynamicStruct
#image_dos_header :dos_header

end
file = ARGV[0] || "shake.exe"
f = File.new(file, "rb")
#pefile=PEFile.new
dos_header = Image_Dos_Header.new
#dos_header.read(f)
#pefile.read(f)
f.seek 0x108
puts f.sysread(4)
class Image_File_Header < DynamicStruct
USHORT :Machine;
USHORT :NumberOfSections;
ULONG :TimeDateStamp;
ULONG :PointerToSymbolTable;
ULONG :NumberOfSymbols;
USHORT :SizeOfOptionalHeader;
USHORT :Characteristics;
end
r = Image_File_Header.new
r.read(f)
puts r
f.close
#puts dos_header.to_s
输出:
PE
Machine:332
NumberOfSections:4
TimeDateStamp:1083547367
PointerToSymbolTable:0
NumberOfSymbols:0
SizeOfOptionalHeader:224
Characteristics:271
 
 
2009-02-14 19:20

最近在看明朝那些事儿,看到

'在人的一生中,至少有那么一两件事,应该不妥协,至少一两件。因为不妥协、坚持虽然不现实,很没好处,却是正确的'

是啊,至少有那么一两件事,应该不妥协。

还有明月说的'文明的灭绝是正常的,因为麻烦太多,天灾人祸、内斗外斗,所以四大文明灭了三个,只有中国文明流传至今,实在太不容易'

呵呵。

纲常万古,节义千秋,天地知我,家人无忧

 
2009-02-13 23:31
原来Ubuntu是南非的啊?这么牛逼?
 
2009-01-14 20:31
今天玩了一伙qt,首先,写一个hello.cpp #include #include int main(int argc, char *argv[]) { QApplication app(argc, argv); QLabel *label = new QLabel("Hello Qt!"); label->show(); return app.exec(); } 然后 qmake -project qmake make 就可以了,出来一个qt的window,显示一个QLabel, Hello Qt, 值得注意的是,QLabel是支持html的, 所以可以把字符串改成 ("

Hello " "Qt!

"); 直接显示,挺有意思的。
 
2008-12-18 10:08
C:\ruby\bin\ruby.exe -e "STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift)" F:/rails-project/proxying/script/server default -p 3000 -b 127.0.0.1 -e development
C:/LAN/ruby-1.9.0-0/lib/ruby/gems/1.9.0/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require': too short escaped multibyte character: /\A(?: (SyntaxError)
                     [\x00-\x7f]                                     |
                     [\xc2-\xdf] [\x80-\xbf]                         |
                     \xe0        [\xa0-\xbf] [\x80-\xbf]             |
                     [\xe1-\xef] [\x80-\xbf] [\x80-\xbf]             |
                     \xf0        [\x90-\xbf] [\x80-\xbf] [\x80-\xbf] |
                     [\xf1-\xf3] [\x80-\xbf] [\x80-\xbf] [\x80-\xbf] |
                     \xf4        [\x80-\x8f] [\x80-\xbf] [\x80-\xbf]
                    )*\z/x
C:/LAN/ruby-1.9.0-0/lib/ruby/gems/1.9.0/gems/activesupport-2.2.2/lib/active_support/multibyte/chars.rb:85: too short escaped multibyte character: /\A(?:
                     [\x00-\x7f]                                     |
                     [\xc2-\xdf] [\x80-\xbf]                         |
                     \xe0        [\xa0-\xbf] [\x80-\xbf]             |
                     [\xe1-\xef] [\x80-\xbf] [\x80-\xbf]             |
                     \xf0        [\x90-\xbf] [\x80-\xbf] [\x80-\xbf] |
   from C:/LAN/ruby-1.9.0-0/lib/ruby/gems/1.9.0/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `block in require'
 
2008-12-16 16:36

1.模拟user-agent

file = open(url,"User-Agent" => "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; baiduds; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)")

2.gunzip

unzip it.

body_io=StringIO.new(str)
            str=Zlib::GzipReader.new(body_io).read

 
2007-09-21 19:38

        通常, 传统的应用程序,对于信息的操作是定义方法, 比如web站点爬行,

        定义一下函数,然后进行操作:

       url_get "http://www.twitter.com", url_post "http://www.twitter.com", params

       而另外的动态语言,比如ruby,因为可以在已有的类上再进行操作,所以可以把这些方法定义在String上,构成dsl:

         比如"http://www.twitter.com".get 或者"http://www.twitter.com".post(params),

         相比之下,等于ruby多了一种选择,可以把信息的操作放在后面(其实应用系统就是对不同信息的各种各样的操作的组合), 而传统的编程语言,比如java, 却选择不多,只能把操作放在前面。

          如果我们把程序的source看成一种layout, 布局在二维空间上的一种东东, 那么ruby这种语法,等于我现在可以选择在 信息 之前 还是 之后添加操作符/运算符, 构成应用系统所需的要求,而java这种传统语法,在多数情况下,只能限定在之前添加操作符/运算符。也就是说, ruby或者类似语言 比 java或者类似语言多了一重选择,或者换句话说, 多了一重维度。在多出来的这重维度上,实际上可以有更加自由/灵活的选择,更加丰富的语法。

 
2007-09-20 13:55

     今天看到曹晓刚的msn签名改成了rootkit, 奇怪阿, 他不是做J2EE应用的么,怎么研究起rootkit来了(研究系统漏洞,安全攻防之类的东东), 跟他聊了聊,他说刚买了本书Rootkits,    (http://www.china-pub.com/computers/common/info.asp?id=34713)在研究呢, 然后我就推荐了他本书Malware - Fighting Malicious Code ,据说是国外安全教程的101课程(不过我自己都没看)。这些书在emule上都有的下, 晕阿,怎么居然玩起安全来了。

 
2007-09-19 01:28

   Amazon's practices and architecture:

  http://www.37signals.com/svn/posts/600-secrets-to-amazons-success,

 
     
 
 
个人档案
 
femtowin

上次登录:
23天前
加为好友
 
   
 
最新照片
 
   
 
最新评论
 
     
 
最近访客
 
 

暮色渲染

yangshazi

mlzboy

asd8010553

dingze2004

pingasi

ideawu

fortianwei
     
 
其它
 
已有人次访问本空间
 
订阅RSS  什么是RSS?

您也想拥有这样的空间?请点此申请。
     


©2009 Baidu