#!/usr/bin/env python
import os, csv, sys, subprocess, hashlib, time, pytz
from datetime import timedelta, datetime, tzinfo
import pytz
import tzlocal
writer = csv.writer(sys.stdout, quoting=csv.QUOTE_ALL)
il = pytz.timezone('Israel')
local_timezone = tzlocal.get_localzone() # get pytz timezone
with open('file.csv', 'w', newline='', encoding='utf-8') as csvfile:
spamwriter = csv.writer(csvfile, delimiter=',',
quotechar='"', quoting=csv.QUOTE_MINIMAL)
for directory, Read more [...]
Limit the Bandwidth for Specific Network On Cisco ASA 5510
| March 20th, 2017The Bandwidth will be reduced to 6 Mbps
access-list ACL-Guest extended permit ip object Guest_VLAN any access-list ACL-Guest extended permit ip any object Guest_VLAN class-map CM-THROTTLE-Guest match access-list ACL-Guest exit policy-map PM-THROTTLE class CM-THROTTLE-Guest police output 6000000 2000 police input 6000000 2000 exit exit service-policy PM-THROTTLE interface inside
A Python Script to Backup Cisco Routers and Switches
| March 20th, 2017Backup Cisco Routers and Switches
#!/usr/bin/python
import pexpect,sys,string,os,time,subprocess,getpass
if len(sys.argv) !=2:
print ("usage: backup [user@]hostname")
else:
input_data = sys.argv[1]
data=input_data.split("@")
switch_un = data[0]
switch_ip = data[1]
switch_pw1 = getpass.getpass("Enable Password:")
switch_pw2 = getpass.getpass("Privilege Password:")
basic_backup_directory = "/tmp/Network_Backups"
print ("Please wait ...")
try:
try:
child = pexpect.spawn('ssh %s@%s' % (switch_un, switch_ip))
child.timeout Read more [...]
FreeNas Warning 3
| March 12th, 2017WARNING: Firmware version 13 does not match driver version 12 for /dev/mpr1. Please flash controller to P12 IT firmware.
After flashing /dev/mpr0, another warning message regarding /dev/mpr1.
Listing all controller details:
sas3flash -listall
It brought up two different controllers, first one in IT firmware, and the second one in IR mode. I've already downloaded the Driver for my controller which included the IR firmware as well. File name I've downloaded is: 9300_8i_Package_P12_IR_IT_FW_BIOS_for_MSDOS_Windows.zip
Copied the file in the Firmware\SAS9311_8i_IR to my freeNas server. Then flashed it Read more [...]
Fix Amazon EC2 SSH login
| November 20th, 2016Logged out of Amazon instance and SSH is not working
Blocked myself with CSF firewall on a Centos 7 server. With the "Run Command" feature was not available, and no web terminal or VNC console such as the one in digitalocean(https://www.digitalocean.com/community/tutorials/how-to-use-the-digitalocean-console-to-access-your-droplet). After reading around I found out that the only solution is to stop the running instance, detach the volume, create another Linux instance (shouldn't be the same as the running one), then attach the old volume to the newly Read more [...]
Powershell Commands
| October 24th, 2016Close all opened sessions
Get-PSSession | Remove-PSSession
Remove all variables from session
Get-Variable -Exclude PWD,*Preference | Remove-Variable -EA 0
Install SSMTP on Centos 7
| August 31st, 2016
Add the repo if it's not added:
yum install epel-release -y
Install:
yum -y install ssmtp
(yum install mailx) if not installed
Configure:
alternatives --config mta
There are 2 programs which provide 'mta'.
Selection Command
-----------------------------------------------
*+ 1 /usr/sbin/sendmail.postfix
2 /usr/sbin/sendmail.ssmtp
Enter to keep the current selection[+], or type selection number:
2
Disable postfix (or sendmail):
systemctl stop postfix
systemctl disable Read more [...]
Configuring Linux DHCP to work with LYNC
| May 27th, 2016Lync to Post
Kaspersky add network to firewall
| May 8th, 2016Add a network to Kaspersky Security center firewall
To add a network to Kaspersky security center:
kaspersky > Managed Computers > Policies > Endpoint > Firewall > Available Networks > Settings > add/edit Network as trusted network
Freenas Warning 2
| February 29th, 2016WARNING: Firmware version 5 does not match driver version 9 for /dev/mpr0. Please flash controller to P9 IT firmware.
External SAS card: LSI 9300-8e
Downloaded first the installer from:
http://www.avagotech.com/products/server-storage/host-bus-adapters/sas-9300-8e#downloads
The Installer: Installer_P9_for_FreeBSD
Firmware and Bios: 9300_8e_Package_P9_IT_Firmware_BIOS_for_MSDOS_Windows
To flash it, I moved the installed and the firmware and bios files to Freenas.
Before flashing, I had to make sure the SAS controller is in IT mode by executing
sas3flash -list
I could see that : Firmware Product Read more [...]