100个常用的VIM命令

Basics

 

:e filename Open filename for edition
:w Save file
:q Exit Vim
:w! Exit Vim without saving

Search

 

/word Search word from top to bottom
?word Search word from bottom to top
/jo[ha]n Search john or joan
/\< the Search the, theatre or then
/the\> Search the or breathe
/\< the\> Search the
/\< ¦.\> Search all words of 4 letters
/\/ Search fred but not alfred or frederick
/fred\|joe Search fred or joe
/\<\d\d\d\d\> Search exactly 4 digits
/^\n\{3} Find 3 empty lines
:bufdo /searchstr/ Search in all open files

Replace

 

:%s/old/new/g Replace all occurences of old by new in file
:%s/old/new/gw Replace all occurences with confirmation
:2,35s/old/new/g Replace all occurences between lines 2 and 35
:5,$s/old/new/g Replace all occurences from line 5 to EOF
:%s/^/hello/g Replace the begining of each line by hello
:%s/$/Harry/g Replace the end of each line by Harry
:%s/onward/forward/gi Replace onward by forward, case unsensitive
:%s/ *$//g Delete all white spaces
:g/string/d Delete all lines containing string
:v/string/d Delete all lines containing which didn’t containstring
:s/Bill/Steve/ Replace the first occurence of Bill by Steve in current line
:s/Bill/Steve/g Replace Bill by Steve in current line
:%s/Bill/Steve/g Replace Bill by Steve in all the file
:%s/\r//g Delete DOS carriage returns (^M)
:%s/\r/\r/g Transform DOS carriage returns in returns
:%s#<[^>]\+>##g Delete HTML tags but keeps text
:%s/^\(.*\)\n\1$/\1/ Delete lines which appears twice
Ctrl+a Increment number under the cursor
Ctrl+x Decrement number under cursor
ggVGg? Change text to Rot13

Case

 

Vu Lowercase line
VU Uppercase line
g~~ Invert case
vEU Switch word to uppercase
vE~ Modify word case
ggguG Set all text to lowercase
:set ignorecase Ignore case in searches
:set smartcase Ignore case in searches excepted if an uppercase letter is used
:%s/\<./\u&/g Sets first letter of each word to uppercase
:%s/\<./\l&/g Sets first letter of each word to lowercase
:%s/.*/\u& Sets first letter of each line to uppercase
:%s/.*/\l& Sets first letter of each line to lowercase

Read/Write files

 

:1,10 w outfile Saves lines 1 to 10 in outfile
:1,10 w >> outfile Appends lines 1 to 10 to outfile
:r infile Insert the content of infile
:23r infile Insert the content of infile under line 23

File explorer

 

:e . Open integrated file explorer
:Sex Split window and open integrated file explorer
:browse e Graphical file explorer
:ls List buffers
:cd .. Move to parent directory
:args List files
:args *.php Open file list
:grep expression *.php Returns a list of .php files contening expression
gf Open file name under cursor

Interact with Unix

 

:!pwd Execute the pwd unix command, then returns to Vi
!!pwd Execute the pwd unix command and insert output in file
:sh Temporary returns to Unix
$exit Retourns to Vi

Alignment

 

:%!fmt Align all lines
!}fmt Align all lines at the current position
5!!fmt Align the next 5 lines

Tabs

 

:tabnew Creates a new tab
gt Show next tab
:tabfirst Show first tab
:tablast Show last tab
:tabm n(position) Rearrange tabs
:tabdo %s/foo/bar/g Execute a command in all tabs
:tab ball Puts all open files in tabs

Window spliting

 

:e filename Edit filename in current window
:split filename Split the window and open filename
ctrl-w up arrow Puts cursor in top window
ctrl-w ctrl-w Puts cursor in next window
ctrl-w_ Maximise current window
ctrl-w= Gives the same size to all windows
10 ctrl-w+ Add 10 lines to current window
:vsplit file Split window vertically
:sview file Same as :split in readonly mode
:hide Close current window
:­nly Close all windows, excepted current
:b 2 Open #2 in this window

Auto-completion

 

Ctrl+n Ctrl+p (in insert mode) Complete word
Ctrl+x Ctrl+l Complete line
:set dictionary=dict Define dict as a dictionnary
Ctrl+x Ctrl+k Complete with dictionnary

Marks

 

mk Marks current position as k
˜k Moves cursor to mark k
d™k Delete all until mark k

Abbreviations

 

:ab mail mail@provider.org Define mail as abbreviation of mail@provider.org

Text indent

 

