Sunday, December 6, 2009

Open Shortest Path First Protocol

As an industry standard link-state protocol, Open Shortest Path First (OSPF) is classified as an interior gateway protocol with advanced features. The OSPF Packet format is shown in Figure 6.26; the format fields are defined as follows:

Mask. Lists current interface network mask.

Interval. Gives Hello packet interval in seconds.



Mask


Interval


Opt


Priority


Dead


DR


BDR


Neighbor













Interval












Figure 6.26 OSPF format.



Opt. Lists router's optional capabilities.

Priority. Indicates this router's priority; when set to 0, disables the designation ability.

Dead Interval. Specifies router-down interval in seconds.

DR. Lists the current network's designated router.

BDR. Lists the current network's backup designated router.

Neighbor. Gives the router IDs for participating Hello router packet transmissions.

Important Commands



The material in this section is essential for any aspiring hacking guru. It covers all aspects of important deep-rooted DOS commands, from the beginning of hacking history.



To begin, keep in mind that the DOS operating system serves as a translator between you and your computer. The programs in this operating system allow you to communicate with your computer, disk drives, and printers. Some of the most popular operating systems today run on top of DOS as a graphical user interface (GUI) front end.This means that DOS helps you to manage programs and data. Once you have loaded DOS into your computer's memory, your system can load a GUI front end, such as Windows, which can help you compose letters and reports, run programs, and use devices such as printers and disk drives.

The contents of this command section are based on my original work, compiled over 10 years ago for the original Underground community, and distributed only to a very select group of people. Note that some of these commands have since been blocked and/or removed, and therefore are not compatible with different versions of GUI operating systems.



The command options in this section include:

drive. Refers to a disk drive.

path. Refers to a directory name.

filename. Refers to a file, and includes any filename extension.

pathname. Refers to a path plus a filename.

switches. Indicates control DOS commands; switches begin with a slash (/).

arguments. Provide more info on DOS commands.

string. A group of characters: letters, nubers, spaces, and other characters.

items in square brackets []. Indicates optional items. Do not type the brackets themselves.

ellipsis (... ). Indicates you can repeat an item as many times as necessary.





Append

Append sets a search path for data files. Syntax

First time used (only):

append [/x] [/e]

To specify directories to be searched:

append [drive:]path[;[drive:][path]... ]



To delete appended paths:



append;



Comments



The append command accepts switches only the first time the command is invoked. Append accepts these switches:

/x Extends the search path for data files. DOS first searches the current directory for data files. If DOS doesn't find the needed data files there, it searches the first directory in the append search path. If the files are still not found, DOS continues to the second appended directory, and so on. DOS will not search subsequent directories once the data files are located.

/e Causes appended directories to be stored in the DOS environment.

You can specify more than one path to search by separating each with a semicolon (;). If you type the append command with the path option a second time, DOS discards the old search path and uses the new one. If you don't use options with the append command, DOS displays the current data path. If you use the following command, DOS sets the NUL data path:



append ;



This means that DOS searches only the working directory for data files.



Notes



You can use the append command across a network to locate remote data files. Also note the following:

If you are using the DOS assign command, you must use the append command first

If you want to set a search path for external commands, see the path command.



Example



Suppose you want to access data files in a directory called letters (on drive B), and in a directory called reports (on drive A). To do this, use the following:

append b:\letters;a:\reports Assign

This command assigns a drive letter to a different drive. Syntax

assign [x[ = ]y[... ]]

Where x is the drive that DOS currently reads and writes to, and y is the drive that you want DOS to read and write to.



Comments



The assign command lets you read and write files on drives other than A and B for applications that use only those two drives. You cannot assign a drive being used by another program, and you cannot assign an undefined drive. Do not type a colon (:) after the drive letters x and y.

Example

To reset all drives to their original assignments, type the following:

assign

Attrib

Attrib displays or changes the attributes of selected files.

Syntax

attrib [+-r] [+-a] [drive:]pathname [/s] Where:

+r sets the read-only attribute of a file.

-r disables read-only mode.

+a sets the archive attribute of a file.

-a clears the archive attribute of a file.



Comments



