|
Ok, thanks to the folks who helped me out last time. It's time for level 2 now though, which is a bit harder. Here's what I've got: 1 x 20meg file with a list of IP address Here's what I want: 1 x file with a list of users/login names who uses those IP addresses Now I can get the information line by line by using the nbtstat -a command. This outputs the following: [code] nbtstat -A 111.111.111.111 Name Type Status --------------------------------------------- H01111 UNIQUE Registered HO GROUP Registered H01111 UNIQUE Registered H01111 UNIQUE Registered U01111 UNIQUE Registered HO GROUP Registered MAC Address = 00-01-03-0D-FE-29 [/code] The U01111 number is the username I'm after. However, this could be quite a lengthy process if I have to do this for each of the ips in this 20 meg file. I know it should be possible to write a basic batch file that does all of the work for me, but I'm struggling a little. Does anyone know of an easy way to take an IP out of the first file, run the nbtstat command on it, and output the U01111 (note - these won't always be U numbers, they could be pure text) number to another file, and repeat this process appending a the new user id each time it's run? Cheers for your help! [MH] |
DOS Command help - the return
-
Mike_Hunt 23,524 posts
Seen 2 years ago
Registered 19 years ago -
Tiger_Walts 16,674 posts
Seen 4 years ago
Registered 19 years agoDoubt it can be done with batch file. You may have to get someone to write you an app. -
Nuttah 1,840 posts
Seen 9 years ago
Registered 18 years agoI concur, not a terribly hard app to write... (for a programmer).
why cant this be done from the firewall? and why the hell are you looking at netbios connections? -
Mike_Hunt 23,524 posts
Seen 2 years ago
Registered 19 years agoThe app option won't happen unfortunately.
Can you recommend any sort of scripting language? I don't mind learning and it shouldn't be a complicated program, shirley?
[MH] -
ssuellid 19,142 posts
Seen 2 days ago
Registered 20 years agoPerl. Download cygwin from somewhere and get Perl with it. -
Mike_Hunt 23,524 posts
Seen 2 years ago
Registered 19 years agoNuttah wrote:
Firewall doesn't log usernames, just IPs. That command is the only one I know that resolves the Username from IP.
I concur, not a terribly hard app to write... (for a programmer).
why cant this be done from the firewall? and why the hell are you looking at netbios connections?
[MH] -
Nuttah 1,840 posts
Seen 9 years ago
Registered 18 years agousernames... do you mean netbios names?
frankly never used the command before. I'm just cant see why you would need to do this. -
[maven] 5,799 posts
Seen 1 day ago
Registered 17 years agoMike_Hunt wrote:
The app option won't happen unfortunately.
Can you recommend any sort of scripting language? I don't mind learning and it shouldn't be a complicated program, shirley?
[MH]
Ruby. -
Mike_Hunt 23,524 posts
Seen 2 years ago
Registered 19 years agoNuttah wrote:
What don't you understand?
usernames... do you mean netbios names?
frankly never used the command before. I'm just cant see why you would need to do this.
I need user names.
I only have a list of IPs.
That command gives me user names from IPs.
That is why.
[MH] -
Nuttah 1,840 posts
Seen 9 years ago
Registered 18 years agoMike_Hunt wrote:
What don't you understand?
I need user names.
I only have a list of IPs.
That command gives me user names from IPs.
That is why.
[MH]
There is absolutly no need to be so aggressive mike.
nbtstat -A as far as I can see does not resolve "usernames" as you put it, it resolves remote machine names (i.e. the netbios name).
and just to be pedantic, you havnt explained why, just what. If you do not wish to tell me, then just say. -
DiscoMike 570 posts
Seen 7 hours ago
Registered 17 years agoI think the point some others earlier were trying to make is that NBTSTAT does not return usernames.
The NETBIOS name is returned. (computer name) -
I was about to post a helpful reply until you turned into a tool mate. -
tannerd 2,691 posts
Seen 1 month ago
Registered 18 years agoNB take a copy of your IP Address file first...
What you could do is open the file with a decent text editor (eg UltraEdit), do a find replace for the start of a line (or whatever you delimiter is) and insert "nbtstat -A "
Then do a find/replace for the end of line and add " >> myfile.txt"
Edit: can't remember if it is ">" or ">>" one will append, one will overwrite....
Edit2: It is ">>", never mind.
Rename the ip address file to ".bat" and run
It won't give you just the usernames, so you'd have to parse out all the crap, but that should be straight forward.
Give us an email if you want a hand...
Edited by tannerd at 14:05:47 24-05-2005
Edited by tannerd at 14:19:42 24-05-2005 -
tannerd 2,691 posts
Seen 1 month ago
Registered 18 years agoDiscoMike wrote:
I think the point some others earlier were trying to make is that NBTSTAT does not return usernames.
The NETBIOS name is returned. (computer name)
NBTSTAT -A displays the Remote Machine Name Table, one entry of which is the username.
See www.microsoft.com/resources/documentation/Windows/2000
/server/reskit/en-us/prork/pref_tts_pjtk.asp
would link, but I keep getting EG errors -
Mike_Hunt 23,524 posts
Seen 2 years ago
Registered 19 years agoNuttah wrote:
Dude. I wasn't meaning to be agressive. Damn transmoweb! I'm just really busy today (I've not posted anywhere but here!) and as such kept my posts as short as possible. No offense meant. Honestly!
There is absolutly no need to be so aggressive mike.
nbtstat -A as far as I can see does not resolve "usernames" as you put it, it resolves remote machine names (i.e. the netbios name).
and just to be pedantic, you havnt explained why, just what. If you do not wish to tell me, then just say.
Sheesh. I've met you, why would I feel the need to be agressive towards you... oh, I see!
Oh, and the why "is because I've been told to and I like getting paid".
Ok, the real reason is that some people have been screwing around with their config and providing themselves with internet access when they shouldn't. I've got a list of users who have the ability to do this and want to compare that list with everyone who's used the net ever. This should give me a list of "who's able to do this and has actually managed to connect to the net".
[MH]
Edited by Mike_Hunt at 14:34:11 24-05-2005 -
ssuellid 19,142 posts
Seen 2 days ago
Registered 20 years agotannerd link
I was having the same trouble posting links the other day. Doing just the link screwed it up, hrefing it screwed up but adding the http seemed to work.
Edited by ssuellid at 14:38:49 24-05-2005 -
Mike_Hunt 23,524 posts
Seen 2 years ago
Registered 19 years agoDiscoMike wrote:
The Netbois name/computer name is the H0 number displayed in my example.
I think the point some others earlier were trying to make is that NBTSTAT does not return usernames.
The NETBIOS name is returned. (computer name)
Also returned is the U0 number, which is the user name. Now I don't know if that's also known as something else, but on all of our machines that number relates to the user of that computer. So by running that command I can resolve the user name. Sorry for not being clearer.
[MH] -
Mike_Hunt 23,524 posts
Seen 2 years ago
Registered 19 years agotannerd wrote:
Thanks tannerd! Twice!
DiscoMike wrote:
I think the point some others earlier were trying to make is that NBTSTAT does not return usernames.
The NETBIOS name is returned. (computer name)
NBTSTAT -A displays the Remote Machine Name Table, one entry of which is the username.
See www.microsoft.com/resources/documentation/Windows/2000
/server/reskit/en-us/prork/pref_tts_pjtk.asp
would link, but I keep getting EG errors
[MH] -
tannerd 2,691 posts
Seen 1 month ago
Registered 18 years agoSomething you might want to consider is importing the ip addresses into an access db, and selecting out the distinct entries. I imagine in the 20Mb file you are going to have a lot of duplicates. Or you are on a _very_ big network. -
jellyhead 24,355 posts
Seen 2 weeks ago
Registered 18 years agoI've a vbscript that takes the nbtstat data and outputs the username and the ip to a csv file.
Do you want it?
Would have told you earlier but the forum was down. grrrr.
send me mail to djellyhead gmail com if you're interested Mike. -
Nuttah 1,840 posts
Seen 9 years ago
Registered 18 years agono problem mike, as you say I dont know why you would be aggressive either! .gif)
It looked like a irritated response, but emotions can be a tad difficult to work out in text, no harm done.gif)
Tannerds batch file looks plausible, its a shame that the usernames (yes i'll accept nbtstat -A might list usernames!)doesnt have a unique identifier, would make your life a lot easier!
Edited by Nuttah at 14:42:32 24-05-2005 -
Mike_Hunt 23,524 posts
Seen 2 years ago
Registered 19 years agojellyhead wrote:
Does the pope shit in the woods?!
I've a vbscript that takes the nbtstat data and outputs the username and the ip to a csv file.
Do you want it?
Would have told you earlier but the forum was down. grrrr.
send me mail to djellyhead gmail com if you're interested Mike.
Email on it's way!
[MH] -
Mike_Hunt 23,524 posts
Seen 2 years ago
Registered 19 years agoNuttah wrote:
Oh, I'm irriated alright. Just not with you!
no problem mike, as you say I dont know why you would be aggressive either!.gif)
It looked like a irritated response, but emotions can be a tad difficult to work out in text, no harm done.gif)
[MH] -
tannerd 2,691 posts
Seen 1 month ago
Registered 18 years agomy nbtstat comes out like:
Name Type Status
---------------------------------------------
...
TANNERD {03} UNIQUE Registered
...
And I believe the {03} is the identifier for the username field. Ultraedit has a regexp feature that could probably pull it out, but as there is a vbscript solution, I guess there's no need.
Edit: stupid angle brackets. Replace { and } with greater than and less than...
Edited by tannerd at 14:48:33 24-05-2005 -
mrpon 37,366 posts
Seen 55 minutes ago
Registered 15 years ago11 year bump!
Trying rename a chunk of files in a folder from this:
RT_Cblahblahblah.docx
to
Cblahblahblah.docx
So essentially remove the RT_ bit.
Any tips? I'm struggling with the ren command. -
One_Vurfed_Gwrx 4,468 posts
Seen 2 hours ago
Registered 15 years agoRename RT_Cblah*.* Cblah*.* ? -
REN *.* " *.*" " *.*"
LFNFOR On
FOR %v IN (*.*) DO REN "%v" %v -
Above works for ALL files in the folder, removes the first three characters -
Dirtbox 92,595 posts
Seen 21 hours ago
Registered 19 years ago -
Now then now then
Sometimes posts may contain links to online retail stores. If you click on one and make a purchase we may receive a small commission. For more information, go here.


.gif)