Mengenal dpkt (Bagian 1): Membaca Berkas pcap

Mengenal dpkt (Bagian 1): Membaca Berkas pcap

Tulisan ringkas berikut disarikan dari beberapa sumber yang ada. Salah satunya dari blog milik Jon Oberheide. Karena penelitian saya berkaitan dengan keamanan jaringan maka analisis dari network traffic menjadi sebuah keharusan. dpkt adalah pustaka yang dibuat oleh Dug Song. Beliau seingat saya salah satu anggota dari monkey.org dan sudah membuat beberapa perangkat lunak yang berkaitan dengan jaringan. Di artikel ini saya coba paparkan sedikit cara menggunakan pustaka dpkt secara ringkas. Dokumentasi dan cara sudah banyak bertebaran dalam bahasa Inggris sedangkan untuk bahasa Indonesia belum ada atau masih jarang silakan cek di duckduckgo. Selanjutnya saya mencoba berkontribusi dalam bahasa Indonesia.

Read More

Resolve pip for Python 3.4 on FreeBSD

Resolve pip for Python 3.4 on FreeBSD

This just newbie problem. I had FreeBSD version 10.2 server. The default installation for python is python 2.7. I had script with python 3 as the interpreter so I install the python 3 from the pkg using

Read More

How To Parse Website (2)

How To Parse Website (2)

My late post How to Parse Website Part 1 has shown you the basic website parsing. Next in this post I will show you more. Open your python command line again then try parse our last website. Here is the result from website I’ve been parse accessed via browser.

Read More

How To Parse Website (1)

How To Parse Website (1)

In this post I will guide you step by step to parse website. I chose python, though. Each language has its own style but I prefer python because I know its strength and its resilient. Maybe some other time I can try another language as an example. This post will not show you how to install python.

Read More

Playing With Raspberry Pi (Part 1) : How To Install an OS to Raspi

Playing With Raspberry Pi (Part 1) : How To Install an OS to Raspi

I know maybe it’s already too late for discussing raspberry pi (raspi) but hey, it’s my first time touching this little one and playing with it. I’m not gonna write the history behind or anything related but i’m gonna share my experience. Actually this is not my own raspi, my friend gave me. He has a project related with raspi and python, some kind of robot project. It’s because he doesn’t have python knowledge so he asked me to do some research with his raspi. So first we have to know what kind of model, how much memory and so on. I’m in hurry so my first target is to install raspi (yeay!) using operating system that available on the site. How about the models?, how much memory this raspi have ?. We’ll talk about it later.

Okay my choice is Arch Linux. Why ?, Smaller size than Raspbian. Actually there is another one like RISC OS but i’m afraid some packages are unavailable to download or modify or there is too much dependencies but the choice is yours. The other reason is because I have slow internet connection :). That’s all. Remember, raspi using SD Card for installation. So prepare your SD Card, Image OS (choose your own OS and download from http://www.raspberrypi.org/downloads/) and Win32 Disk Imager (download from http://sourceforge.net/projects/win32diskimager/).

Ok here is my raspi from Element 14. Figure 1 in the box and Figure 2.

Raspberry PiFigure 1. Raspberry Pi from element 14

Raspberry Pi
F
igure 2. Raspberry Pi

 Installing OS to raspi is very simple. First, we have to format SD Card and injecting the image. Insert the SD Card into your notebook (assuming your notebook has SD Card slot) then open the win32diskimager like this Figure 3.

raspberry5
Figure 3. Win32diskimager

Browse your downloaded image and don’t forget to point into the right device. BEWARE !, WRONG POINTING DEVICE can ruined your notebook drive. After that push the “Write” button and wait until the process is done. If the format successfull we can forward to the next step. Insert the SD Card into the back of your raspi like Figure 4 here.

 raspberry6
Figure 4. Back

There are 2 ways to display your raspi on a monitor or TV. We can use RCA cable to connect to TV or we can use HDMI connector. Because I don’t have any HDMI cable so I choose RCA cable. The RCA cable are the most common cable so I hope you can find it in the general store or any store that sell electrical appliances. The RCA cable is like this in Figure 5.

RCA Cable
F
igure 5. RCA Cable

The cable has 3 connectors, i’m using the yellow one. Plug in into your TV (find the the yellow hole in front or back). Prepare your USB keyboard and mouse to configure. I only use USB keyboard though :). Okay the last one we plug the power cord. And here is the alarmpi (Arch Linux Arm) in Figure 6.

