玻璃小屋 阅读(1277) 评论(8)

Re:跟net send类似的源代码,发送后,对方机器上会弹出一个框,如果它没有关消息服务的话:) [所有相关帖子]

 
#include "stdafx.h"
#include "Winsock2.h"
#pragma comment( lib, "ws2_32.lib" ) /*这句不能少。*/

// Packet format found thanks to a bit a sniffing
static unsigned char packet_header[] =
"\x04\x00\x28\x00"
"\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\xf8\x91\x7b\x5a\x00\xff\xd0\x11\xa9\xb2\x00\xc0"
"\x4f\xb6\xe6\xfc"
"\xff\xff\xff\xff" // @40 : unique id over 16 bytes ?
"\xff\xff\xff\xff"
"\xff\xff\xff\xff"
"\xff\xff\xff\xff"
"\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\xff\xff\xff\xff"
"\xff\xff\xff\xff" // @74 : fields length
"\x00\x00";

unsigned char field_header[] =
"\xff\xff\xff\xff" // @0 : field length
"\x00\x00\x00\x00"
"\xff\xff\xff\xff"; // @8 : field length
#define PORT 135
//打包发送函数,单ip可调用之。
__declspec(dllexport)int SendMsg(unsigned long ip,char* from,char* to,char* msg)
{
        int i, packet_size, fields_size, s;
        char packet[8192];
        struct    sockaddr_in addr;
        WSADATA wsaData;
        WSAStartup(0x0202, &wsaData);
        ZeroMemory(&addr, sizeof(addr));
        addr.sin_addr.s_addr = ip;
        addr.sin_port = htons(PORT);
        addr.sin_family = AF_INET;
        ZeroMemory(packet, sizeof(packet));
        packet_size = 0;
        memcpy(&packet[packet_size], packet_header, 80);
        packet_size += 80;
        i = strlen(from)+1;
        *(unsigned int *)(&field_header[0]) = i;
        *(unsigned int *)(&field_header[8]) = i;
        memcpy(&packet[packet_size], field_header, 12);
        packet_size += 12;
        strcpy(&packet[packet_size], from);
        packet_size += (((i - 1) >> 2) + 1) << 2; // padded to a multiple of 4
        i = strlen(to) + 1;
        *(unsigned int *)(&field_header[0]) = i;
        *(unsigned int *)(&field_header[8]) = i;
        memcpy(&packet[packet_size], field_header, 12);
        packet_size +=12;
        strcpy(&packet[packet_size], to);
        packet_size += (((i - 1) >> 2) + 1) << 2; // padded to a multiple of 4
        i = strlen(msg) + 1;
        *(unsigned int *)(&field_header[0]) = i;
        *(unsigned int *)(&field_header[8]) = i;
        memcpy(&packet[packet_size], field_header, 12);
        packet_size += 12;
        strcpy(&packet[packet_size], msg);
        packet_size += i;
        fields_size = packet_size - 80;
        *(unsigned int *)(&packet[40]) = time(NULL);
        *(unsigned int *)(&packet[74]) = fields_size;
        if ((s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1)
              return 0;
        if (sendto(s, packet, packet_size, 0, (struct sockaddr *)&addr, sizeof(addr)) == -1)
             return 0;
    
return 1;
}

__declspec(dllexport)int SendMsg(char* ip,char* from,char* to,char* msg)
{
    return SendMsg(inet_addr(ip),from,to,msg);
}


评论列表
freejustin
re: 跟net send类似的源代码(剽窃来的代码~):P
这段代码可以测试过?可以发送?
freejustin
re: 跟net send类似的源代码(剽窃来的代码~):P
这段代码可以测试过?可以发送?
Merjoum
what is generic ambien  ambien strength . using ambien buy lopressor  pill ambien buy tramadol zolpidem tartrate tablets ambien with alcohol . dosage of ambien can you buy ambien in mexico zolipidem <a href=>canadian pharmacy zolpidem</a>. zolpodem maximum dose of zolpidem doses for ambien ambien 12.5 mg .
FreaBox
overdose ambien order ambien online zolpidem online <a href=>ambien cr 12.5</a>. buy ambien on line ambien lunesta can you order ambien online atarax online . ambien 10 mg  where can i buy zolpidem online . sleep aid zolpidem ambien interactions  ambien 2 mg zolpidem cheap dosage zolpidem zolpidem uk
KoipSiny
zolpidem overdose generic name for ambien cr cheap generic ambien <a href=>buy ambien online</a>. ambien 12.5 order premarin online long term ambien use reviews of ambien . purchase ambien overnight delivery  prescription ambien . is ambien bad for you price of ambien  generic name for zolpidem ambien cr withdrawal reviews on ambien ambien cream
Sadnus
ambient sleeping pills ambian drug ambien news <a href=>is ambien prescription</a>. zolpidiem zolipem ambien stilnox buy pepcid . ambient drug  ambien safety . zolpidem tartrate online online pharmacy zolpidem  maximum dose ambien zolpidem tartrate 10 mg what is ambien used for cheapest ambien with quick delivery
Hytcem
buy atarax  zolpidam . on ambien does ambien cause constipation  buy astelin zolpidem interactions ambient drug order ambien no rx . zolpidem tartrate 10 buy ditropan generic ambien names <a href=>ambien</a>. ambien generics buy ambian buy ambien online overnight delivery buy ambien online reviews .
XertJak
price of ambien  can ambien cause memory problems . zolpidem manufacturers ambien and memory  zolpidem tartrate high can i buy ambien online provera online ambien online overnight . zolpiem zolpidem long term zolpidem online uk <a href=>ambien trade name</a>. dosage zolpidem sleeping ambien ambien drug use ambien controlled .

发表评论
切换编辑模式