The attrib command sets read-only and/or archive attributes for files. You may use wildcards to specify a group of files. Attrib does not accept a directory name as a valid filename. The drive and pathname specify the location of the file or files. The /s switch processes all subdirectories as well as the path specified.



The backup, restore, and xcopy commands use the archive attribute as a control mechanism. You can use the +a and -a options to select files that you want to back up with the backup /m command, or copy with xcopy /m or xcopy /a.



Example



To display the attribute of a file called report on the default drive, type the following:



attrib report







Backup

This command backs up one or more files from one disk to another.

Syntax

backup [drive1:][path]filename] [drive2:] [/s][/m][/a][/f] [/d:date

]

[/t:time] [/L:[[drive:][path]filename]]



Where drive1 is the disk drive that you want to back up, and drive2 is the target drive to which the files are saved.



Comments



The backup command can back up files on disks of different media (hard disks and floppy). Backup also backs up files from one floppy disk to another, even if the disks have a different number of sides or sectors. Backup switches are:

/s Backs up subdirectories.

/m Backs up only those files that have changed since the last backup.

/a Adds the files to be backed up to those already on a backup disk.

/f Causes the target disk to be formatted if it is not already. The command format

must be in the path.

/d:date Backs up only those files that you last modified on or after date listed.
/t:time Backs up only those files that you last modified at or after time listed.

/L:filename Makes a backup log entry in the specified file.



Example



To back up all the files in the directory C:\letters\bob to a blank, formatted disk in drive A, type:

backup c:\letters\bob a: Break

Break sets the Control-C check.

Syntax

break [on] break [off]



Comments



Depending on the program you are running, you may use Control-C to stop an activity (for example, to stop sorting a file). Normally, DOS checks to see whether you press Control-C while it is reading from the keyboard or writing to the screen. If you set break on, you extend Control-C checking to other functions, such as disk reads and writes.



Example



To check for Control-C only during screen, keyboard, and printer reads and writes, type the following:

break off Chcp

Chcp displays or changes the current code page for command.com.

Syntax



chcp [nnn]



Where nnn is the code page to start.



Comments



The chcp command accepts one of the two prepared system code pages as a valid code page. An error message is displayed if a code page is selected that has not been prepared for the system. If you type the chcp command without a code page, chcp displays the active code page and the prepared code pages for the system.



You may select any one of the prepared system code pages defined by the country command in config.sys. Valid code pages are:

437 United States

850 Multilingual

860 Portuguese

863 French-Canadian

865 Nordic



Example

To set the code page for the current screen group to 863 (French-Canadian), type: chcp 8 63 Chdir (CD)

This command changes the directory to a different path.

Syntax

chdir [path] cd [path]



Example



Suppose you have a directory called one that has a subdirectory called two. To change your working directory to \one\two, type:



cd \one\two

A quick way to return to the parent directory (one) is to type: cd..



To return to the root directory (the highest-level directory), type:

cd\

Chkdsk

Chkdsk scans the disk in the specified drive for info.

Syntax



chkdsk [drive:][pathname] [/f] [/v]

The chkdsk command shows the status of your disk. You should run chkdsk occasionally on each disk to check for errors. If you type a filename after chkdsk, DOS displays a status report for the disk and for the file.



The chkdsk command accepts the following switches:

/f Fixes errors on the disk.

/v Displays the name of each file in each directory as it checks the disk. Example

If chkdsk finds errors on the disk in drive C, and you want to try to correct them, type the following:

chkdsk c: /f Cls

Cls clears the screen. Syntax cls

Comment

The cls command clears your screen, leaving only the DOS prompt and a cursor. Command

Command starts the command processor.

Syntax

command [drive:][path][ctt-dev] [/e:nnnnn][/p] [/c string]



Comments



When you start a new command processor, you also create a new command environment. The command processor is loaded into memory in two parts, transient and resident. Some applications write over the transient memory part of command.com when they run. When this happens, the resident part of the command processor looks for the command.com file on disk so that it can reload the transient part.



The drive:path options tell the command processor where to look for the command.com. Valid switches are:



/e:nnnnn Specifies the environment size, where nnnnn is the size in bytes.

