Get OS of Client

Hi, i need to know the OS of my clients.

greetings

Ask them.

I don’t think RouterOS has OS fingerprinting features.

You could use nmap from another device to map IPs to its best guess of what OS your clients are running.

If you use hotspot http authentication, you can put your hotspot auth page on a server which can log what the web browser claims its OS and other information to be.

The firewall in pfSense has the ability to finger print connections which pass through it if you want to use the client’s OS as a discriminator in a firewall rule. WIth it you could, for example, allow MacOS devices to get to the Internet and prevent Windows devices from getting out.

If your using PHP on hotspot login there are various ways to achieve this.

Php function browser_os()

Best,
Patrick

Hotspot doesn’t support PHP

I know this,

We redirect the html hotspot to a PHP file in our server to do authentication.

All you need to do is grab the user agent and then format it to a more usable form.

using something like: http://www.quirksmode.org/js/support.html

var ua = navigator.userAgent.toLowerCase();
var check = function(r) {
return r.test(ua);
};
var DOC = document;
var isStrict = DOC.compatMode == “CSS1Compat”;
var isOpera = check(/opera/);
var isChrome = check(/chrome/);
var isWebKit = check(/webkit/);
var isSafari = !isChrome && check(/safari/);
var isSafari2 = isSafari && check(/applewebkit/4/); // unique to
// Safari 2
var isSafari3 = isSafari && check(/version/3/);
var isSafari4 = isSafari && check(/version/4/);
var isIE = !isOpera && check(/msie/);
var isIE7 = isIE && check(/msie 7/);
var isIE8 = isIE && check(/msie 8/);
var isIE6 = isIE && !isIE7 && !isIE8;
var isGecko = !isWebKit && check(/gecko/);
var isGecko2 = isGecko && check(/rv:1.8/);
var isGecko3 = isGecko && check(/rv:1.9/);
var isBorderBox = isIE && !isStrict;
var isWindows = check(/windows|win32/);
var isMac = check(/macintosh|mac os x/);
var isAir = check(/adobeair/);
var isLinux = check(/linux/);
var isSecure = /^https/i.test(window.location.protocol);
var isIE7InIE8 = isIE7 && DOC.documentMode == 7;

var jsType = ‘’, browserType = ‘’, browserVersion = ‘’, osName = ‘’;
var ua = navigator.userAgent.toLowerCase();
var check = function(r) {
return r.test(ua);
};

if(isWindows){
osName = ‘Windows’;

if(check(/windows nt/)){
var start = ua.indexOf(‘windows nt’);
var end = ua.indexOf(‘;’, start);
osName = ua.substring(start, end);
}
} else {
osName = isMac ? ‘Mac’ : isLinux ? ‘Linux’ : ‘Other’;
}

if(isIE){
browserType = ‘IE’;
jsType = ‘IE’;

var versionStart = ua.indexOf(‘msie’) + 5;
var versionEnd = ua.indexOf(‘;’, versionStart);
browserVersion = ua.substring(versionStart, versionEnd);

jsType = isIE6 ? ‘IE6’ : isIE7 ? ‘IE7’ : isIE8 ? ‘IE8’ : ‘IE’;
} else if (isGecko){
var isFF = check(/firefox/);
browserType = isFF ? ‘Firefox’ : ‘Others’;;
jsType = isGecko2 ? ‘Gecko2’ : isGecko3 ? ‘Gecko3’ : ‘Gecko’;

if(isFF){
var versionStart = ua.indexOf(‘firefox’) + 8;
var versionEnd = ua.indexOf(’ ', versionStart);
if(versionEnd == -1){
versionEnd = ua.length;
}
browserVersion = ua.substring(versionStart, versionEnd);
}
} else if(isChrome){
browserType = ‘Chrome’;
jsType = isWebKit ? ‘Web Kit’ : ‘Other’;

var versionStart = ua.indexOf(‘chrome’) + 7;
var versionEnd = ua.indexOf(’ ', versionStart);
browserVersion = ua.substring(versionStart, versionEnd);
}else{
browserType = isOpera ? ‘Opera’ : isSafari ? ‘Safari’ : ‘’;
}