четверг, 28 февраля 2019 г.

finding ip from MAC on Windows DHCP server with - powershell

Get-DhcpServerv4Scope | Get-DhcpServerv4Lease -ErrorAction SilentlyContinue -ClientId 02-0d-08-00-06-59 | Format-Table -Property IPAddress, ScopeId, ClientId, HostName, Description -AutoSize

вторник, 26 февраля 2019 г.

3сх cmd/ под windows 10 обработчик номеров

в браузере
использовать расширение
greasemonkey


для win7

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\sip]
@="URL:sip"
"EditFlags"=hex:02,00,00,00
"URL Protocol"=""
[HKEY_CLASSES_ROOT\sip\shell]
[HKEY_CLASSES_ROOT\sip\shell\open]
[HKEY_CLASSES_ROOT\sip\shell\open\command]
@="\"C:\\Program Files (x86)\\3CXPhone\\3CXPhone\" \"%1\""


для win10
d win 10 привести к виду
ветку реестра
@="\"C:\\Program Files (x86)\\3CXPhone\\3CXPhone\" \"%1\""
вот такому:
Компьютер\HKEY_CLASSES_ROOT\sip\shell\open\command
"C:\Program Files (x86)\3CXPhone\3CXPhone"%1


sip.vladlink.usercard.js

// Click to Dial SIP
// Author: Fiver.com/hybriditservices
// Made For: Paul Harvey
// License: GNU GPL v2 or later
// Modified version of:
//  Phone to Tel by Phone Guy (https://userscripts-mirror.org/scripts/show/56262)
//  Skype Linkify by Marco Abiuso (https://userscripts-mirror.org/scripts/show/10990)
//  VoIP Dialer Linkify by Ralf Muehlen (http://www.muehlen.com/projects/voip/voip_dial.user.js)
//  Inspired by: UPS Tracking Linkify (http://plutor.org/files/upslinkify.user.js) by Logan Ingalls
//
//
// ==UserScript==
// @name           Click to Dial SIP
// @namespace      http://fiverr.com/hybriditservice
// @description    Looks for phone numbers in the page and hyperlinks them for calling with any app registered to the sip: URI
// ==/UserScript==
//default country prefix
const defaultPrefix= '8';
(function () {
  //const trackRegex = /(\+\d\d\d?)?[\-\s\/\.]?[\(]?(\d){2,4}[\)]?[\-\s\/\.]?\d\d\d[\-\s\/\.]?(\d){2,4}\b/ig;
    //const trackRegex = /(\+\d\d\d?)?[\-\s\/\.]?[\(]?(\d?\d?){2,5}[\)]?[\-\s\/\.]?\d\d\d?\d?[\-\s\/\.]?(\d){2,5}\b/ig;      
 //const trackRegex = /\(?1300|1800|04)\b/ig;
 //const trackRegex =  /((\d{3})\s?\-\s?(\d{4}))|(\(\d{3}\)\s?\d{3}\s?\-\s?\d{4})|(\d{3}\s\d{4})|(\d{11})/g;
 //const trackRegex = /(\+61)\s\(2|4|3|7|8)){0,1}\){0,1}(\ |-)(\ |\s){0,1}[0-9]{2}(\ |-){0,1}[0-9]{2}(\ |-)(\ |\s){0,1}[0-9]{1}(\ |-){0,1}[0-9]{3}\b/ig;
    //Регулярное выражение для валидации номера телефона: /((8|\+7)[\- ]?)?(\(?\d{3}\)?[\- ]?)?[\d\- ]{7,10}\b/ig;
    const trackRegex = /(8|\+7|7)[\d]{7,10}\b/ig;
   
 function trackUrl(t) {
  if ((String(t).charAt(0) == '8')||(String(t).charAt(1) == '8'))
  {
     t= String(t);
     return "sip:" + (String(t).replace(/[\-\s\/\(\)\.]/g, ""));
  }
        if ((String(t).charAt(0) == '+')&&(String(t).charAt(1) == '7'))
  {
     t= String(t);
     return "sip:" + (String(t).replace("+7", "8"));
  }
        if (String(t).charAt(0) == '7')
  {
     t= String(t);
     return "sip:" + (String(t).replace("7", "8"));
  }
  /*if ((String(t).charAt(0) != '+')&&(String(t).charAt(1) != '1'))
  {
     t= defaultPrefix + String(t).replace("0","");
     return "sip:" + (String(t).replace(/[\-\s\/\(\)\.]/g, ""));
  }
        */
        /*
  if ((String(t).charAt(0) == '+')||(String(t).charAt(1) == '6'))
  {
     t= String(t);
     return "sip:" + (String(t).replace(/[\-\s\/\(\)\.]/g, ""));
  }
        */
 }
    // tags we will scan looking for un-hyperlinked urls
    var allowedParents = [
        //"b", "td"
        //"/html/body/table/tbody/tr/td.center_block/div.content/table.t-list/tbody/tr/td/b"
        "b"
        ];
    //alert (allowedParents);
   
    var xpath = "//text()[(parent::" + allowedParents.join(" or parent::") + ")" +
    //and contains(@class, 'table_nb')" +
    "]";
    var candidates = document.evaluate(xpath, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
    for (var cand = null, i = 0; (cand = candidates.snapshotItem(i)); i++) {
        if (trackRegex.test(cand.nodeValue)) {
            var span = document.createElement("span");
            var source = cand.nodeValue;
           
            cand.parentNode.replaceChild(span, cand);
            trackRegex.lastIndex = 0;
            for (var match = null, lastLastIndex = 0; (match = trackRegex.exec(source)); ) {
                span.appendChild(document.createTextNode(source.substring(lastLastIndex, match.index)));
               
                var a = document.createElement("a");
                a.setAttribute("href", trackUrl(match[0]));
                a.appendChild(document.createTextNode(match[0]));
                span.appendChild(a);
                lastLastIndex = trackRegex.lastIndex;
            }
            span.appendChild(document.createTextNode(source.substring(lastLastIndex)));
            span.normalize();
        }
    }
})();