/p Keeps the secondary command processor in memory, and does not automatically

return to the primary command processor.

/c string Tells the command processor to perform the command or commands specified by string, then return automatically to the primary command processor.

Example

This command:

command /c chkdsk b:



tells the DOS command processor to:

Start a new command processor under the current program. Run the command chkdsk B: Return to the command processor.

Comp

Comp compares the contents of two sets of files.

Syntax

comp [drive:][pathname1] [drive:][pathname2] Comments

The comp command compares one file or set of files with a second file or set of files. These files can be on the same drive or on different drives. They can also be in the same directory or different directories.



If you don't type the pathname options, comp prompts you for them.



Example



In this example, comp compares each file with the extension .wk1 in the current directory on drive C with each file of the same name (but with an extension .bak) in the current directory on drive B.

comp c:*.wk1 b:*.bak

Copy

This command copies files to another location. It also appends files.

Syntax



To copy:



copy [drive:]pathname1 [drive:][pathname2] [/v][/a][/b] copy [drive:]pathname1 [/v][/a][/b] [drive:][pathname2]



To append:



copy pathnamel + pathname2 [... ] pathnameN

The copy command accepts the following switches:



/v Causes DOS to verify that the sectors written on the target disk are recorded properly.



/a Lets you copy ASCII files. This switch applies to the filename preceding it and to all remaining filenames in the command, until copy encounters another /a or /b switch.

/b Lets you copy binary files. This switch applies to the filename preceding it and to all remaining filenames in the command, until copy encounters another /a or /b switch. This switch tells the command processor to read the number of bytes specified by the file size in the directory.



Examples



To copy a file called letter.doc from your working drive directory to a directory on drive C called docs, type:



copy letter.doc c:\docs



You can also combine several files into one by:



copy *.doc combine.doc

This takes all the files with an extension .doc and combines them into one file named combine.doc. Ctty

Ctty lets you change the device from which you issue commands. Syntax

ctty device

Where device specifies the device from which you are giving commands to DOS. Comments

Ctty is useful if you want to change the device on which you are working. The letters tty represent your terminal—that is, your computer screen and keyboard.



Examples



The following command moves all command I/O from the current device (the console) to an AUX port, such as another terminal:



ctty aux



The next command moves I/O back to the console screen and keyboard:



ctty con

Date

Date enters or changes the date.

Syntax

date [mm-dd-yy] Comments

Remember to use only numbers when you type the date. The allowed numbers are:

mm = 1-12

dd=1-31

yy = 80-79 or 1980-2079

The date, month, and year entries may be separated by hyphens (-) or slashes (/). Example

To display the current date type:

date



The current date will appear with the option to change the date. If you do not want to change the date shown, simply press Return.



Del(Erase)



This command deletes (or erases) all files specified by the drive and pathname.



Syntax

del [drive:]pathname erase [drive:]pathname

Comment



Once you have deleted a file from your disk, you cannot easily recover it.

Examples

The following deletes a file named report:

del report

Suppose you have files named report.jan, report.feb, report.mar, report.apr, report.may, and so on. To erase them all type:



del report.*



Dir

Dir lists the files in a directory.

Syntax

dir [drive:][pathname][/p][/w]

Comments

The dir command, typed by itself, lists all directory entries in the working directory on the default drive. If you include a drive name, such as dir b:, all entries in the default directory of the disk in the specified drive will be listed.



The dir command accepts the following switches:



/p Page mode; causes the directory display to pause once the screen is filled. To resume, press any key.

/w Wide mode; causes the directory display to fill the screen, up to five files per line. This does not pause if the whole screen is filled.

Dir lists all files with their size in bytes and the time and date of the last modification. Example

If your directory contains more files than you can see on the screen at one time, type:

dir /p



Diskcomp



Diskcomp compares the contents of one disk to another.

Syntax

diskcomp [drivel:] [drive2:] [/l] [/8] Comments

Diskcomp performs a track-by-track comparison of the disks. It automatically determines the number of sides and sectors per track, based on the format of the source disk.



The diskcomp command accepts the following switches:

/1 Causes diskcomp to compare just the first side of the disk.

