Dosya şifrelemek (zip, tar vs)

Aralık 29, 2014 § Yorum yok § Kalıcı bağlantı

En iyi yol gpg kullanmak gibi görünüyor
Bir klasörü tarlayip şifrelemek için

tar -cf - ./resimler | gpg -c -o  resimler.tar.gpg

Tar dosyasini açmak için

gpg  resimler.tar.gpg | tar -x -f resimler.tar

openssl’de bir alternatif ama ben gpg tavsiye ederim.
Şirelemek için

tar -cf - directory | openssl aes-128-cbc -salt -out directory.tar.aes

Açmak için

openssl aes-128-cbc -d -salt -in directory.tar.aes | tar -x -f -

NSA neyi kırar, neyi kıramaz?

Aralık 29, 2014 § Yorum yok § Kalıcı bağlantı

Faydali birkaç link
leaksource.info
spiegel.de
cryptome.org

Basit Download Hız Tespiti

Aralık 29, 2014 § Yorum yok § Kalıcı bağlantı

wget ile

wget --output-document=/dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip

curl ile

curl -o /dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip

IP adresini yenilemek

Aralık 12, 2014 § Yorum yok § Kalıcı bağlantı

eth0’ın ip adresini bırakalım

dhclient -r eth0

eth0’a yeni ip adresi alalım

dhclient eth0

Linux’de geri plana iş vermek

Aralık 2, 2014 § Yorum yok § Kalıcı bağlantı

Linux’de geri planda iş yapmak için en beğendiğim program screen

İş vermek için “screen -dmSL [session_adi] [komut]” kullanılabilir.
-d: Hemen detach et
-S: Session adi ver
-m: Yeni session yarat
-L: ~/screenlog.0 log dosyasini olustur

Örneğin

screen -dmSL deneme-screen_adi ffmpeg ali.avi veli.avi

İşlemin durumunu görmek için -x kullanılabilir.

screen -x deneme-screen_adi

dd’nin İstatistiklerini Almak

Kasım 19, 2014 § Yorum yok § Kalıcı bağlantı

dd komutunun veri istatistiklerini almak için prosese “USR1” sinyali gönderilmelidir.

dd if=/dev/random of=/dev/null& pid=$!
kill -USR1 $pid

nc İle Ağ Hızı Testi

Kasım 12, 2014 § Yorum yok § Kalıcı bağlantı

A bilgisayarı ile B bilgisayarı arasında ağ hızını ölçmek için netcat kullanabiliriz.

A bilgisayarında bağlantıyı dinleyelim

nc -l -p 2222 > /dev/null

B bilgisayarında veri gönderelim

dd if=/dev/zero bs=160000 count=625 | nc -n A.bilgisayarının.adresi 2222 

Uzaktaki bilgisayarın portunun durum tespiti

Kasım 10, 2014 § Yorum yok § Kalıcı bağlantı

Uzaktaki bir bilgisayarın bir portunun durumunu öğrenmek için o porta paket gönderilebilir. Ping spesific bir port için kullanılmaz. Çünkü ping Layer-2 de çalışır, TCP/UDP nin yürütüldüğü Layer-3’te değil.

Linuxte bunu yapmak için Layer-3 programlar kullanmak lazım. İşte bazı yollar:

1.nmap

TCP paketi için

nmap -p 80 -sT www.google.com

UDP paketi için

nmap -p 80 -sU www.google.com

2.nc

TCP paketi için

 nc -zvv www.google.com 80

UDP paketi için

 nc -zuvv www.google.com 80

Genel bir tarama yapmak için

sudo nmap -n -PN -sT -sU -p- www.google.com

Linux Cheat

Ağustos 7, 2014 § Yorum yok § Kalıcı bağlantı

Bilindiği üzere linuxde yardım almak için birçok komut kullanılabilir. Örneğin ‘komut’ için yardım istediğimizde man komut, komut — help, whereis komut veya whatis komut kullanılabilir.
Fakat aranan bilgi genellikle kısadır ve gereksiz bilgileri süzmek zaman kaybına yol açmaktadır.
Bu kadar fazla yardım mekanizması olmasına rağmen benim tanıdığım bütün sistem yöneticileri Google abiye de sormaktadır.
“cheat” komutu sayesinde daha az Google yapabileceğimizi düşünüyorum.
cheat’i kurmak için python ve pip kurulu olmalıdır. Cheat’i git klonlayarak kullanacağımız için git’i de kuralım.

# yum install python
# yum install python-pip
# yum install git

Şimdi ihtiyaç duyulan python bağımlılıklarını kuralım

# pip install docopt pygments

Herhangi bir bağımlılığımız kalmadı. Şimdi git deposunu klonlayabilir ve kurulumu yapabiliriz.

# git clone https://github.com/chrisallenlane/cheat.git
# cd cheat
# python setup.py install

cheat kurulumu tamamlandı. Şimdi kullanalım:

[root@zinnetb bash_completion.d]# cheat dd
# Read from {/dev/urandom} 2*512 Bytes and put it into {/tmp/test.txt}
# Note: At the first iteration, we read 512 Bytes.
# Note: At the second iteration, we read 512 Bytes.
dd if=/dev/urandom of=/tmp/test.txt count=512 bs=2

# Watch the progress of 'dd'
dd if=/dev/zero of=/dev/null bs=4KB &; export dd_pid=`pgrep '^dd'`; while [[ -d /proc/$dd_pid ]]; do kill -USR1 $dd_pid && sleep 1 && clear; done

# Watch the progress of 'dd' with `pv` and `dialog` (apt-get install pv dialog)
(pv -n /dev/zero | dd of=/dev/null bs=128M conv=notrunc,noerror) 2>&1 | dialog --gauge "Running dd command (cloning), please wait..." 10 70 0

# Watch the progress of 'dd' with `pv` and `zenity` (apt-get install pv zenity)
(pv -n /dev/zero | dd of=/dev/null bs=128M conv=notrunc,noerror) 2>&1 | zenity --title 'Running dd command (cloning), please wait...' --progress

# DD with "graphical" return
dcfldd if=/dev/zero of=/dev/null bs=500K


[root@zinnetb bash_completion.d]# 

Kurulmuş cheat dosyalarını görmek için

[root@zinnetb bash_completion.d]# cheat -d 
/root/.cheat
/usr/lib/python2.7/site-packages/cheat/cheatsheets

[root@zinnetb bash_completion.d]# cheat -l
7z             /usr/lib/python2.7/site-packages/cheat/cheatsheets/7z
ab             /usr/lib/python2.7/site-packages/cheat/cheatsheets/ab
apk            /usr/lib/python2.7/site-packages/cheat/cheatsheets/apk
apparmor       /usr/lib/python2.7/site-packages/cheat/cheatsheets/apparmor
apt-cache      /usr/lib/python2.7/site-packages/cheat/cheatsheets/apt-cache
apt-get        /usr/lib/python2.7/site-packages/cheat/cheatsheets/apt-get
aptitude       /usr/lib/python2.7/site-packages/cheat/cheatsheets/aptitude
asciiart       /usr/lib/python2.7/site-packages/cheat/cheatsheets/asciiart
asterisk       /usr/lib/python2.7/site-packages/cheat/cheatsheets/asterisk
at             /usr/lib/python2.7/site-packages/cheat/cheatsheets/at
awk            /usr/lib/python2.7/site-packages/cheat/cheatsheets/awk
bash           /usr/lib/python2.7/site-packages/cheat/cheatsheets/bash
chmod          /usr/lib/python2.7/site-packages/cheat/cheatsheets/chmod
chown          /usr/lib/python2.7/site-packages/cheat/cheatsheets/chown
convert        /usr/lib/python2.7/site-packages/cheat/cheatsheets/convert
crontab        /usr/lib/python2.7/site-packages/cheat/cheatsheets/crontab
curl           /usr/lib/python2.7/site-packages/cheat/cheatsheets/curl
cut            /usr/lib/python2.7/site-packages/cheat/cheatsheets/cut
date           /usr/lib/python2.7/site-packages/cheat/cheatsheets/date
dd             /usr/lib/python2.7/site-packages/cheat/cheatsheets/dd
df             /usr/lib/python2.7/site-packages/cheat/cheatsheets/df
dhclient       /usr/lib/python2.7/site-packages/cheat/cheatsheets/dhclient
diff           /usr/lib/python2.7/site-packages/cheat/cheatsheets/diff
distcc         /usr/lib/python2.7/site-packages/cheat/cheatsheets/distcc
emacs          /usr/lib/python2.7/site-packages/cheat/cheatsheets/emacs
find           /usr/lib/python2.7/site-packages/cheat/cheatsheets/find
gcc            /usr/lib/python2.7/site-packages/cheat/cheatsheets/gcc
gdb            /usr/lib/python2.7/site-packages/cheat/cheatsheets/gdb
git            /usr/lib/python2.7/site-packages/cheat/cheatsheets/git
gpg            /usr/lib/python2.7/site-packages/cheat/cheatsheets/gpg
grep           /usr/lib/python2.7/site-packages/cheat/cheatsheets/grep
gs             /usr/lib/python2.7/site-packages/cheat/cheatsheets/gs
head           /usr/lib/python2.7/site-packages/cheat/cheatsheets/head
history        /usr/lib/python2.7/site-packages/cheat/cheatsheets/history
ifconfig       /usr/lib/python2.7/site-packages/cheat/cheatsheets/ifconfig
indent         /usr/lib/python2.7/site-packages/cheat/cheatsheets/indent
ip             /usr/lib/python2.7/site-packages/cheat/cheatsheets/ip
iptables       /usr/lib/python2.7/site-packages/cheat/cheatsheets/iptables
irssi          /usr/lib/python2.7/site-packages/cheat/cheatsheets/irssi
iwconfig       /usr/lib/python2.7/site-packages/cheat/cheatsheets/iwconfig
journalctl     /usr/lib/python2.7/site-packages/cheat/cheatsheets/journalctl
less           /usr/lib/python2.7/site-packages/cheat/cheatsheets/less
ln             /usr/lib/python2.7/site-packages/cheat/cheatsheets/ln
ls             /usr/lib/python2.7/site-packages/cheat/cheatsheets/ls
lsof           /usr/lib/python2.7/site-packages/cheat/cheatsheets/lsof
markdown       /usr/lib/python2.7/site-packages/cheat/cheatsheets/markdown
mkdir          /usr/lib/python2.7/site-packages/cheat/cheatsheets/mkdir
mount          /usr/lib/python2.7/site-packages/cheat/cheatsheets/mount
mysql          /usr/lib/python2.7/site-packages/cheat/cheatsheets/mysql
mysqldump      /usr/lib/python2.7/site-packages/cheat/cheatsheets/mysqldump
ncat           /usr/lib/python2.7/site-packages/cheat/cheatsheets/ncat
netstat        /usr/lib/python2.7/site-packages/cheat/cheatsheets/netstat
nmap           /usr/lib/python2.7/site-packages/cheat/cheatsheets/nmap
notify-send    /usr/lib/python2.7/site-packages/cheat/cheatsheets/notify-send
od             /usr/lib/python2.7/site-packages/cheat/cheatsheets/od
openssl        /usr/lib/python2.7/site-packages/cheat/cheatsheets/openssl
pacman         /usr/lib/python2.7/site-packages/cheat/cheatsheets/pacman
pdftk          /usr/lib/python2.7/site-packages/cheat/cheatsheets/pdftk
php            /usr/lib/python2.7/site-packages/cheat/cheatsheets/php
ps             /usr/lib/python2.7/site-packages/cheat/cheatsheets/ps
python         /usr/lib/python2.7/site-packages/cheat/cheatsheets/python
rm             /usr/lib/python2.7/site-packages/cheat/cheatsheets/rm
...