RCA Cable in TV
Figure 6. RCA Cable for display

Login to the shell using root and password root. Tada !, congratulation. That’s all for now.

Raspberry Pi
F
igure 7. Login shell

Read More

Mengenal AppGyver – Bagian 2

Mengenal AppGyver – Bagian 2
1. Pendahuluan
Setelah dijelaskan pengenalan awal keunggulan dari AppGyver maka selanjutnya akan coba saya jelaskan bagaimana AppGyver ini berjalan. Installasi apa saja yang dibutuhkan agar dapat berjalan dengan baik. Sebelum masuk ke dalam apa saja yang dibutuhkan prinsip dari AppGyver sangat memudahkan dapat dilihat cara kerjanya seperti pada Gambar 1 berikut:
workflow appgyver
Maka tidak heran dalam videonya disebutkan dengan waktu 4 menit dapat menghasilkan aplikasi yang siap pakai. Secara umum beberapa hal yang dibutuhkan untuk dapat menjalankan AppGyver hanya dua hal yakni Laptop / PC yang terhubung dalam jaringan dan satu lagi adalah handheld anda. Laptop / PC harus terhubung pada satu buah jaringan WLAN karena handheld dibutuhkan untuk testing aplikasi yang telah dibuat di laptop kita.
Read More

Automatic Backup MySQL Using Python

Here is a script I create to make backup MySQL Database. Check this out.


#!/usr/bin/env python
# PyBack.py v1.1
# MySQL Backup Script
# Author Andrey Ferriyan
# Package MySQL
# SubPackage MySQL Backup Script
# License GNU/GPL
# Description Backup MySQL With Cron Method


from ftplib import FTP
import subprocess
import tarfile


# User Database, Password Database, Host Database, Port Database
USERDB='andrey'
PASSDB='blablapass'
HOSTDB='localhost'
PORTDB='3306'


# Database pada mysql yang akan di backup
ARR_DB = ['wordpress']


# Hostname / IP Address, FTPLOGIN = user FTP, FTPPASS = password FTP
FTPHOST=''
FTPLOGIN=''
FTPPASS=''


class PyBack(object):
def __init__(self):
self.USERDB=USERDB
self.PASSDB=PASSDB
self.HOSTDB=HOSTDB
self.ARR_DB=ARR_DB
self.FTPHOST=FTPHOST
self.FTPLOGIN=FTPLOGIN
self.FTPPASS=FTPPASS
self.PORTDB=PORTDB


def backup(self):
subprocess.call("/bin/rm -rf /tmp/backup",shell=True)
subprocess.call("/bin/mkdir /tmp/backup",shell=True)


for x in self.ARR_DB:
subprocess.call("mysqldump -h "+self.HOSTDB+" --databases "+x+" --user="+self.USERDB+" --password="+self.PASSDB+" -P "+self.PORTDB+" -R > /tmp/backup/"+x+".sql",shell=True)


def grouping(self):
tar = tarfile.open("/tmp/backup.tar.bz2","w:bz2")
tar.add("/tmp/backup/")
tar.close()


def transfer(self):
ftp = FTP(self.FTPHOST)
ftp.login(self.FTPLOGIN,self.FTPPASS)
ftp.storbinary("STOR /tmp/backup.tar.bz2",open("/tmp/backup.tar.bz2","rb"),1024)


if __name__ == '__main__':
pyback = PyBack()
pyback.backup()
pyback.grouping()
pyback.transfer()

Carefull with Python Syntax, especially the indentation. You have to modify the script to match with your environment. Then you can install the script in the cron system. Just try it first, don’t forget to setup a FTP Server or a local FTP Server for testing it. Have a nice try!

Read More