• RSS
  • Twitter
  • FaceBook

Security Forums

Log in

FAQ | Usergroups | Profile | Register | RSS | Posting Guidelines | Recent Posts

Getting a Computer's name

Users browsing this topic:0 Security Fans, 0 Stealth Security Fans
Registered Security Fans: None
Post new topic   Reply to topic   Printer-friendly version    Networking/Security Forums Index -> Programming and More

View previous topic :: View next topic  
Author Message
big tom
Forum Fanatic
Forum Fanatic


Joined: 28 May 2002
Posts: 16777215
Location: UK

Offline

PostPosted: Sun Jun 02, 2002 3:05 am    Post subject: Getting a Computer's name Reply with quote

Does anyone know how to get a computer name with javascript or php or anything simaler?
Back to top
View user's profile Send private message
Wombat
Trusted SF Member
Trusted SF Member


Joined: 24 Apr 2002
Posts: 0
Location: Canberra

Offline

PostPosted: Fri Aug 16, 2002 6:31 am    Post subject: Reply with quote

It can't be done. There's no way a server-side language like php could access the client's machine, and JavaScript is deliberately restricted. Apparently it's got something to do with some lame idea they call "security". Wink
Back to top
View user's profile Send private message
TheKingster
Link Spammer
Link Spammer


Joined: 03 May 2002
Posts: 0
Location: UK

Offline

PostPosted: Fri Aug 16, 2002 11:33 am    Post subject: Reply with quote

it can be done

request.servervariables("REMOTE_HOST")

gets the ip address, and theres a DLL u can put on the server which u need to register with regsrv32

bit busy at the mo

will post later
Back to top
View user's profile Send private message
ShaolinTiger
Forum Fanatic
Forum Fanatic


Joined: 18 Apr 2002
Posts: 16777215
Location: Kuala Lumpur, Malaysia

Offline

PostPosted: Fri Aug 16, 2002 1:04 pm    Post subject: Reply with quote

Due that doesn't give the computer name, that gives the IP address/host name. Unless that's what you want dreamer?

Please clarify.

You can get the computer name quite easily with PHP but you have to probe for NetBIOS being open, if it's not then you're out of luck really.
Back to top
View user's profile Send private message Visit poster's website
chris
Forum Fanatic
Forum Fanatic


Joined: 18 Apr 2002
Posts: 16777201
Location: ~/security-forums

Offline

PostPosted: Fri Aug 16, 2002 4:59 pm    Post subject: Reply with quote

Some computers which dont have a valid reverse DNS will return the hostname over the net too, which ive noticed quite a bit of my web stats for some big sites.

Since they dont resolve to a location // ISP its hard to determine where they are.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
YourAllSoThick
Just Arrived
Just Arrived


Joined: 16 Aug 2002
Posts: 0


Offline

PostPosted: Fri Aug 16, 2002 5:32 pm    Post subject: Justinio Reply with quote

Just use the

request.servervariables("REMOTE_HOST")

to get the ip address, then use

Private Sub cmdGet_Click()
'
'-----------------------------------------
'address as a Long value returned by
'the inet_addr function
Dim lngInetAdr As Long
'
'pointer to the HOSTENT structure
Dim lngPtrHostEnt As Long
'
'host name we are looking for
Dim strHostName As String
'
'HOSTENT structure
Dim udtHostEnt As HOSTENT
'
'address in dotted notation
Dim strIpAddress As String
'-----------------------------------------
'
strIpAddress = Trim$(txtIpAddress.Text)
'
'Convert the IP address string to Long
lngInetAdr = inet_addr(strIpAddress)
'
'if the IP address is in wrong format
'the inet_addr function returns INADDR_NONE value
If lngInetAdr = INADDR_NONE Then
'
ShowErrorMsg (Err.LastDllError)
'
Else
'
'## Retrieve host name
'
'Get the pointer to the HostEnt structure
lngPtrHostEnt = gethostbyaddr(lngInetAdr, 4, PF_INET)
'
'if the gethostbyaddr function can't find teh host,
'it returns a NULL pointer
If lngPtrHostEnt = 0 Then
'
ShowErrorMsg (Err.LastDllError)
'
Else
'
'Copy data into the HostEnt structure
RtlMoveMemory udtHostEnt, ByVal lngPtrHostEnt, LenB(udtHostEnt)
'
'Prepare the buffer to receive a string
strHostName = String(256, 0)
'
'Copy the host name into the strHostName variable
RtlMoveMemory ByVal strHostName, ByVal udtHostEnt.hName, 256
'
'Cut received string by first chr(0) character
strHostName = Left(strHostName, InStr(1, strHostName, Chr(0)) - 1)
'
'Return the found value
txtHostName.Text = strHostName
'
End If
'
End If
'
End Sub



