Hi,
How to detect remote machine os, while connecting?
I want to find out remote machine os is windows/unix/linux/solaries, without login into the machine, while connecting itself.
Thanks
srikanth
17 6245 RonB 589
Expert Mod 512MB
You need to provide more details on what you need to accomplish and in what context is the user connecting. Is this connection via a network share, or a web service, or RDP or telnet or ssh or something else?
You will probably also need to post your script and any errors/warnings that it generates.
Hi Ron,
I am connecting hosts via Telnet. So can u guide me how to know the host's os.
Thanks
srikanth
Are you saying that your using telnet from the system command in Perl, from a Perl Module, or are you using telnet on the command line without the use of Perl? You need to please specify.
If you are using Perl for this, then you NEED to please provide your code, otherwise we will be grasping at straws, blindly.
Regards,
Jeff
Here is the code i use to connect host using telnet.
1. use Net::Telnet;
2. $telnet = new Net::Telnet ( Timeout=>60, Errmode=>'die');
3. $telnet->open('10.xxx.xxx.xxx'); # unix/win/linux/sun
4. $telnet->waitfor('/login: $/i');
5. $telnet->print('administrator'); # root/administrator
6. $telnet->waitfor('/password: $/i');
7. $telnet->print('admin');
8. $telnet->waitfor('/\>/'); # '/\>/'--win, '/# $/i' - unix
I need to know the os of host, before i login. at step 3.
so that i will write my own code to perform as per the os. bcz
"telnet->waitfor('/\>/');" is differ for os.
Thanks
srikanth
using eclipse i am executing perl code.
RonB 589
Expert Mod 512MB
You can't use telnet to determine the OS prior to login, but you can use the nmap utility to scan the host and determine the OS. However, keep in mind that there is no reliable way to accurately determine the OS prior to logging into the system.
nmap network scanner: http://nmap.org/
Perl module to interface with nmap: Nmap::Scanner
Output from a scan of google.com
C:\Users\RKB>nmap -O -sSU google.com
Starting Nmap 5.21 ( http://nmap.org ) at 2012-09-26 06:28 Pacific Daylight Time
Nmap scan report for google.com (74.125.224.105)
Host is up (0.0028s latency).
Hostname google.com resolves to 11 IPs. Only scanned 74.125.224.105
rDNS record for 74.125.224.105: nuq04s08-in-f9.1e100.net
Not shown: 998 filtered ports, 998 open|filtered ports
PORT STATE SERVICE
80/tcp open http
113/tcp closed auth
443/tcp open https
33459/udp closed unknown
Device type: WAP|printer|webcam|general purpose
Running (JUST GUESSING) : Linksys Linux 2.4.X (87%), Lexmark embedded (87%), AXIS Linux 2.6.X (87%), Linux 2.6.X|2.4.X (86%)
Aggressive OS guesses: OpenWrt White Russian 0.9 (Linux 2.4.30) (87%), Lexmark X644e printer (87%), AXIS 211A Network Camera (Linux 2.6) (87%), AXIS 211A Network Camera (Linux 2.6.20) (87%), OpenWrt Kamikaze 7.09 (Linux 2.6.2
2) (86%), Linux 2.6.24 (86%), OpenWrt 0.9 - 7.09 (Linux 2.4.30 - 2.4.34) (85%), Linux 2.4.20 - 2.4.27 (85%)
No exact OS matches for host (test conditions non-ideal).
Network Distance: 14 hops
OS detection performed. Please report any incorrect results at http://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 13.47 seconds
i hear that we can use socket function also to check os. if any help in this, it would be helpful for my script.
can you give simple code to check host os.
RonB 589
Expert Mod 512MB
Sorry, I don't know of any server service that would easily give you the OS, so I can't give you what you want.
The nmap utility tries to "guess" the OS by looking at key "footprints", but I have no idea how they do that, however nmap is open source, so you can look at it's source code to try to find out how they attempt to discover the OS.
Why is it so important for you to know the OS prior to login?
If you're able to login via telnet, then it would be simple to execute a command to learn that info.
if i know the os, then i will login to specified host and write my code individually. because commands are differ from win to unix. commands are simple - diskpart,...
RonB 589
Expert Mod 512MB
Then the simple solution would be to put the OS specific code into subroutines and AFTER you login, you determine the OS and then execute the proper subroutine.
RonB 589
Expert Mod 512MB
The more I read over your posts, the more it appears to me that you're attempting to write some sort of malware.
Hi RonB,
If you see my code above, if i know the host os with that i can recognize(windows command prompt - >, unix - $) the host type and then i can proceed my code as per. For my job needs username(step 5) needs only administrator for windows and root for unix/linux. so if i know it before i will go straight.
After i connect, i have to give username. There i need to know the OS type. Based on that i will give username.
RonB 589
Expert Mod 512MB
You're not going to be able to determine the OS prior to login.
RonB 589
Expert Mod 512MB
Here's an example demonstrating the fact that you won;t be able to accurately determine the OS. -
#!/usr/bin/perl
-
-
use 5.10.1;
-
use strict;
-
use warnings;
-
use XML::Simple;
-
use Data::Dumper;
-
-
close STDERR;
-
-
foreach my $ip ( qw(10.100.0.130 10.100.0.119 10.100.0.118) ) {
-
say "scanning $ip";
-
say '-' x 21;
-
my $nmap = `nmap -v -v -v -O -oX - $ip`;
-
my $nmap_xml = XMLin($nmap);
-
say Dumper keys %{ $nmap_xml->{host}{os}{osmatch} };
-
}
-
Outputs:
scanning 10.100.0.130
---------------------
$VAR1 = 'name';
$VAR2 = 'accuracy';
$VAR3 = 'line';
scanning 10.100.0.119
---------------------
scanning 10.100.0.118
---------------------
$VAR1 = 'AXIS 211A Network Camera (Linux 2.6.20)';
$VAR2 = 'Linux 2.6.17 (Mandriva)';
$VAR3 = 'Linux 2.6.9 - 2.6.18';
$VAR4 = 'Linux 2.6.22 - 2.6.23';
$VAR5 = 'IBM System Storage DS4700 NAS device';
$VAR6 = 'Linux 2.6.9 - 2.6.27';
$VAR7 = 'Linux 2.6.9 - 2.6.28';
$VAR8 = 'Linux 2.6.28 (Gentoo)';
$VAR9 = 'AXIS 211A Network Camera (Linux 2.6)';
$VAR10 = 'Linux 2.6.18 (Centos 5.3)';
All 3 of those hosts are on the local network.
Can you tell me the OS for the first 2 and which one of those 10 results for the 3rd host is correct?
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Marina Anufreichik |
last post by:
Hi,
After deploymnet web application on web server I can access page on local
machine and login fine but when I'm trying to access web site from remote
machine I can see login page, but when I'm...
|
by: McGeeky |
last post by:
Is it possible to install an assembly on a remote machine's GAC? I don't see
an option for it using gacutil.exe
--
McGeeky
http://mcgeeky.blogspot.com
|
by: Rohith |
last post by:
I need to import dlls that are present in the remote machine. Its a dll
written in C that exposes methods. I want to import that dll in my C#
application. But that dll is not present in the local...
|
by: Winterminute |
last post by:
I am trying to read a list of install programs using WMI with ASP.NET/C#.
However, it fails with "Invalid Class".
I have confirmed that if I query LOCALHOST then it works fine, but if I
query a...
|
by: Wiwo |
last post by:
Hello there!
I'm trying to enable/disable a network interface card on a remote
machine. No, I don't cut my own connection. The machine has two network
interfaces and I want to control the second...
|
by: Chris Johnson |
last post by:
Hey all,
I have a small app I have developed that periodically pings a list of server
and returns their status. Given my environment I have setup the program such
that a server can be down 4...
|
by: remya1000 |
last post by:
i'm tring to start a calculator in a remote machine from my system. and the codes i tried is this.
Module Module1
Sub Main()
Dim retValue As String
retValue =...
|
by: Chris Marsh |
last post by:
All
I've been asked run a VM on my development machine, with Windows Server 2003
installed. I've also been asked to then develop against this environment
from the host machine, using Visual...
|
by: vinoj |
last post by:
Hi All,
These are the following things which i want to do:-
1. I will be taking the ipaddress, username and password from the user using cgi ffrom the browser.
2. Now i want...
|
by: Namitha Bhat |
last post by:
Hi ALL,
This realates to vb script code to append a file in C Drive in a remote machine accessed from a machine in different domain. I am able to successfully connect to the machine, but the file...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
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,...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
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...
| | |