:set autoindent Turn on auto-indent
:set smartindent Turn on intelligent auto-indent
:set shiftwidth=4 Defines 4 spaces as indent size
ctrl-t, ctrl-d Indent/un-indent in insert mode
>> Indent
<< Un-indent

Syntax highlighting

 

:syntax on Turn on syntax highlighting
:syntax off Turn off syntax highlighting
:set syntax=perl Force syntax highlighting

如何用彩虹表破解MD5、LM Hash等复杂加密密码

一、什么是彩虹表?
彩虹表(Rainbow Tables)就是一个庞大的、针对各种可能的字母组合预先计算好的哈希值的集合,不一定是针对MD5算法的,各种算法的都有,有了它可以快速的破解各类密码。越是复杂的密码,需要的彩虹表就越大,现在主流的彩虹表都是100G以上。

二、上哪找彩虹表去?
现在有很多大牛已经把自己的彩虹表共享出来了,所以你可以去下载。还有一种方法就是自己通过工具生成。
不过自己生成有点不切合实际,生成小的彩虹表吧数据少,可以破解密码的位数少(复杂程度低),而且费时费力,4核4GB内存的机器,生成2GB彩虹表,需要花费7天时间,而7天按1MB的带宽(160K/S左右)几乎可以下载30GB左右。
生成的工具可以用RainbowCrack也可以用Cain。网上很容易搜索到下载地址的。

下载彩虹表:

1、MD5的彩虹表
工具推荐:Free Rainbow Tables
ftp:
ftp://tbhost.eu/
user:download
pass:Tx50AbsBHq7Nya7n9weW
http:
http://tbhost.eu/rt.php
http://freerainbowtables.mirror.garr.it/mirrors/freerainbowtables/
提供了多种类型的彩虹表下载,LM、NTLM、MD5、SHA1等。千万别把人家法语字符的表也下了,对国人来说,几乎没什么用,不过如果你有特殊需要,那就下吧……这里提供的都是.rti格式的,有别于传统的.ri格式,.rti比.rt的多了一个目录.index文件,据说遍列速度比.rt的更快(未曾对比过,无法确定是否属实)。把你想要用的那个表下载下来,然后下载读取彩虹表的工具:rcracki_mt.exe
把此工具及相关的dll文件复制到彩虹表所在目录,然后运行命令“F:\MD5>rcracki_mt.exe -h 3787795aeee01c9ab7267f252c932572 *.rti”就会开始破解(只能是32位密文)。漏洞之家http://bbs.3344.eu

2、LM-HASH的彩虹表(Windows登录密码)
工具推荐:ophcrack
http://ophcrack.sourceforge.net/download.php
这个是Ophcrack XP Special Tables。一般非Vista的密码Hash,用它能破绝大部分,但在使用过程中也有发现有小部分Hash正确,但无法破解的。
这是Ophcrack Vista Special NTHASH的。官方是收费的表,不过国外共享了,也就可以免费得到了。如果这些表都跑不出来,而你又确定你的Hash没有搞错的话,那么只能找LC5出马了,LC5是一定能破的,只是时间有点久!
其他工具还有一些,大家自己找找吧。不过这两个是经典的常用彩虹表。CMD5,或者Xmd5网站都开始收费了。大家还是自己拿机器跑吧!

Chrome扩展Vimium按键列表

From https://github.com/philc/vimium/blob/master/README.markdown

注意!!!所有快捷键使用钱请关闭中文输入法!!!

Keyboard Bindings

键盘绑定

Modifier keys are specified as  , , for ctrl+x, meta+x, and alt+x respectively. See the next section for instructions on modifying these bindings.

修饰符键用类似于 (ctrl+x) (meta+x), (alt+x)的标记指明。下一个章节介绍修改这些绑定的方法。

Navigating the current page:

在当前页面内导航

? show the help dialog for a list of all available keys

显示可用的按键帮助列表
h scroll left

向左滚动
j scroll down

向下滚动
k scroll up

向上滚动
l scroll right

向右滚动
gg scroll to top of the page

滚动到页面顶端
G scroll to bottom of the page

滚动到页面底端
d scroll down half a page

向下滚动半页  //这里的半页指的是屏幕显示的页面高度的一半,下同
u scroll up half a page

向上滚动半页
f open a link in the current tab

在当前Tab打开链接  //前提是链接本身没有New Tab
F open a link in a new tab

在新Tab中打开链接
r reload

刷新
gs view source

查看源代码
i enter insert mode — all commands will be ignored until you hit esc to exit

