virtualbox port forwarding

copied from the manual….

As the virtual machine is connected to a private network internal to VirtualBox and invisible to the host, network services on the guest are not accessible to the host machine or to other computers on the same network. However, like a physical router, VirtualBox can make selected services available to the world outside the guest through port forwarding. This means that VirtualBox listens to certain ports on the host and resends all packets which arrive there to the guest, on the same or a different port.

To an application on the host or other physical (or virtual) machines on the network, it looks as though the service being proxied is actually running on the host. This also means that you cannot run the same service on the same ports on the host. However, you still gain the advantages of running the service in a virtual machine — for example, services on the host machine or on other virtual machines cannot be compromised or crashed by a vulnerability or a bug in the service, and the service can run in a different operating system than the host system.

You can set up a guest service which you wish to proxy using the command line tool VBoxManage; for details, please refer to the section called “VBoxManage modifyvm”.

You will need to know which ports on the guest the service uses and to decide which ports to use on the host (often but not always you will want to use the same ports on the guest and on the host). You can use any ports on the host which are not already in use by a service. For example, to set up incoming NAT connections to an ssh server in the guest, use the following command:

VBoxManage modifyvm "VM name" --natpf1 "guestssh,tcp,,2222,,22"

With the above example, all TCP traffic arriving on port 2222 on any host interface will be forwarded to port 22 in the guest. The protocol name tcp is a mandatory attribute defining which protocol should be used for forwarding (udp could also be used). The name guestssh is purely descriptive and will be auto-generated if omitted. The number after --natpf denotes the network card, like in other parts of VBoxManage.

To remove this forwarding rule again, use the following command:

VBoxManage modifyvm "VM name" --natpf1 delete "guestssh"

If for some reason the guest uses a static assigned IP address not leased from the built-in DHCP server, it is required to specify the guest IP when registering the forwarding rule:

VBoxManage modifyvm "VM name" --natpf1 "guestssh,tcp,,2222,10.0.2.19,22"

This example is identical to the previous one, except that the NAT engine is being told that the guest can be found at the 10.0.2.19 address.

To forward all incoming traffic from a specific host interface to the guest, specify the IP of that host interface like this:

VBoxManage modifyvm "VM name" --natpf1 "guestssh,tcp,127.0.0.1,2222,,22"

This forwards all TCP traffic arriving on the localhost interface (127.0.0.1) via port 2222 to port 22 in the guest.

It is not possible to configure incoming NAT connections while the VM is running. However, you can change the settings for a VM which is currently saved (or powered off at a snapshot).

移动XP不欢迎的驱动

1. iastor.sys  。这是某些机器上的SATA驱动,没它不行,但这个驱动存在一个BUG,如果没有合适的硬件,加载它就可能会导致系统蓝屏。因此把它集成到WINXP的安装盘,安装系统时,在另一种硬件下,集成的安装盘就不能用了,会蓝屏死机。解决办法:修改iastor.sys,把引发蓝屏的那一条释放内存语句跳过。可能会造成一点点内存泄漏,但这无所谓了。

2. intelppm。intel CPU的驱动。换到amd下时,它会引发蓝屏。解决办法:sc config intelppm start= demand 。 设为手动启动。

此外,遇到一个问题,系统设置的分辨率太高,启动的显示器提示分辩率太高,看不到任何东西。这样也无法修改分辨率。。。解决办法:启动到PE,挂接注册表。删除相关的硬件配置:
\SYSTEM\ControlSet001\Control\Video
\SYSTEM\ControlSet001\Hardware Profiles\000?\System\CurrentControlSet\Control\VIDEO

Internet连接共享(ICS)命令行设置

因为有些原因要用到ICS。想用命令行启用ICS,GOOGLE了一番,没有结果,有的人信势旦旦的说用netsh可以做到,通过对比开启ICS前和ICS后的netsh dump文件发现,这两个根本就没有本质区别,换句话说,netsh不可能开启ICS。

于是对比注册表,注册表太大,只对比了开启ICS前后的Current Control Set,也没有发现本质区别,换句话说,改注册表可能不能启用ICS,或者很难,不知道信息存在哪里。(我猜是不在注册表里的)

