วันอังคารที่ 20 มกราคม พ.ศ. 2558

วิธีใช้ส่ง Gmail แบบ Command line ใน Raspberry PI

1. ติดตั้ง ssmtp
sudo apt-get install ssmtp
 2. แก้ไขค่า config /etc/ssmtp/ssmtp.conf โดยให้เพิ่ม config เข้าไปดังนี้
   sudo nano /etc/ssmtp/ssmtp.conf

AuthUser=<username@gmail.com>
AuthPass=Your-Gmail-Password
FromLineOverride=YES
mailhub=smtp.gmail.com:587
UseSTARTTLS=YES

โดย <username@gmail.com> เป็น email ของเราครับ และ Your-Gmail-Password เป็น password ของ email เราครับ ในที่นี้ผมใช้เป็น techsuiiblog@gmail.com ครับ

3.ติดตั้ง mailutils สำหรับการส่งเมล์จาก command line ครับ
# sudo apt-get install mailutils
4. เมื่อติดตั้ง mailutils เรียบร้อย เราจะสามารถใช้ mail command ได้แล้วครับ สามารถทดสอบส่งได้โดยใช้เป็น
# sudo echo “test for techsuii.com” | mail -s “test techsuii” receiver@gmail.com
ทีนี้ปลายทางก็จะได้รับ email จาก techsuiiblog@gmail.com แล้วครับ

วิธีการทดสอบ Speed Internet ผ่าน Command Line ใน Raspberry PI

1. # apt-get install python
2. # wget https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py
3. sudo python speedtest_cli.py
4. Output

Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from TOT (125.24.178.73)...
Selecting best server based on latency...
Hosted by AIS (Bangkok) [22.64 km]: 62.284 ms
Testing download speed........................................
Download: 9.35 Mbits/s
Testing upload speed..................................................
Upload: 0.50 Mbits/s

5. หากเราต้องการจะทดสอบที่ server ตัวอื่นที่ไม่ใช่ของไทย เราสามารถ list server ได้โดยใช้คำสั่งเป็น

sudo python speedtest_cli.py --list | more
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
5440) tondev.com (Bangkok, Thailand) [22.64 km]
5394) CS LOXINFO (Bangkok, Thailand) [22.64 km]
1219) STS Group (Bangkok, Thailand) [22.64 km]
5431) Chulalongkorn University (Bangkok, Thailand) [22.64 km]
2459) SBN (Bangkok, Thailand) [22.64 km]
3147) AIS (Bangkok, Thailand) [22.64 km]
 428) adslthailand.com (Bangkok, Thailand) [22.64 km]
5609) Internet Thailand PCL (Bangkok, Thailand) [22.64 km]
4222) Shama Thunder (Bangkok, Thailand) [22.64 km]
3855) dtac (Bangkok, Thailand) [22.64 km]
4347) cattelecom (Bangkok, Thailand) [22.64 km]
2256) Smart Axiata (Phnom Penh, Cambodia) [517.16 km]
4673) CooTel (Phnom Penh, Cambodia) [517.16 km]
1452) WiCAM Corporation (Phnom Penh, Cambodia) [517.16 km]
5828) SINET (Phnom Penh, Cambodia) [517.16 km]
5797) MekongNet ISP (Phnom Penh, Cambodia) [517.16 km]
4182) EZECOM (Phnom Penh, Cambodia) [517.16 km]
2504) ONLINE (Phnom Penh, Cambodia) [517.16 km]
1788) Metfone (Phnom Penh, Cambodia) [517.16 km]
3281) OPENNET (Phnom Penh, Cambodia) [517.16 km]
1307) Prince of Songkla Univ (Surat Thani Province, Thailand) [521.14 km]
จะเห็นว่าด้านหน้าสุดแต่ละแถว จะมีตัวเลขอยู่ นั่นคือ Server ID นั่นเอง โดยเมื่อเราเลือกได้แล้วว่าจะทดสอบกับ server ตัวไหนให้ใช้คำสั่งเป็น
6. speedtest_cli –server serverid
เช่น
7. หากเราต้องการทดสอบไปที่  Viettel IDC (Ho Chi Minh City, Vietnam) ให้เราใช้คำสั่งเป็น
sudo python speedtest_cli.py–server 2427

แก้ปัญหา wash -i mon0 ไม่โชว์

Hi guys i think i found the solution, that may help you.
First of all you need to install libpcap-dev and libsqlite3-dev packages from repository.

1. ~# apt-get install libpcap-dev
2. ~# apt-get isntall libsqlite3-dev

Then, you should download the reaver itself. You can do that from official site.
3. ~# wget http://reaver-wps.googlecode.com/files/reaver-1.4.tar.gz
Unpack tar :
4. ~# tar -xvzf reaver-1.4.tar.gz

Go to unpacked dir
5. ~# cd reaver-1.4/src/
6. ~# ./configure
7. ~# make
8. ~# sudo make install

Then remove an existing wash

8. ~# sudo rm /usr/bin/wash

copy wash from src direcory to /usr/bin/

9. ~# cp wash /etc/reaver/

Now try wash

10. ~# wash -i mon0
and it should work. =)

That's all. I my case I fix the problem now it works properly. I hope it helps you too.


https://forums.kali.org/archive/index.php/t-89.html

วันพุธที่ 14 มกราคม พ.ศ. 2558

เปลี่ยน MOTD Raspberry PI

1. Create a script (Home /root/update_motd.sh
2. ใส่ #! /bin/sh upSeconds=`/usr/bin/cut -d. -f1 /proc/uptime` secs=$(($upSeconds%60)) mins=$(($upSeconds/60%60)) hours=$(($upSeconds/3600%24)) days=$(($upSeconds/86400)) UPTIME=`printf "%d days, %02dh %02dm %02ds " "$days" "$hours" "$mins" "$secs"` echo "\033[0;32m .~~. .~~. \033[0;37m`date +"%A, %e %B %Y, %R"`\033[0;32m '. \ ' ' / .' \033[0;37m`uname -srmo`\033[0;31m .~ .~~~..~. \033[0;37m\033[0;31m : .~.'~'.~. : \033[0;37mUptime.............: $UPTIME\033[0;31m ~ ( ) ( ) ~ \033[0;37mMemory.............: $((`cat /proc/meminfo | grep MemFree | awk {'print $2'}`/1024))MB (Free) / $((`cat /proc/meminfo | grep MemTotal | awk {'print $2'}`/1024))MB (Total)\033[0;31m ( : '~'.~.'~' : ) \033[0;37mRunning Processes..: `ps ax | wc -l | tr -d " "`\033[0;31m ~ .~ ( ) ~. ~ \033[0;37m\033[0;31m ( : '~' : ) \033[0;37mIP Addresses.......: `/sbin/ifconfig | /bin/grep "Bcast:" | /usr/bin/cut -d ":" -f 2 | /usr/bin/cut -d " " -f 1` / `wget -q -O - http://icanhazip.com/ | tail`\033[0;31m '~ .~~~. ~' \033[0;37mTemperature........: `vcgencmd measure_temp | sed "s/temp=//"`\033[0;31m '~' \033[0;37m" > /etc/motd
3. sudo chmod +x /root/update_motd.sh
4.sudo ./update_motd.sh
5. เพิ่มใน cron ให้ทำงานตลอด
   crontab -e
   5 * * * * /root/update_motd.sh 
#ให้ทำงานทุก 5 นาที






 


ที่มา http://www.pihomeserver.fr/en/2013/04/29/personnaliser-votre-message-de-connexion-ssh-avec-motd/


อธิบาย
http://www.mewbies.com/how_to_customize_your_console_login_message_tutorial.htm