/8 Causes diskcomp to compare just the first eight sectors per track.

Example

If your computer has only one floppy disk drive, and you want to compare two disks, type: diskcomp a:

Diskcopy

Diskcopy copies the contents of one disk to another. Syntax

diskcopy [drive:1] [drive2:]

Where drivel is the source drive, and drive2 is the target drive.

Comments

Drivel and Drive2 may be the same drive; simply omit the drive options. If the target disk is not formatted, diskcopy formats it exactly as the source disk.



The diskcopy command accepts the following switch:

• /1 Allows you to copy only one side of a disk.

Example

To copy the disk in drive A to the disk in drive B, type:



diskcopy a: b:



Exe2bin

Exe2bin converts executable files to a binary format. Syntax

exe2bin [drive:]pathname1 [drive:]pathname2 Where pathname1 is the input file, and pathname2 is the output file.

Comments



This command converts .exe files to binary format. If you do not specify an extension for pathname1, it defaults to .exe. The input file is converted to a .bin file format (a memory image of the program) and placed in the output file pathname2.



If you do not specify a drive name, exe2bin uses the drive of the input file. Similarly, if you do not specify an output filename, exe2bin uses the input filename. Finally, if you do not specify a filename extension in the output filename, exe2bin gives the new file the extension .bin.



Restrictions



The input file must be in valid .exe format produced by the linker. The resident or actual code and data part of the file must be less than 64 KB, and there must be no STACK segment.



Exit

This command exits the command.com program, and returns to a previous level, if one exists). Syntax exit Comment

If you use the DOS command program to start a new command processor, you can use the exit command to return to the old command processor.



Fastopen

Fastopen decreases the amount of time it takes to open frequently used files and directories. Syntax

fastopen [drive: [=nnn][... ]] Where nnn is the number of files per disk.

Comments

Fastopen tracks the location of files and directories on a disk for fast access. Every time a file or directory is opened, fastopen records its name and location. Then, if a file or directory recorded by fastopen is reopened, the access time is greatly reduced.

Note that fastopen needs 40 bytes of memory for each file or directory location it tracks. Example

If you want DOS to track the location of up to 100 files on drive C, type:

fastopen c:=100



Fc

Fc compares two files or two sets of files, and displays the differences between them. Syntax

For ASCII comparisons:



fc [/a] [/c] [/L] [/LB n] [/n] [/t] [/w] [/nnnn][drive:] pathname1[drive:]pathname2



For binary comparisons:



fc [/b] [/nnnn] [drive:]pathname1[drive:]pathname2



Where pathname1 is the first file that you want to compare, and pathname2 is the second file that you want to compare.



Comments



The fc command accepts the following switches:

/a Shows the output of an ASCII comparison. Instead of displaying all the lines that are

different, fc displays only the lines that begin and end each set of differences.



/b Forces a binary comparison of both files. Fc compares the two files byte by byte, with no

attempt to resynchronize after a mismatch. The mismatches are printed as follows:



xxxxxxxx: yy zz



where xxxxxxxx is the relative address from the beginning of the file of the pair of bytes. Addresses start at 00000000; yy and zz are the mismatched bytes from pathnamel and pathname2. The /b switch is the default when you compare .exe, .com, .sys, .obj, .lib, or .bin files.



/c Causes the matching process to ignore the case of letters. Fc then considers all letters in

the files as uppercase letters.



/L Compares the files in ASCII mode. This switch is the default when you compare files that

do not have extensions of .exe, .com, .sys, .obj, .lib, or .bin.



/LB Sets the internal line buffer to n lines. The default length is 100 lines. Files that have more than this number of consecutive, differing lines will abort the comparison.



/n. Displays the line numbers of an ASCII compare.



/t Does not expand tabs to spaces. The default is to treat tabs as spaces to eight-column

positions.

/w Causes fc to compress white space (tabs and spaces) during the comparison.

/nnnn Specifies the number of lines that must match after fc finds a difference between files.



Example

To compare two text files, called report.jan and report.feb, type:

fc /a report.jan report.feb Fdisk

Fdisk configures a hard disk for use with DOS.

Syntax

fdisk

