Problem with DNS-Records in C


 
Thread Tools Search this Thread
Top Forums Programming Problem with DNS-Records in C
# 1  
Old 03-08-2010
Problem with DNS-Records in C

Hey community,

I'm coding an application in ANSI-C that needs to locate IP-Adresses.
I fount that a good and very cheap way to do this would be to make DNS-queries against Blacklist provider UCEPROTECT's Country zone (country.uceprotect.net)

They seem to offer a TXT-Record and also an A Record to get that information.

So if I want to get the result "IE" for the IP 81.17.242.186 I would have to query either:

Code:
dig txt 186.242.17.81.country.uceprotect.net

; <<>> DiG 9.2.3 <<>> txt 186.242.17.81.country.uceprotect.net
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20321
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;186.242.17.81.country.uceprotect.net. IN TXT

;; ANSWER SECTION:
186.242.17.81.country.uceprotect.net. 2100 IN TXT "IE"

;; AUTHORITY SECTION:
country.uceprotect.net. 3468    IN      NS      dnsbl-mirrors.uceprotect.net.

;; Query time: 103 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Mar  8 17:47:47 2010
;; MSG SIZE  rcvd: 97

or I could also query the A-Record which results in an NUMBER which seems to be ascii code too.

Code:
dig a 186.242.17.81.country.uceprotect.net

results in:
;; QUESTION SECTION:
;186.242.17.81.country.uceprotect.net. IN A

;; ANSWER SECTION:
186.242.17.81.country.uceprotect.net. 2100 IN A 127.0.73.69

;; AUTHORITY SECTION:
country.uceprotect.net. 3245    IN      NS      dnsbl-mirrors.uceprotect.net

Since 73 seems to be I and 69 seems to be E that would also work but be possibly more complicated to code.

Unfortunable I have no clue how to do a routine in C that works on Linux or FreeBSD that can ask an IP against country.uceprotect.net for txt or a record and then displays the result.

Can you help me to do this? Would be nice if someone can give me an answer.

Thank you

Hansi

Last edited by pludi; 03-09-2010 at 02:08 AM.. Reason: code tags, please...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. IP Networking

DNS problem?

I uploaded a new domain and I am having problems with the paths... Works..shop.mydomain.com/index.php?main_page=contact. Does Not Work..shop.mydomain.com/contact/. copied the entire directory from a working directory and changed the appropriate paths where necessary (as usual) so ...? ... (3 Replies)
Discussion started by: tifischer
3 Replies

2. Red Hat

Mail Problem. Maybe, it is a DNS Problem!

Hi, i've a redhat linux 9 upadated by redhat from 7 version to 9 version. A couple of days ago i was a problem with my mail, in other words i'm not able to get any email nor to send any email. I've a proxy configuration and i tried to set iptables in order to verify the port. The 110,255 and 995... (1 Reply)
Discussion started by: pintalgi
1 Replies

3. UNIX for Dummies Questions & Answers

In BIND 9.3 DNS trying to get past the 256 char limit in SPF TXT records

One way I was told to do was incase strings in quotes. But I was given this option if I can get it to work. Will this work for splitting up SPF records? I am try to make bx.example.com reference spf.eu.***, spfa.eu.***, spfb.eu.***, and spfc.eu.***. spf.eu.example.com 3600 IN TXT "v=spf1... (0 Replies)
Discussion started by: tmanx
0 Replies

4. Ubuntu

dns problem

hello. i'm running ubuntu desktop 8.04 and i use it ot host some sites (actually i'm trying ) well i'm running to websites (with the same dns,ip) site1.com work fine but site2.com give me this Hmm, site2.com isn't loading right now. The computers that run site2.com are having some trouble.... (2 Replies)
Discussion started by: mazi
2 Replies

5. UNIX for Dummies Questions & Answers

Changing DNS "A" Records

I am kind of a beginner in Unix. Our DNS server is on a Unix server running FreeBSD, and I just add a new Windows print server running Server 2003 R2 to the network. I am having trouble - I can Ping the IP address of the server but not the server name. I was informed that I would have to add an... (5 Replies)
Discussion started by: mjmega07
5 Replies

6. Shell Programming and Scripting

DNS problem

sorry guys, I had big problem solving this simple problem..:D hope expertise here can solve this problem. ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 1361 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;. IN... (0 Replies)
Discussion started by: unknown2205
0 Replies

7. UNIX for Dummies Questions & Answers

DNS problem

Hi all, I have got the message of "*** Can't find server name for address 10.131.120.50: Server failed" when I typed nslookup on the DNS server I setup the /etc/named.conf and all the data files in /var/named and start the named daemon. I also mae appropriate change on the resolv.conf and... (2 Replies)
Discussion started by: stancwong
2 Replies

8. IP Networking

DNS Problem

Hello Everyone, I am working on a HP-Unix machine and I am trying to get it to use the University's DNS servers. Long story short... the resolv.conf file is ok : nameserver 149.150.51.1 nameserver 149.150.51.2 search shu.edu The hosts file is ok. And when I make the nsswitch.conf file... (1 Reply)
Discussion started by: loslappy
1 Replies

9. IP Networking

DNS problem

Hello! I´ve got a problem with the dns on one of our servers. When i try to look someting up with either nslookup or ping i get the folowing error message. -------------------------------------------------------------------------------- # nslookup sun.com *** Can't find server name for... (4 Replies)
Discussion started by: dozy
4 Replies

10. IP Networking

dns problem

helo all i got problem in my network i got sun 206 and i work with sendmail when i had the praimery dns of my isp i can send mail from the server but i cant send from the clinet (outlook in the network) and if i chnage it to secundery dns off my isp i can send frome the server and frome the... (2 Replies)
Discussion started by: nis
2 Replies
Login or Register to Ask a Question