没办法了,使出万能法宝,一定可以成功的调试器。ollydbg威武出场,调试了一下,通过网卡属性设置ICS时,调用了hnetcfg里的COM接口。用oleview一看,嘿,这dll还提供了比较不错的idl信息,还是基于IDispatch接口的,也就是说,可以用脚本调用。于是改换方向,用这个IDL里面的关键字,继续google。这下就找到了。

用起来还挺简单: cscript  /nologo ics.vbs “private interface name” “public interface name”

key word: CONNECTION_PUBLIC  CONNECTION_PRIVATE  EnableSharing

经验教训:

  1. 搜命令行或Command line 之类的关键词找不到结果时,要试一下script, vbs之类的关键字。
  2. 搜这种词的时候,google还是挺垃圾的,我是用google.com/ncr搜的,还是难以找到。
  3. 互联网上的垃圾信息越来越多了,想要的有深度的内容会越来越不好找。
  4. 一边研究一边google的做法,目前还是比较好用的。想当年为了把windows(不是WINPE)装到移动硬盘上,并且可以在任意一台电脑上启动系统并使用系统,就是用研究再加搜索的方法,研究到80%,知道了一堆的keyword,也就容易找到相同的问题和解决方案了,否则找到的都是垃圾。

ics.vbs 下载

升级wordpress到2.9.1

跟上次不一样,这一次用了自己做的merge工具,有了merge工具,升级不愁了。。。

再也不怕丢失自己的修改了。

关于时间转换

1. 在excel里显示time_t类型的时间(1970-1-1到现在的秒数):  设数字在B1格中,先输入工式: =(E1+8*3600)/(24*3600)+25569,然后设置单元格选项为日期类型即可。

2. 得到当前的time_t秒数,这在程序中很容易,在linux命令下,可以用 data +%s 命令得到。

3. 在linux命令行下把数值转化为时间: 设目前秒数是1260796354,则命令为:
data -d @1260796354

当然,这些都是命令行或软件使用中的。在程序中,那是非常方便的转换。

symantec的smc.exe防杀原理

偶尔打开冰刃就发现了,其原理好简单,用了wpsdrvnt.sys修改了ssdt中的几个函数,主要是关进程和内存修改的相关函数,用来保护smc.exe。所以要想自由的开关smc,只需要禁用wpsdrvnt就行了:

sc config wpsdrvnt start= disabled

重启即可。

这样不会影响他的产品的其它功能。

宽带连接不见了

囧,把Remote Access Connection Manager的image path从svchost.exe改成svchost1.exe后,(已经把svchost.exe copy一份到svchost1.exe) , 宽带连接就不见了。

还能创建宽带拨号连接,但不能和之前创建的重名,创建后也看不到。

查了不少时间,才想起做了这一改动,改回去重启,果然又出现了。

微软真搞笑,还有检查这一名字的。

同时发现,创建的这些宽带拨号连接,都保存在 C:\Documents and Settings\All Users\Application Data\Microsoft\Network\Connections\Pbk 下的 rasphone.pbk 里。而不是在注册表。

关windows自动运行的一种暴力方式

关windows自动运行倒底有几种方法,我是说不清了。至少有一种是从组策略里关。不过这样关还不彻底,程序是不会自动运行了,但是右键菜单里还有,还会加载光驱的图标。不保险。

有一种暴力的方式是,直接让windows不去读取 autorun.ini, 这样光盘自定义的图标都不会显示出来,只显示默认光驱图标的。其原理是,利用windows已经有的重定向ini的技术,把ini重定向到注册表中的一个不存在的分支,从而破坏自动运行机制。

实现步骤:把以下内容存成 anti-autorun.reg ,导入到注册表即可。或者简单一点,直接点此下载运行

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\IniFileMapping\autorun.inf]
@=”#USR:Software\\Microsoft\\Non_exist_node”

招商银行关远程桌面之原理与解决方案

招商银行网上银行客户端关远程桌面,已经不是一天两天了,任用户怎么骂也没有用。它就是要关。

