воскресенье, 19 апреля 2015 г.

Генератор паролей

Взято отсюда
# MikroTik Random Password Generator
# with random start offset delay for use with /System Scheduler
# Author: Bob Burley - April 25, 2011
#
:local minRtt
:local maxRtt
:local random 0
:local siteAddress
:local charStrNum 1
:local p1
:local var1
:local var2
:local var3
:local newPassword ""
# set password length here
:local newPassLength 8
# Total characters to choose from is 73
# Eliminated confusing characters
# '0' (zero) and Upper Case 'O'
# '1' (one) and Upper Case 'I' and Lower Case 'l' (L)
:local charStr1 "23456789ABCDEFGHJKLMNPQRSTUVWXYZ23456789abcdefghijkmnopqrstuvwxyz23456789"
:local charStr2 "cN47iKd2bLn8sQz4JAu2PD6Vm5RjTG4UrFY78XewHE3W9gMq62v7a9Z5yf5pC3k6xt9Bh8S3o"
:local charStr3 "uYswW92z6M5fJynQp6hGm5VSr4oR8k7A2bKq5U3FiZvc8gHP2tdL9E4jBT3X7xC6N4D8e7a93"
# google.ca (74.125.95.147) - google.com (74.125.95.99) - yahoo.ca (68.180.206.184) - yahoo.com (209.191.122.70)
:local arraySiteList [:toarray ("74.125.95.147","74.125.95.99","68.180.206.184","209.191.122.70")]
:foreach siteAddress in=($arraySiteList) do={
  /tool flood-ping $siteAddress count=4 do={
    :if ($sent=4) do={
      :set minRtt $"min-rtt"
      :set maxRtt $"max-rtt"
    }
    :set random ($random + minRtt)
    :while ($random > 59) do={
      :set random ($random -60)
    }
    :set random ($random + maxRtt)
    :while ($random > 59) do={
      :set random ($random -60)
    }
  }
}
:delay $random
:for char from=1 to=$newPassLength step=1 do={
#  Generate number between 0 and 72
  :set var1 ([:pick [/system clock get time] 6 8])
  :set p1 ([:len [/system resource get uptime]])
  :set var2 ([:pick [/system resource get uptime] ($p1-2) $p1])
  :set var3 (($var1 * $var2) / 48)
#  pick next character to add to the new password
  :if ($charStrNum=1) do={
    :set newPassword ($newPassword . [:pick $charStr1 $var3])
  }
  :if ($charStrNum=2) do={
    :set newPassword ($newPassword . [:pick $charStr2 $var3])
  }
  :if ($charStrNum=3) do={
    :set newPassword ($newPassword . [:pick $charStr3 $var3])
  }
  :set charStrNum ($charStrNum + 1)
  :if ($charStrNum = 4) do={
    :set charStrNum 1
  }
  :delay (($var1 + $var2 + $var3) / 5)
}
:log info $newPassword
Скрипт выполняется не сразу. IP можно заменить  на свои.

Подписаться на новые статьи.

Комментариев нет:

Отправить комментарий