进入编辑模式 — 会忽略所有的命令,直到你点击Esc键来退出编辑模式
yy copy the current url to the clipboard

复制当前链接到剪贴板  //当前链接指的是当前网页的链接
yf copy a link url to the clipboard

复制当前页面的一个链接到剪贴板
gf cycle forward to the next frame

这个没明白是干什么的。。。

Using find:

使用查找

/ enter find mode — type your search query and hit enter to search or esc to cancel

进入查找模式 — 输入你要搜索的词汇并敲击回车来进行查找,敲击Esc取消查找。
n cycle forward to the next find match

向后循环查找匹配的字串
N cycle backward to the previous find match

向前循环查找匹配的字串

Navigating your history:

在浏览历史中导航  //因为我装了Better History插件,所以这两个键没有试验是干嘛的。只是按英文直译。

H go back in history

回退
L go forward in history

前进

Manipulating tabs:

操纵标签

J, gT go one tab left

到左边一个标签。逗号是or的意思。下同。
K, gt go one tab right

到右边一个标签。
g0 go to the first tab

到第一个标签。
g$ go to the last tab

到最后一个标签。
t create tab

新建标签。
x close current tab

关闭当前标签。
X restore closed tab (i.e. unwind the ‘x’ command)

恢复关闭的标签。(即取消’x’命令)

Additional advanced browsing commands:

附加的高级浏览命令  //这几个不翻译了因为不知道是要干什么。。。改天试试再说。

]] Follow the link labeled ‘next’ or ‘>’. Helpful for browsing paginated sites.
[[ Follow the link labeled ‘previous’ or ‘ open multiple links in a new tab
gi focus the first (or n-th) text input box on the page
gu go up one level in the URL hierarchy
zH scroll all the way left
zL scroll all the way right
Vimium supports command repetition so, for example, hitting ‘5t’ will open 5 tabs in rapid succession. ESC (or) will clear any partial commands in the queue and will also exit insert and find modes.

Vimium支持命令重复,例如敲击’5t’将会快速连续打开5个窗口。ESC 会清除队列中部分指令并且会同时退出插入和搜索模式。

Custom Key Mappings

自定义按键表

You may remap or unmap any of the default key bindings in the “Key mappings” section under “Advanced Options” on the options page.

你可以在 选项 页面的”Advanced Options”,”Key mappings”中重映射或者取消任何默认的按键绑定。

Enter one of the following key mapping commands per line:

每行出入下列按键映射指令的一个:

map key command: Maps a key to a Vimium command. Overrides Chrome’s default behavior (if any).

把一个键映射到Vimiun命令。覆盖Chrome的默认按键设置(如果有)。
unmap key: Unmaps a key and restores Chrome’s default behavior (if any).

取消一个按键的映射并恢复Chrome的默认设置(如果有)。
unmapAll: Unmaps all bindings. This is useful if you want to completely wipe Vimium’s defaults and start from scratch with your own setup.

取消所有按键映射。这条语句在你想完全抹除Vimiun的默认设置并且想从头开始时使用。
Examples:

例:

map scrollPageDown maps ctrl+d to scrolling the page down. Chrome’s default behavior of bringing up a bookmark dialog is suppressed.

把 ctrl+d按键的动作映射到向下滚动页面。Chrome默认的加入到书签的快捷键会被覆盖。
map r reload maps the r key to reloading the page.

把r键映射为刷新页面。
unmap  removes any mapping for ctrl+d and restores Chrome’s default behavior.

取消ctrl+d的任何映射并恢复Chrome的默认设置。
unmap r removes any mapping for the r key.

取消r键的任何映射。
Available Vimium commands can be found via the “Show Available Commands” link near the key mapping box. The command name appears to the right of the description in parenthesis.

提供的Vimiun命令可通过单机key mapping box旁边的”Show Available Commands”查看。命令的名字写在在命令描述右边的括号中。

You can add comments to your key mappings by starting a line with ” or #.

你可以在你的键位映射中用”或#来编写注释。

The following special keys are available for mapping:

下面这些特殊的功能键可以用来映射:

 for ctrl, alt, and meta (command on Mac) respectively with any key. Replace * with the key of choice.

 分别表示 ctrl, alt, and meta (Mac 上的特殊键) 加上任意键. 用你想用的按键替换*。
 for the arrow keys

 代表方向键。
 through  for the function keys

 到 代表键盘顶部的功能键。
Shifts are automatically detected so, for example,  corresponds to ctrl+shift+7 on an English keyboard.

Shift键可以自动检测到。比如: 在英语键盘上对应 ctrl+shift+7