不过,在我这xp sp3上,它却没有关掉。很奇怪。但同一个招行专业版,都是最新的MG5.5.1.2,在win2k3上还是一样关我的远程。

远程桌面我并不常用,但偶尔想用时发现被招行关了也挺麻烦的。所以就研究了一下它的原理。发现其实挺简单的:

右击我的电脑=>属性=>远程,在这里,如果勾上允许远程 连接并应用,则注册表

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server

下的fDenyTSConnections为0,如果去掉勾并应用,则为1.

同样,如果在regedit里把fDenyTSConnections改为1,则远程 那里的允许远程连接的勾被去除。如果设为0,则勾被启用。这样即可看出,招行就是改了一下这个注册表项而已。所以相应地,就会有以下这些解决方案:

  1. 修改招行客户端,使它不修改这个注册表项。(我想修改完后招行客户端可能就运行不起来了,就算可以运行也没有人敢运行了)
  2. 修改远程桌面的服务端,让它不读取这个注册表值,或者读取完后不判是否为1. 这个方案是可行的而且比较好的。不过我不常用远程,就懒 得折腾了。
  3. 啥也不改,每次要远程连接之前,远程修改一下注册表项,就可以连了。

对于我这种不常用远程的人来说,方案3最好用。于是每次远程前,执行以下命令:

net use “\\home\ipc$” * /user:administrator reg add ”\\home\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server“  /v  fDenyTSConnections /t REG_DWORD /d 0 /f

注意:这里的home是连接的机器名或IP。如果你要连的机器名叫abcdef,就把home改为abcdef

就可以了,修改是即时生效的,可能是远程桌面服务端在不停的读取注册表。这种方案需要打开远程注册表服务,对于原版windows是默认打开的,对于精简版即俗称野鸡版的,有没有这个服务都难说,如果有就要手动打开。这个服务并不危险,相对于开了远程服务的人来说。

常用远程的人可以试一下方法2。肯定有办法做到的。

此外,在此之前曾想过设置注册表权限禁止修改fDenyTSConnections 值,结果发现不行。招行网银客户端直接报错退出。

QQ验证码老是输不对的原因

这些天,很多朋友碰到了一个问题,就是在QQ登录时,碰到需要输入验证码,可是输入正确后,却要继续输入,可能要好多次才好,据说还有人连续输入30次都不对。由此,由不断的通不过,陷入不断输入的循环,简直让人崩溃。

今天终于知道了原因。原来,现在所有恶意行为,包括发送垃圾消息,查QB、消费QB、修改密码等,都是纯手工行为。 雇佣1 个人,每天50 元(含吃住),可以输入2W 次验证码,假设平均输入3 次验证码成功登录1 次,可以发出10 条诈骗消息,上当的比例是1/10000 ,如果上当,则获利300 元。那么每雇佣一人平均获利2W*10*300/3/1W=2K 元,假设平均输入3 次验证码可以查询一个QB ,QB 3 折,那么雇佣1 人平均获利2W*0.1*5*0.3/3=1K 元 。

 因此,TX对这些人也进行打击,当怀疑一个IP是恶意IP时,会对其进行限制,使n次输入只有一次真正算对,这样,就会有人连续很多次不能正确输入验证码了。

那为什么一个用户的IP会被认为是恶意IP呢?除了程序出错引起的BUG,则通常是另一种情况:

原来,现在雇人手动输入验证码的家伙也是很聪明的,你限IP我就变IP。ADSL网络有个特点,断开重新播号,IP就变了。那这个旧IP哪去了呢?被ISP搞去分给别人了,那个被分到的家伙就倒霉了,重复输入好多次验证码才会进得去了。

这简直是一套七伤拳啊,杀敌三分,自损七分。虽然确实可以杀敌。

想要摆脱这种老是输入的局面也有招,参考解决方案:

  1. 重新播放,换IP上,也许马上就可以上了。
  2. 停一停,过一个小时再来上,由于这个IP闲了下来,会渐渐被排除恶意,也许就上得去了。