Jump to content

Getting usernames over network


Recommended Posts

Thats right, usernames over my home network.

I don't have to hack, I can just change the firewall settings if needed.

You know how those lan messengers get the usernames on the network that you can send messages to?

Thats the sort of thing I'm looking for.

What you are talking about are NetBIOS WINS records (specifically 0x03 Computer_Name/Username records). Modern versions of Windows are leaving that off by default because it's a huge security hole, and one day it will no longer be available at all. If I recall correctly, the Username record indicates the Messanger service is up, which is yet another huge security hole.

Run "NBTStat -n" to see your local NetBIOS records (if it's running). The \\ComputerName[00h] record shows the Workstation service is talking to NetBIOS, the \\ComputerName[20h] record is from the Server service, and any [03h] records are from the Messanger service.

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

This script will set @error to 0 and return an array will all user accounts of local or remote computer otherwise it will set @error to 1 and return NUL.

#include <Array.au3>

$LocalAccounts = _GetLocalAccounts()
If Not @error Then _ArrayDisplay($LocalAccounts, 'Local Computer')

$RemoteLocalAccounts = _GetLocalAccounts('RemoteComputerName')
If Not @error Then _ArrayDisplay($RemoteLocalAccounts, 'Remote Computer')

Func _GetLocalAccounts($strComputer = 'localhost')
    Local $colItems = ""
    Local $aUsers = ''
    Local $wbemFlagForwardOnly = 0x20
    Local $wbemFlagReturnImmediately = 0x10
        
    $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
    If Not IsObj($objWMIService) Then Return(SetError(1, 1, ''))
    $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_UserAccount Where LocalAccount = True", "WQL", _
            $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

    If Not IsObj($colItems) Then Return(SetError(1, 1, ''))
    For $objItem In $colItems
        $aUsers &= $objItem.Name & '|'
    Next
    Return(SetError(0, 0, StringSplit(StringTrimRight($aUsers, 1), '|')))
EndFunc   ;==>_GetLocalAccounts

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

This script will set @error to 0 and return an array will all user accounts of local or remote computer otherwise it will set @error to 1 and return NUL.

Nice. And that's the right way for it to be available because proper perms are required to get the info.

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

You can read the registry of remote computers too: RegEdit>File>Connect Network Registry..... so thats how it could help.

$Line = ""

$get = Run(@ComSpec & " /c net view", @SystemDir, @SW_HIDE, 2)

While $get

$Line &= StdoutRead($get)

If @error Then ExitLoop

WEnd

$Line = StringSplit(StringStripCR($Line), @LF)

$Out = ""

For $I = 1 To $Line[0]

If StringLeft($Line[$I], 2) = "\\" Then

$Line[$I] = StringTrimLeft($Line[$I], 2)

$PC = StringLeft($Line[$I], StringInStr($Line[$I], Chr(32)))

$USER = StringTrimLeft(StringStripWS($Line[$I], 4), StringLen($PC))

msgbox(0,"",$user)

EndIf

Next

rockin fast...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...