shell script

windows terminal server RDP отключить client disk mapping.

Метки: rdp, shell script

чтобы сделать отключение этого параметра надо создать дополнительный прослушиваель rdp-tcp на другом порту (я сделал 3390), и включить параметр fDisableCdm в [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp-3390] к примеру.

но как запретить пользователям доступ к стандартному прослушивателю с параметрами по умолчанию:

1. создаем скрипт:

qwinsta.exe | findstr.exe ^rdp.*3390 | findstr user
IF %ERRORLEVEL% NEQ 0 (
   logoff
)
some program

2. ставим его в скрипты при входе через групповую политику.

Открыть доступ только к windows update для сети с ipfw шлюзом.

Метки: FreeBSD, shell script

Script to make ip addresses from domain names :

#!/bin/sh
set -x
fin () {
    cat /tmp/listx | sort | uniq > /tmp/listwin
    ipfw table 1 flush
    cat /tmp/listmail | while read ip; do
    ipfw table 1 add $ip
    done
    ipfw table all list
}
rm /tmp/list*
while read -r name; do
i=1
while [ $i -le 15 ]; do
dig +short $name @8.8.8.8 >> /tmp/list1
dig +short $name @8.8.4.4 >> /tmp/list1
dig +short $name @77.88.8.8 >> /tmp/list1
dig +short $name @77.88.8.1 >> /tmp/list1
i=$(( i+1 ))
done
done</winupdate-hosts-list

bash multithreading xargs / reboot grandstream voip phones.

Метки: shell script

example reboot phone usage phone-reboot 192.168.0.1

#!/bin/bash

sid=$(curl -s -c /tmp/cookies.txt -d"password=admin" http://${1}/cgi-bin/dologin | sed -r 's|.*"sid" : "([0-9a-z]+)".*|\1|' )
curl -b /tmp/cookies.txt -d"request=REBOOT&sid=${sid}" http://${1}/cgi-bin/api-sys_operation

reboot all founded:

#!/bin/bash +x
str1=`arp -an | grep 00:0B`
rm -rf /tmp/tmp0011
while IFS= read -r line
do
ip=$(echo -n $line | grep -o -E '([0-9]{1,3}\.){3}[0-9a-z]{1,3}')
if [ "${ip}" ] ; then
        echo Rebooting ${ip}
        echo ${ip} >> /tmp/tmp0011

Shutting down esx using asterisk.

Метки: Asterisk, shell script, ssh

1. user is non root, need to login using it.
[root@as02 log]# su asterisk
This account is currently not available.
fixing this:
[root@as02 log]# chsh -s /bin/sh asterisk
to revert:
[root@as02 log]# chsh -s /sbin/nologin asterisk
2. ssh-keygen with default values and empty password.
3. it copies 2 files in home dir currently /var/lib/asterisk/.ssh
4. use public file in destionation server.

To allow SSH access to ESXi/ESX hosts with public/private key authentication:

Generate public/private keys. For detailed instructions, see the OpenBSD Reference Manual from OpenBSD.

PassGen

Метки: shell script

Default | 24 | 12 | 16 | 30

Give me passwords with characters. Starts with Pre name symbols

    1     J!X$?%9S

    2     XDIf!2#9

    3     5d!c?5Xq

    4     uQIfUNm4

    5     %3s%R3Nt


send mail from file shell script

Метки: shell script

2 files:

mail.sh

#!/bin/sh
while read i j; do
echo "Your password is: $j" | mail -s 'Your Password!' $i
sleep