Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 DNS Lookup

Author  Topic 

SamC
White Water Yakist

3467 Posts

Posted - 2003-12-15 : 15:16:23
This should be client-side but let me ask anyway..

When our Web Login page calls a stored procedure to check username / password, I discard any history of the failed login attempt.

I'm considering storing the Username, and IP address in a table.

It would be more good information to do a DNS Lookup on the identity of the remote IP address.

Is there an SQL tool available to do this and is it completely unsafe and unreasonable to do a lookup like this within a stored procedure? Any other techniques to gain more information?

MichaelP
Jedi Yak

2489 Posts

Posted - 2003-12-15 : 16:23:01
I don't know of a SQL tool that can do that.

I'd probably write an app that reads that table, does the DNS lookup, and then does an update on that table. I think .Net has a lot of the DNS functionality built into it. (System.Net).

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2003-12-15 : 17:39:25
You could xp_CmdShell out to do an nslookup. But, can you say UGLY.
I'm thinking about this for an upcoming project, my plan is to capture IP addresses as normal, then run a job through every x minutes to do my DNS lookups in a batch. This way, I could either store commonly used hostnames in a table to speed things up, and do some stats queries on them. Or, with a local DNS server it should be fairly quick to retrieve them each time.



Damian
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2003-12-15 : 17:50:46
I agree. It's better to reverse DNS sometime after the INSERT.
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2003-12-15 : 19:01:49
I started to put xp_cmdshell in my response, but I could not figure out how you'd get the result back into SQL server so you could deal with it. Is there a way? I know it's not the best solution for this, I'm just curious.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2003-12-15 : 19:35:33
Well, it ain't pretty...



Create Table #output
(
output varchar(1000)
)
INSERT INTO #Output
Exec master..xp_CmdShell 'nslookup 66.129.68.65'

SELECT Ltrim(rtrim(SUBSTRING(output, 6, len(output)))) as hostname
FROM
#output
WHERE
SUBSTRING(output, 1, 4) = 'Name'

DROP Table #Output




Damian
Go to Top of Page
   

- Advertisement -