Navigation

Linux

Linux HDR photography

HDR:

Pspell / Aspell and linux

Install programs (czech dictionary):

apt-get install libpspell-dev php5-pspell aspell-cs

Use program in PHP:

Howto protect Linux server - Quick install fail2ban

Install fail2ban:

apt-get install fail2ban

Copy configuration file to right place:

cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local

Edit configuration file

[DEFAULT]
...
bantime  = 600 # = 10min (bigger = better)
...
banaction = iptables-allports


[ssh]
enabled  = true

[ssh-ddos]
enabled  = true

Restart service:

service fail2ban restart

Check iptables:

iptables -L -n

Log file:

Symfony2 framework,

Alternativy:
Laravel framework,
Phalcon framework,
Symfony2 framework,
Code Igniter framework

Install programs:
 

Wireshark / tShark

Get network log via terminal by tShark:

 tshark -i eth0 -R "ip.dst==192.168.1.5 or ip.src==192.168.1.5" -V

Linux:

tshark -i eth0 -V -F libpcap -w /tmp/tsharklog.pcap

Windows:

tshark.exe -D # print all ethernet devices
tshark.exe -i 2 -F pcap -w C:\_Data_\log.txt

Linux bash tricks and tips

Read all txt files, convert from UCS-2 to UTF-8 and print lines with text:

for f in *.txt; do cat $f | iconv -f UCS-2 -t UTF-8 | grep "Text"; done

Convert picture to 1x1px (average color/color summary) | except blank/empty lines and comments:

convert storm/000020196.png -resize 1x1  txt:- | grep -v '^$\|^\s*\#'

Send voice track to google for convert to text (i think that it doesnt work):

Linux WIFI hotspot

eth1 - internet
wlan1 - internal network

 

Install programs:

 apt-get install dhcp3-server hostapd iptables

 

Set wlan1 IP

ip link set dev wlan1 up
ip addr add 10.10.0.1/24 brd + dev wlan1

 

/etc/hostapd/hostapd.conf

interface=wlan1
bridge=br0
driver=nl80211
ssid=APname
hw_mode=b
channel=1
wpa=2
wpa_passphrase=password
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
wpa_ptk_rekey=600

 

/etc/default/dhcp3-server

gphoto2 - Remote controllable cameras

Install:

apt-get install gphoto2

visudo:

www-data ALL = NOPASSWD: /usr/bin/gphoto2

Example:

gphoto2 --auto-detect
gphoto2 --list-all-config
gphoto2 --capture-image-and-download --camera="Canon PowerShot A520 (PTP mode)"
gphoto2  --set-config zoom=0 --set-config imagequality=2 --set-config aperture=53 --capture-image-and-download --filename `date +%Y%m%d%H%M%S`.jpg

PHP:

wpasupplicant

Install:
 

apt-get install wpasupplicant

Run commands:
 

wpa_passphrase ESSID "password" > wpa_supplicant.conf
wpa_supplicant -i wlan1 -c wpa_supplicant.conf -B -dd
dhclient3 wlan1

Edit file: /etc/network/interfaces

#Wireless Networking Devices
auto wlan1
iface wlan1 inet dhcp
        pre-up wpa_supplicant -D wext -i wlan1 -c /etc/wpa_supplicant.conf -B
        post-down killall -q wpa_supplicant

If not run after boot, edit: /etc/rc.local

Pages

Subscribe to Linux