Skip to content

Commit

Permalink
Strange reverse (client/server) Im seeing - quick fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gamelinux committed Dec 2, 2011
1 parent 0c0ed60 commit aa917c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 31 deletions.
32 changes: 3 additions & 29 deletions doc/TODO
@@ -1,32 +1,6 @@

# PassiveDNS

* Get main code up and running.
** "catch" DNS traffic!

* Decode DNS server reply packet

* Output: timestamp||sensor||ns-server-ip||NAME||TYPE||CLASS||TTL||*RDLENGTH*||RDATA
** NAME Name of the node to which this record pertains (variable)
** TYPE Type of RR in numeric form (e.g. 15 for MX RRs) 2
** CLASS Class code 2
** TTL Count of seconds that the RR stays valid (The maximum is 231-1, which is about 68 years.) 4
# ** RDLENGTH Length of RDATA field 2
** RDATA Additional RR-specific data (variable)


# ref: http://en.wikipedia.org/wiki/List_of_DNS_record_types
for answer in dns.an:
if answer.type == 5:
print "CNAME request", answer.name, "\tresponse", answer.cname
elif answer.type == 1:
print "A request", answer.name, "\tresponse", socket.inet_ntoa(answer.rdata)
elif answer.type == 28:
print "AAAA request", answer.name, "\tresponse", socket.inet6_ntoa(answer.rdata)
elif answer.type == 12:
print "PTR request", answer.name, "\tresponse", answer.ptrname
else
print "Parsing of R-Type", answer.type, "is not yet implemented..."



* Implement comandline option for log filename
* Clean up memory on exit
* Add some stats
5 changes: 3 additions & 2 deletions src/dns.c
Expand Up @@ -331,9 +331,10 @@ void print_passet(pdns_asset *p, pdns_record *l) {

u_ntop(p->sip, p->af, ip_addr_s);
u_ntop(p->cip, p->af, ip_addr_c);
fprintf(fd,"%lu||%s||%s||",p->last_seen, ip_addr_s, ip_addr_c);

fprintf(fd,"%lu||%s||%s||",p->last_seen, ip_addr_c, ip_addr_s);
//fprintf("%lu||%s||%s||",p->last_seen, ip_addr_c, ip_addr_s);
//u_ntop(p->sip, p->af, ip_addr_s);
//fprintf(fd,"%s||",ip_addr_s);

switch (ldns_rr_get_class(p->rr)) {
case LDNS_RR_CLASS_IN:
Expand Down

0 comments on commit aa917c7

Please sign in to comment.