Getting a Computer's name

Networking/Security Forums -> Programming and More

Author: big tomLocation: UK PostPosted: Sun Jun 02, 2002 3:05 am    Post subject: Getting a Computer's name
    ----
Does anyone know how to get a computer name with javascript or php or anything simaler?

Author: WombatLocation: Canberra PostPosted: Fri Aug 16, 2002 6:31 am    Post subject:
    ----
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

Author: TheKingsterLocation: UK PostPosted: Fri Aug 16, 2002 11:33 am    Post subject:
    ----
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

Author: ShaolinTigerLocation: Kuala Lumpur, Malaysia PostPosted: Fri Aug 16, 2002 1:04 pm    Post subject:
    ----
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.

Author: chrisLocation: ~/security-forums PostPosted: Fri Aug 16, 2002 4:59 pm    Post subject:
    ----
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.

Author: YourAllSoThick PostPosted: Fri Aug 16, 2002 5:32 pm    Post subject: Justinio
    ----
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.

Author: ComSec PostPosted: Fri Aug 16, 2002 11:59 pm    Post subject:
    ----
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

Author: ShaolinTigerLocation: Kuala Lumpur, Malaysia PostPosted: Sat Aug 17, 2002 12:34 am    Post subject:
    ----
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.

Author: SliptopLocation: Wales (UK) PostPosted: Sat Aug 17, 2002 1:03 am    Post subject: Download the source.
    ----
Then wipeout the javascript.


yours

SlipX0r

Author: ComSec PostPosted: Sat Aug 17, 2002 1:21 am    Post subject:
    ----
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

Author: ThePsykoLocation: California PostPosted: Thu Oct 17, 2002 3:56 pm    Post subject:
    ----
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.



Networking/Security Forums -> Programming and More


output generated using printer-friendly topic mod, All times are GMT + 2 Hours

Page 1 of 1

Powered by phpBB 2.0.x © 2001 phpBB Group