Comments

The fdisk command displays a series of menus to help you partition your hard disk for DOS. With fdisk, you can:

Create a primary DOS partition.

Create an extended DOS partition.

Change the active partition.

Delete a DOS partition

Display partition data.

Select the next fixed disk drive for partitioning on a system with multiple fixed disks.



Find

Find searches for a specific string of text in a file or files. Syntax

find [/v] [/c] [/n] "string" [[drive:][pathname] ... ] Where ''string" is a group of characters for which you want to seek. Comments

String must be enclosed in quotation marks. Uppercase characters in string will not match lowercase characters you may be searching for.



The find command accepts the following switches:

/v Displays all lines not containing the specified string.

/c Displays only the number of lines that contain a match in each of the files.

/n Precedes each line with its relative line number in the file.



Example

The following displays all lines from the file pencil.ad that contains the string "Pencil Sharpener":

find "Pencil Sharpener" pencil.ad Format

This command formats the disk in the specified drive to accept files.

Syntax

format drive:[/1][/4][/8][/n:xx][/t:yy] /v][/s]

format drive:[/1][/b][/n:xx][/t:yy]

Comments

You must use format on all "new" disks before DOS can use them. Note that formatting destroys any previously existing data on a disk.

The format command accepts the following switches:

Formats a single side of the floppy disk.

Formats eight sectors per track.



Formats the disk, leaving ample space to copy an operating system.



Copies the operating system files to the newly formatted disk.

/t:yy Specifies the number of tracks on the disk. This switch formats 3-1/2 inch floppy disk to the number of tracks specified. For 720 KB disks and 1.44 MB disks, this value is 80 (/t:80).

/n:xx Specifies the number of sectors per track. This switch formats a 3-1/2 inch disk to the number of sectors specified. For 720 KB disks, this value is 9 (/n:9).

/v Causes format to prompt you for a volume label for the disk you are formatting. A volume label identifies the disk and can be up to 11 characters in length.





Example



To format a floppy disk in drive A, and copy the operating system to it, type:



format a: /s



Graftabl



Graftabl enables an extended character set to be displayed when using display adapters in graphics mode.



Syntax



graftabl [xxx] graftabl /status

Where xxx is a code page identification number. Comments

Valid code pages (xxx) include:

437 United States (default)

850 Multilingual

860 Portuguese

863 French-Canadian

865 Nordic

If you type the graftabl command followed by the /status switch, DOS displays the active character set.



Example

To load a table of graphics characters into memory, type:

graftabl

Graphics

Graphics lets you print a graphics display screen on a printer when you are using a color or graphics monitor adapter.



Syntax

graphics [printer] [/b][/p=port][/r][/lcd] Where printer is one of the following:



color1 Prints on an IBM Personal Computer Color Printer with black ribbon.

color4 Prints on an IBM Personal Computer Color Printer with red, green, blue, and black (RGB) ribbon.

color8 Prints on an IBM Personal Computer ColorPrinter with cyan, magneta, yellow, and

black (CMY) ribbon.

compact Prints on an IBM Personal Computer Compact printer. graphics Prints on an IBM Personal Graphics Printer or IBM Pro printer.



Comments

If you do not specify the printer option, graphics defaults to the graphics printer type. The graphics command accepts the following switches:



/b Prints the background in color. This option is valid for color4 and color8 printers.

/p=port Sets the parallel printer port to which graphics sends its output when you press the Shift-Print Screen key combination. The port may be set to 1, 2, or 3.The default is 1.

/r Prints black and white.

/lcd Prints from the LCD (liquid crystal display) on the IBM PC portable computer. Example

To print a graphics screen on your printer, type:



graphics



Join

This command joins a disk drive to a specific path.



Syntax



join [drive: drive:path] join drive: /d



Comments



With the join command, you don't need to give physical drives separate drive letters. Instead, you can refer to all the directories on a specific drive with one path. If the path existed before you gave the join command, you can use it while the join is in effect. But note, you cannot join a drive if it is being used by another process.



If the path does not exist, DOS tries to make a directory with that path. After you give the join command, the first drive name becomes invalid; and if you try to use it, DOS displays the "invalid drive" error message.