to convert the ip address into the machine name.
Back to top
View user's profile Send private message
ComSec
Trusted SF Member
Trusted SF Member


Joined: 26 Jul 2002
Posts: 16777215


Offline

PostPosted: Fri Aug 16, 2002 11:59 pm    Post subject: Reply with quote

YourAllSoThick

wonder if you can help me on this

been looking for a script for no right click for Opera browsers when viewing my site , with no joy,

only found some for for IE /NetS that i have put into the pages,

iam still in the process of building the pages (when i get time)

dont suppose you could code a few lines for me ?

or point me in the right direction, looked everywere, "cheers"

"anyone else know were i can find the script...please post a link"

thanks in advance Wink
Back to top
View user's profile Send private message Visit poster's website
ShaolinTiger
Forum Fanatic
Forum Fanatic


Joined: 18 Apr 2002
Posts: 16777215
Location: Kuala Lumpur, Malaysia

Offline

PostPosted: Sat Aug 17, 2002 12:34 am    Post subject: Reply with quote

IE is the only browser that's gay enough to be stopped by a Javascript, Mozilla, Opera etc all the rest ignore it.

Just have to View Source to see the page and path images anyway, plus the page is on your computer when you see it anyway.

If you want to protect files/images/direct linking etc check out some anti-leech scripts.
Back to top
View user's profile Send private message Visit poster's website
Sliptop
Just Arrived
Just Arrived


Joined: 06 Jun 2002
Posts: 0
Location: Wales (UK)

Offline

PostPosted: Sat Aug 17, 2002 1:03 am    Post subject: Download the source. Reply with quote

Then wipeout the javascript.


yours

SlipX0r
Back to top
View user's profile Send private message Visit poster's website
ComSec
Trusted SF Member
Trusted SF Member


Joined: 26 Jul 2002
Posts: 16777215


Offline

PostPosted: Sat Aug 17, 2002 1:21 am    Post subject: Reply with quote

yeh will do... coding is not my scene... but one of my gratest ambitions, is to code a l33t h4x0rs w00t...prog

got Delph , VB , compilers , decompilers, source codes, exploits, ideas etc, and the no damn time to get to grips with any of it. Rolling Eyes

Sad

anyway thanks guys...am on to it Smile
Back to top
View user's profile Send private message Visit poster's website
ThePsyko
SF Mod
SF Mod


Joined: 17 Oct 2002
Posts: 16777178
Location: California

Offline

PostPosted: Thu Oct 17, 2002 3:56 pm    Post subject: Reply with quote

Yikes that's a lot of code.. from an NT / 2K server a php script with

$output = shell_exec( "c:\\winnt\\system32\\nbtstat.exe -A $REMOTE_ADDR";

should give you a chunk of goodies (assuming NetBIOS traffic isn't blocked) to parse and play with, including the computer name.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   

Post new topic   Reply to topic   Printer-friendly version    Networking/Security Forums Index -> Programming and More All times are GMT + 2 Hours
Page 1 of 1


 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Looking for more Windows Networking info?

Sign up to the WindowsNetworking.com Monthly Newsletter, written by Enterprise Security MVP Deb Shinder, containing news, the hottest tips, Networking links of the month and much more. Subscribe today and don't miss a thing!
View a sample newsletter.

Become a WindowsNetworking.com member!

Discuss your Windows Networking issues with thousands of other Windows Newtorking experts. Click here to join!

Community Area

Log in | Register

Readers' Choice

Which is your preferred data recovery solution?

Follow TechGenix on Twitter