Bu dosyalar elle de değiştirilebilir.

Cheat içinde arama yapak için

[root@zinnetb bash_completion.d]# cheat -s top
history:
  # To see most used top 10 commands:

irssi:
  # To change the topic
  /topic <description>

notify-send:
  # To send a desktop notification via dbus:

systemctl:
  # Stop a service
  systemctl stop foo.service

top:
  top -i <interval>
  top -s <delay>
  top -a
  top -d
  top -e
  top -F
  top -f
  top -h
  top -o <key>

yaourt:
  # For all of the above commands, if you want yaourt to stop asking constantly for confirmations, 

Linux’de Font Kurmak

Ağustos 7, 2014 § Yorum yok § Kalıcı bağlantı

Temel olarak 2 yol kullanılabilir
1.Paket köneticisi kullanılarak:
Örneğin Microsoft’un kullandığı bazı font paketlerini bulabilmek için:

[root@zinnetb ~]# yum search font| less

kullanılabilir.

2.Daha genel olarak paket yöneticisi kullanmadan:
Linux sistemlerde fontlar

/usr/share/fonts
/usr/share/X11/fonts
/usr/local/share/fonts
~/.fonts

dizinlerinden birinde tutulur.
Herkesin kullanmasını istediğimiz fontlar /usr/share/fonts dizininde, şahsa özel fontlar ise ~/.fonts dizininde tutulabilir.

Örneğin http://img.dafont.com/dl/?f=aligot_de_mirabelle adresinden fontu beğendik ve download ettik diyelim.
Şimdi fontu yüklemek için önce zip dosyasını açalım.

[root@zinnetb Downloads]# ls -l
total 1220
-rw-r--r--. 1 fatih fatih   42925 Aug  7 13:05 aligot_de_mirabelle.zip
-rw-r--r--. 1 fatih fatih 1200999 Jun 27 10:53 Video Formats Guide.pdf
[root@zinnetb Downloads]# ls 
aligot_de_mirabelle.zip  Video Formats Guide.pdf
[root@zinnetb Downloads]# unzip aligot_de_mirabelle.zip 
Archive:  aligot_de_mirabelle.zip
  inflating: Aligot de Mirabelle.ttf  
  inflating: Selling = license.txt   

Şimdi fontu /usr/share/fonts/ dizinine kopyalalım, fc-cache ile font cahceimizi güncelleyip, fc-list ile fontun kurulu olduğuna emin olalım.

[root@zinnetb Downloads]# mv Aligot\ de\ Mirabelle.ttf /usr/share/fonts/
[root@zinnetb Downloads]# fc-cache -f
[root@zinnetb Downloads]# fc-list | grep Aligot
/usr/share/fonts/Aligot de Mirabelle.ttf: Aligot de Mirabelle:style=Regular
[root@zinnetb Downloads]# 

Artık fontu kullanabiliriz.
snapshot1

Neredeyim ben!?

Linux Notları kategorisinde geziniyorsun.