Examples

You can join a drive only with a root-level directory, such as:

join d: c:\sales To reverse join, type: join drive: /d Keyb

Keyb loads a keyboard program.

Syntax:

keyb [xx[,[yyy],[[drive:][path]filename]]] Where:

xx is a two-letter country code.

yyy is the code page that defines the character set.

filename is the name of the keyboard definition file.

Comments

Here, xx is one of the following two-letter codes:

us United States (default) fr France gr Germany it Italy


You can include the appropriate keyb command in your autoexec.bat file so that you won't have to type it each time you start DOS.

Example

To use a German keyboard, type:

keyb gr



Label

Label creates, changes, or deletes the volume label on a disk. Syntax

label [drive:][label]

Where label is the new volume label, up to 11 characters. Comments

A volume label is a name you can specify for a disk. DOS displays the volume label of a disk as a part of its directory listing, to show you which disk you are using.



Notes

You can use the DOS dir or vol command to determine whether the disk already has a volume label. Label doesn't work on drives involved with subst or join commands.

Do not use any of the following characters in a volume label:

* ? / \| . , ; : + = [ ] ( ) & -

Example

To label a disk in drive A that contains a report for Sales, type: label a:reportSales Mkdir (MD)

Mkdir (MD) makes a new directory. Syntax

mkdir [drive:]path md [drive:]path Comment

The mkdir command lets you create a multilevel directory structure.

Example

If you want to create a directory to keep all your papers, type:

md \papers Mode

Mode sets operation modes for devices.

Syntax

Parallel printer mode:

mode LPTn[:][chars][,[lines][,p]] Asynchronous communications mode:

mode COMm[:]baud[,parity[,databits [,stopbits[,p]]]] Redirecting parallel printer output:

mode LPTn[:] = COMm[:] Display modes:

mode display mode [display],shift[,t]

prepare =[[yyy][drive:][path]filename]

select = yyy

refresh

[/status]



Device code page modes:



mode device codepage

mode device codepage

mode device codepage

mode device codepage



Comments



The mode command prepares DOS for communications with devices such as parallel and serial printers, modems, and consoles. It also prepares parallel printers and consoles for code page switching. You can also use the mode command to redirect output.



Parallel Printer Modes



For parallel modes, you can use PRN and LPT1 interchangeably. You can use the following options with the mode command to set parameters for a parallel printer:



n Specifies the printer number: 1, 2 or 3.

chars Specifies characters per line: 80 or 132.

lines Specifies vertical spacing, lines per inch: 6 or 8.

p Specifies that mode tries continuously to send output to the printer if a time-out error occurs. This option causes part of the mode program to remain resident in memory.

The default settings are LPT1, 80 characters per line, and 6 lines per inch. You can break out of a time-out loop by pressing Control-Break. Asynchronous (Serial) Communication Modes

You can use the following options with the mode command to set the following parameters for serial ports:

m Specifies the asynchronous communications (COM) port number: 1, 2, 3, or 4.

baud Specifies the first two digits of the transmission rate: 110, 150, 300, 600, 1200, 2400,

4800, 9600, or 19,200.

parity Specifies the parity: N (none), O (odd), or E (even).The default is E.

databits Specifies the number of data bits: 7 or 8. The default is 7.

stopbits Specifies the number of stop bits: 1 or 2. If the baud is 110, the default is 2; otherwise, the default is 1.

p Specifies that mode is using the COM port for a serial printer and continuously retrying if time-out errors occur. This option causes part of the mode program to remain resident in memory. The default settings are COM1, even parity, and 7 data bits.



Display Modes

You can use the following options with the mode command to set parameters for a display.

display Specifies one of the following: 40, 80, BW40, BW80, CO40, CO80, or MONO; 40 and 80 indicate the number of characters per line. BW and CO refer to a color graphics monitor adapter with color- disabled (BW) or enabled (CO). MONO specifies a monochrome display adapter with a constant display width of 80 characters per line.

shift Specifies whether to shift the display to the left or right. Valid values are L or R.

t Tells DOS to display a test pattern in order to align the display on the screen.

No comments:

Post a Comment