473,794 Members | 2,983 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Netbios in C#

Hi!

I'm trying to write a program that can tell if a remote computer is
running Windows or not. The thing is, it have to go very fast, so I
don't want to "connect" to the computer.

My plan is to send a netbios request and if I get a response I know
it's probably a Windows machine.

The problem is that I can't use the Netbios function in NETAPI32.DLL,
because I can't "translate" the NCB struct to C#.

So, can someone either show me how to convert the struct to C# or tell
me of a better or alternate way of solving my problem?

Feb 21 '07 #1
8 7808
Hello Magnus,

Why not just to "ping" the remote computer?

MTHi!
MT>
MTI'm trying to write a program that can tell if a remote computer is
MTrunning Windows or not. The thing is, it have to go very fast, so I
MTdon't want to "connect" to the computer.
MT>
MTMy plan is to send a netbios request and if I get a response I know
MTit's probably a Windows machine.
MT>
MTThe problem is that I can't use the Netbios function in
MTNETAPI32.DLL, because I can't "translate" the NCB struct to C#.
MT>
MTSo, can someone either show me how to convert the struct to C# or
MTtell me of a better or alternate way of solving my problem?
MT>
---
WBR, Michael Nemtsev [C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
Feb 21 '07 #2
Hello Michael,

non-Windows computers do not reply to ping? My unix server does...

"Michael Nemtsev" <ne*****@msn.co mwrote in message
news:a2******** *************** ****@msnews.mic rosoft.com...
Hello Magnus,

Why not just to "ping" the remote computer?

MTHi!
MTMTI'm trying to write a program that can tell if a remote computer
is
MTrunning Windows or not. The thing is, it have to go very fast, so I
MTdon't want to "connect" to the computer.
MTMTMy plan is to send a netbios request and if I get a response I
know
MTit's probably a Windows machine.
MTMTThe problem is that I can't use the Netbios function in
MTNETAPI32.DLL, because I can't "translate" the NCB struct to C#.
MTMTSo, can someone either show me how to convert the struct to C# or
MTtell me of a better or alternate way of solving my problem?
MT---
WBR, Michael Nemtsev [C# MVP]. My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


Feb 21 '07 #3
Hello Lebesgue,

They do. But take into account that on the remote machine firewall can be
turned on, so u can't see that machine even tryin' to ping

---
WBR, Michael Nemtsev [C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
LHello Michael,
L>
Lnon-Windows computers do not reply to ping? My unix server does...
L>
L"Michael Nemtsev" <ne*****@msn.co mwrote in message
Lnews:a2******* *************** *****@msnews.mi crosoft.com...
L>
>Hello Magnus,

Why not just to "ping" the remote computer?

MTHi!
MTMTI'm trying to write a program that can tell if a remote
computer
is
MTrunning Windows or not. The thing is, it have to go very fast, so
I
MTdon't want to "connect" to the computer.
MTMTMy plan is to send a netbios request and if I get a response
I
know
MTit's probably a Windows machine.
MTMTThe problem is that I can't use the Netbios function in
MTNETAPI32.DLL , because I can't "translate" the NCB struct to C#.
MTMTSo, can someone either show me how to convert the struct to
C# or
MTtell me of a better or alternate way of solving my problem?
MT---
WBR, Michael Nemtsev [C# MVP]. My blog:
http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/
"The greatest danger for most of us is not that our aim is too high
and we miss it, but that it is too low and we reach it" (c)
Michelangelo

Feb 21 '07 #4
"Lebesgue" <le******@gmail .comwrote in message
news:OI******** ******@TK2MSFTN GP05.phx.gbl...
Hello Michael,

non-Windows computers do not reply to ping? My unix server does...
And most Windows computers do *not* reply to NetBIOS request? NetBIOS is no longer enabled
per default, and is non routable.
Note that most companies do even turn off NetBios over TCP/IP and use NetBIOS-less SMB,
standardizing name resolution on DNS for file and printer sharing.

Willy.
Feb 21 '07 #5
Hello Michael,

I'm afraid you misunderstood the basic question. The OP wants to identify
computers on the network that are running windows.

"Michael Nemtsev" <ne*****@msn.co mwrote in message
news:a2******** *************** ****@msnews.mic rosoft.com...
Hello Lebesgue,

They do. But take into account that on the remote machine firewall can be
turned on, so u can't see that machine even tryin' to ping

---
WBR, Michael Nemtsev [C# MVP]. My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
LHello Michael,
LLnon-Windows computers do not reply to ping? My unix server does...
LL"Michael Nemtsev" <ne*****@msn.co mwrote in message
Lnews:a2******* *************** *****@msnews.mi crosoft.com...
L>
>>Hello Magnus,

Why not just to "ping" the remote computer?

MTHi!
MTMTI'm trying to write a program that can tell if a remote
computer
is
MTrunning Windows or not. The thing is, it have to go very fast, so
I
MTdon't want to "connect" to the computer.
MTMTMy plan is to send a netbios request and if I get a response
I
know
MTit's probably a Windows machine.
MTMTThe problem is that I can't use the Netbios function in
MTNETAPI32.DL L, because I can't "translate" the NCB struct to C#.
MTMTSo, can someone either show me how to convert the struct to
C# or
MTtell me of a better or alternate way of solving my problem?
MT---
WBR, Michael Nemtsev [C# MVP]. My blog:
http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/
"The greatest danger for most of us is not that our aim is too high
and we miss it, but that it is too low and we reach it" (c)
Michelangel o


Feb 21 '07 #6
Hello Lebesgue,

LHello Michael,
L>
LI'm afraid you misunderstood the basic question. The OP wants to
Lidentify computers on the network that are running windows.

uups, hard day, u know ;)
Feb 21 '07 #7
Hello Magnus,

I've missed your topic a little bit in my previous post :)

So, as was mentioned there you can't rely on netbios to detect OS

However, there are some ways to do this, not easy task but possible
I'd recommend u to google by "OS Fingerprint". This methods is based on heuristic
analysis of how OS respond to a selection of TCP/IP probes.

The main tools for this is "nmap"
You can read about nmap and the way of detection there http://insecure.org/nmap/osdetect/
---
WBR, Michael Nemtsev [C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

MTHi!
MT>
MTI'm trying to write a program that can tell if a remote computer is
MTrunning Windows or not. The thing is, it have to go very fast, so I
MTdon't want to "connect" to the computer.
MT>
MTMy plan is to send a netbios request and if I get a response I know
MTit's probably a Windows machine.
MT>
MTThe problem is that I can't use the Netbios function in
MTNETAPI32.DLL, because I can't "translate" the NCB struct to C#.
MT>
MTSo, can someone either show me how to convert the struct to C# or
MTtell me of a better or alternate way of solving my problem?
MT>
Feb 21 '07 #8
Thanks for all the replies.

I have read about OS fingerprinting, but I'm worried that active
security programs will pick up on that process and flag my application
as a hacker tool.

I guess I can make the use of OS fingerprinting optional, and warn
about the risks when you activate it.

Is OS fingerprinting the only reliable way to determine the OS of a
remote computer, without connecting to it?

/Magnus

On 21 Feb, 23:12, Michael Nemtsev <nemt...@msn.co mwrote:
Hello Magnus,

I've missed your topic a little bit in my previous post :)

So, as was mentioned there you can't rely on netbios to detect OS

However, there are some ways to do this, not easy task but possible
I'd recommend u to google by "OS Fingerprint". This methods is based on heuristic
analysis of how OS respond to a selection of TCP/IP probes.

The main tools for this is "nmap"
You can read about nmap and the way of detection therehttp://insecure.org/nmap/osdetect/

---
WBR, Michael Nemtsev [C# MVP].
My blog:http://spaces.live.com/laflour
Team blog:http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
Feb 22 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
16272
by: Snuffy2 | last post by:
I'm looking to try to get a users MAC and/or NetBIOS name when they visit my website. It somehow can be done, I'm not sure with PHP, but it can be done. Does anyone have any idea how? As an example check out: http://stealthtests.lockdowncorp.com/ On that site, there are tests that will display NetBIOS & MAC addresses.
4
14307
by: Dr. StrangeDub | last post by:
Leaving network identification/DNS out of the picture, how does one change the name of a computer in a local Workgroup (in C#)? I implemented the SetComputerName() API call and that only seems to change the NetBIOS Computer Name. I've verified that the underlying registry key value that gets changed is: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName Is there a recommended API (via Active...
3
9506
by: siddharth jain | last post by:
hello I want to write a little console application to get the NetBIOS names of a remote machine...exactly like the command nbtstat -a , but in a programmatic way. I googled around quite a bit but without success. Could someone plz guide me how to go abt doing this. Thanks Siddharth
4
15897
by: rdonnici | last post by:
Hi all, Is there any way to, given an IP address(or NETBIOS machinename - I can convert from one to other) from my network, and assuming that everyone needs to log on a NT/2K/Windows Server 2003 Server, to discover the user name for the user logged on that machine? The final result desired is something like a table, with pairs at the moment the program is run. Any ideas? I have hunted high and low on the newsgroups and have not...
0
1228
by: Will Price | last post by:
I am having problems using UDPClient.Send() in System.Net.Sockets. Each time I make the call to the function, there is a significant delay from when the code is executed to when the packet actually goes out. I took a look at the traffic and found that each time the UDPClient.Send() call was made, two UDP netbios messages go out on port 137. The device on the other end responds each time with an ICMP. After two attempts, the .Send...
4
3650
by: Michael Tissington | last post by:
Is it possible to read the NetBIOS domain name and if so how ? -- Michael Tissington http://www.oaklodge.com http://www.tabtag.com
0
930
by: Rob Rintjema | last post by:
I need to be able to communicate to a DOS based a novell netbios workstation using the .NET framework sockets.
3
2422
by: Erjan | last post by:
Hi, I am using TcpClient to connect to a device which does not talk NetBios. The TcpClient tries first to do something with Netbios. This probably failes on a timeout and then TcpClient sets up the TCP connection. Due to this it takes about 5 secons to set up a TCP connection on a LAN. Is it possible to disable the NetBios request ? I have rewritten the program with sockets but also sockets try to
4
7064
by: madankarmukta | last post by:
HI, I want to set my computername to be greate than 15 bytes.How can i do that since when i set the name greter that 15 bytes it's give me message that "The NetBIOS name of the computer is limited to 15 bytes" . Can anybody tell me how can i edit this limit of 15 bytes of NetBIOS name ..? Thanks!
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10435
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10213
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6779
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.