Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: How can I get which Windows domain an IP belongs to?

by BUU (Prior)
on Oct 13, 2003 at 21:24 UTC ( #298952=note: print w/ replies, xml ) Need Help??


in reply to How can I get which Windows domain an IP belongs to?

Just off the top of my head and having no idea how to get the windowdomain out of the output of nbtstat, what about:

use strict; open IP,"<IP.txt" or die "Couldn't open IP.txt, $!"; while(<IP>) { chomp; # does the while form of <> autochomp? I don't remember =[ my $out = `nbtstat -A $_`; if($out=~/WORKGROUP\s+<(\d+)>/) { my $domain = $1; #do something } }
My version of nbtstat, when run on myself, gave me this output:
C:\LiteStep>nbtstat -A 192.168.1.2 Local Area Connection: Node IpAddress: [192.168.1.2] Scope Id: [] NetBIOS Remote Machine Name Table Name Type Status --------------------------------------------- H4X0R-B0X <00> UNIQUE Registered WORKGROUP <00> GROUP Registered H4X0R-B0X <20> UNIQUE Registered MAC Address = 00-02-E3-14-A4-C5
I have no real idea what those numbers in the pointy brackets are, but I decided to capture them in my regex anyways. My version above just searches through the entire output for anything that matches the regex /WORKGROUP\s+<(\d+)>/ and then sets the $domain variable. However you could also easily do something like for(split/\n/,$out){ #operate on each line }.


Comment on Re: How can I get which Windows domain an IP belongs to?
Select or Download Code
Re^2: How can I get which Windows domain an IP belongs to?
by Anonymous Monk on Jan 18, 2010 at 22:37 UTC

    i did try

    int old_step; { chomp; # = zelda is /underattack (by the evil forces) of ///ghetto +array/// switch (who-1) { <your face> } old_step = prev_step20; ///BLOCK_ON_THIS/// tracert <IP> # = die/ am going to ///gamelon/// to aid myself (fail_2.wav) return_value = BLOCK_ON_THIS;

    it's been know to work normally, but i got the following error

    +++ Out of cheese error! +++ +++ MELON MELON MELON +++ +++ please redo from start +++ +++ Please reboot universe and try again +++

    see if it does anything for you. NOTE: For the majority of this, I had no idea what i was talking about

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://298952]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2014-09-19 04:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (129 votes), past polls