Skip to content

Instantly share code, notes, and snippets.

@dynax60
dynax60 / genpas-strong.pl
Created March 16, 2011 11:20
Simple password generator
#!/usr/bin/perl
use strict;
use warnings;
my $passcnt = shift || 1; # how much passwords to generate
my $passlen = shift || 8; # password length
my @alph = ('A'..'Z','a'..'z',0..9,'%','*');
my $alph_size = scalar(@alph);
srand($$);
@dynax60
dynax60 / linux.rc
Created March 30, 2011 05:24
Example of Hypnotoad startup-script for linux
#!/bin/bash
#
# Init file for Ping server daemon
#
# chkconfig: 2345 55 25
# description: Ping server daemon
#
# processname: ping
# pidfile: /var/run/ping.pid
@dynax60
dynax60 / snmp-backup-es3528.sh
Created April 12, 2011 07:25
Configuration backup from ES3528
#!/bin/sh
# ES3528
TFTP_SERVER=${TFTP_SERVER:-"10.X.X.X"}
RW_COMMUNITY=${RW_COMMUNITY:-"private"}
PATH=/bin:/usr/bin:/usr/local/bin
[ -s $1 ] || { echo "No such file or file is empty: $1" >&2; exit 1; }
for h in `cat $1`
@dynax60
dynax60 / snmp-backup-des35xx.sh
Created April 12, 2011 07:57
Configuration backup from DES-35XX, DES-38XX, DES-32XX
#!/bin/sh
# DES-35XX, DES-38XX, DES-32XX
TFTP_SERVER=10.X.X.X
RW_COMMUNITY=private
PATH=/bin:/usr/bin:/usr/local/bin
[ -s $1 ] || { echo "No such file or file is empty: $1"; exit 1; }
for h in `cat $1`
[root@virtual-pbx ~]# mkdir -p /storage/10.0.0.16
[root@virtual-pbx ~]# cat /etc/auto.master | egrep -v '^(#|$)'
/storage /etc/auto.smb.top
[root@virtual-pbx ~]# cat /etc/auto.smb.top | egrep -v '^(#|$)'
* -fstype=autofs,-Dhost=& file:/etc/auto.smb.sub
[root@virtual-pbx ~]# cat /etc/auto.smb.sub | egrep -v '^(#|$)'
* -fstype=cifs,credentials=/root/cifs.conf,uid=0,gid=0 ://10.0.0.16/&
[root@virtual-pbx ~]# cat /root/cifs.conf
username=admin
password=mypassword
# smbclient -U admin -L //10.0.0.16/
Password:
Domain=[DISKSTATION] OS=[Unix] Server=[Samba 3.2.8]
Sharename Type Comment
--------- ---- -------
home Disk home
homes Disk user home
public Disk System default share
IPC$ IPC IPC Service ()
#!/bin/sh
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PIDFILE=${PIDFILE:-"/var/run/mv2smb.pid"}
LOCAL_DIR=${LOCAL_DIR:-"/var/lib/asterisk/records"}
FTP_HOST=${FTP_HOST:-""}
FTP_USER=${FTP_USER:-"admin"}
FTP_PASS=${FTP_PASS:-""}
REMOTE_DIR=${REMOTE_DIR:-"/homes"}
#!/bin/sh
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PIDFILE=${PIDFILE:-"/var/run/mv2smb.pid"}
LOCAL_DIR=${LOCAL_DIR:-"/var/lib/asterisk/records"}
REMOTE_SMB=${REMOTE_SMB:-"//10.1.1.1/homes"}
REMOTE_SMB_AUTH=${REMOTE_SMB_AUTH:-"/path/to/mv2smb.conf"}
REMOTE_DIR=${REMOTE_DIR:-""}
if [ -f $PIDFILE ]; then
@dynax60
dynax60 / snmp-backup-es4524d.sh
Created May 18, 2011 10:23
Configuration backup from Edge-Core ES4524D
#!/bin/sh
# ES4524D
TFTP_SERVER=${TFTP_SERVER:-""}
RW_COMMUNITY=${RW_COMMUNITY:-"private"}
PATH=/bin:/usr/bin:/usr/local/bin
TFTP_SERVER_HEX=`perl -MSocket -le 'print unpack("H*", inet_aton(shift))' $TFTP_SERVER`
null@ubuntu:~/t$ perl -le '$_ = "test"; print y===c'
4
null@ubuntu:~/t$ perl -MO=Deparse -le '$_ = "test"; print y===c'
BEGIN { $/ = "\n"; $\ = "\n"; }
$_ = 'test';
print tr//\000-\377/c;
-e syntax OK
null@ubuntu:~/t$