DNS Resolve IP to Hostname?

Get help on programming - C++, Java, Delphi, etc.
Post Reply
SBSP
Registered User
Posts: 3124
Joined: 09 May 2006, 02:00
Location: Centurion

DNS Resolve IP to Hostname?

Post by SBSP »

Hey People.
How are you all doing on this Friday?

Read from the Stipple line at the bottom
if you dont want to read about my situation.

I was told to install a proxy server, and monitor users spending the whole day on the Internet (At work)

So i installed Smoothgardian, it has built in reports but , its not something you can use.

SmoothGardian uses Squid as a proxy server. and logs all data to a access.log file.
Ive been battling for months now to get a proper tool to report off the log file. I eventually found a half decent tool called Sawmill, but even that cant do what i want, So i eventually, started creating my own solution to my problem.

I used PSFTP.exe to download the file then used Plink.exe to execute a command on the linux server to rotate the logs.
I then wrote(VB :oops: )a utility that takes the Access.log file and converts it to a CSV file it also trimms each URL to the 3rd "/"
i then use a DTS MS SQL package to upload it into a Sql2000 database using
DTSRUN scheduled every 30mins, then use crystal reports to create my own report, This all works
fine, actually it works great.



-------------------------------------------------------------------------
-------------------------------------------------------------------------
-------------------------------------------------------------------------
But the problem is when squid logs the requested url it logs the IP address
of the user aswell, We run DHCP and i think ip addresses expires every week
or 12 hours cant remember but it expires anyway.

I would like someone to show me how to get the hostname of an ip address
i'm sure getting an ip is easier, and i assume you have to query the DNS
server.

Will i be able to use Winsock, the DNS resolution protocoll is it UDP or TCP
I searched all over google but cant find anything?.

Once this is done my task is complete, then i dont have to stress on getting reports for management.
Anthro
Moderator Emeritus
Posts: 5547
Joined: 21 Dec 2002, 02:00
Processor: i7 3770k
Motherboard: ASUS P8P67-Pro
Graphics card: 2xNvidia GTX670
Memory: 16 GB Gskill Sniper
Location: In SQL Space inserting 'null' on purpose
Contact:

Post by Anthro »

Is there a similar command to ipcofig /flushdns in Linux ?
*edit* Did u see the link I gave you yesterday >
In the other "VB" question ?
Temporary Absence
SBSP
Registered User
Posts: 3124
Joined: 09 May 2006, 02:00
Location: Centurion

Post by SBSP »

Anthropoid wrote:Is there a similar command to ipcofig /flushdns in Linux ?
Well how would that help me?
Commands can be dumped to file using ">C:\Dump.txt" so instead of it printing to screen it prints to file.

As far as i know that justs flushes the DNS cache, i could use that to posibly
make sure the IP address linked to hostname is accurate.

I would probably need a list of ip address asigned to hostnames in a file and use that as a mapping table. it would help more if i could
resolve the IP to hostanme then instead of saving the IP
in my CSV file , save the hostaname.
Anthro
Moderator Emeritus
Posts: 5547
Joined: 21 Dec 2002, 02:00
Processor: i7 3770k
Motherboard: ASUS P8P67-Pro
Graphics card: 2xNvidia GTX670
Memory: 16 GB Gskill Sniper
Location: In SQL Space inserting 'null' on purpose
Contact:

Post by Anthro »

Nevermind - that is probably why you earn three times more than I do.

I am such a n00b.
Temporary Absence
User avatar
rustypup
Registered User
Posts: 8872
Joined: 13 Dec 2004, 02:00
Location: nullus pixius demonica
Contact:

Post by rustypup »

<teh goggles!>
Developer Fusion

using vb.net, i'm almost convinced there's a class which handles this far more swimmingly...
Most people would sooner die than think; in fact, they do so - Bertrand Russel
SBSP
Registered User
Posts: 3124
Joined: 09 May 2006, 02:00
Location: Centurion

Post by SBSP »

Rusty 1 word respect!!!!!!!!
YOu know ive been googling all over the place for this the closest i got
was to get your own machines hostname or IP.


Cha cha ching!!!!!

Image


Thanks again man, i truly appreciate it.
I owe you.
lancelot
Registered User
Posts: 7162
Joined: 13 May 2003, 02:00
Location: Cape Town

Post by lancelot »

One of the girls posted this, sorry cannot remember who?
May be of help?

http://www.vbip.com/winsock-api/gethost ... ame-01.asp
User avatar
rustypup
Registered User
Posts: 8872
Joined: 13 Dec 2004, 02:00
Location: nullus pixius demonica
Contact:

Post by rustypup »

<submits complicated bill for a year's supply of cheese sticks and biltong twigs...>

hey, the way i see it, you're a charity case... anyone using vb sould be treated like that wierd homeless guy that lives under my stairs and keeps asking me to help him get rid of something called a "snozzle".. :P only a pleasure bud...
Most people would sooner die than think; in fact, they do so - Bertrand Russel
Post Reply