Feeds:
Posts
Comments

You can set breakpoint with a condition. This is very useful if want to observe a certain location and stop it if the condition is reach.

In this tutorial I use:
-Xubuntu 18.04
-GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git
-NASM version 2.13.02
-GNU ld (GNU Binutils for Ubuntu) 2.30

Use the simple assembly code below:

1  section .text
2  global _start
3
4  _start:
5
6      mov rax,3
7      mov rbx,2
8      add rax,rbx
9      sub rbx,1
10
11     ;Exit
12     mov eax,1
13     mov ebx,0
14     int 0x80

Continue Reading »

This is one of my favorite function in gdb. It will make your life easier instead of typing repetition commands. Hook is a user defined command but you have to combine with a pseudo-command that already exist.

For example, you want to disassemble a program code and display the value of the program register every time you stop the process. Instead of typing 2 commands every time its stop, you can define it into one command with hook.

(gdb) define hook-stop

Type commands for definition of “hook-stop”.
End with a line saying just “end”.
>disassemble _start
>info reg $rax $rbx
>end

Let’s try.
In this tutorial I use:
-Xubuntu 18.04
-GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git
-NASM version 2.13.02
-GNU ld (GNU Binutils for Ubuntu) 2.30

Use the simple assembly code below:

1 section .text
2 global _start
3
4 _start:
5
6      mov rax,3
7      mov rbx,2
8      add rax,rbx
9      sub rbx,1
10
11     ;Exit
12     mov eax,1
13     mov ebx,0
14     int 0x80

Compile it with nasm.

darklinux@darklinuxpc:~$ nasm -f elf64 -g reg.asm -o reg.o
darklinux@darklinuxpc:~$ ld reg.o -o reg
darklinux@darklinuxpc:~$ gdb -silent reg

Reading symbols from reg…done.

(gdb) break _start
Breakpoint 1 at 0x400080
(gdb) set disassembly-flavor intel

Define the hook-stop with 2 commands, disassemble _start and info reg $rax $rbx, close with ‘end’.
(gdb) define hook-stop
Type commands for definition of “hook-stop”.
End with a line saying just “end”.
>disassemble _start
>info reg $rax $rbx
>end

Continue Reading »

You can use Watchpoint to watch variable’s value changes by single stepping your program.
In this tutorial I use:
-Xubuntu 18.04
-GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git
-NASM version 2.13.02
-GNU ld (GNU Binutils for Ubuntu) 2.30

Let’s try with a simple assembly code.

1 section .text
2 global _start
3
4 _start:
5
6      mov rax,3
7      mov rbx,2
8      add rax,rbx
9      sub rbx,1
10
11     ;Exit
12     mov eax,1
13     mov ebx,0
14     int 0x80

This program will add 3 to rax register, 2 to rbx register, so rax value will be 3 and rax value will be 2.

Then add rbx register value to rax register value, mean 2+3 =5. The rax register value will be 5.

Subtract rabx register with 1. The rbx register value will be 1 (2-1=1).
Finally, exit the program normally.

Compile it with nasm.

darklinux@darklinuxpc:~$ nasm -f elf64 -g reg.asm -o reg.o
darklinux@darklinuxpc:~$ ld reg.o -o reg

Continue Reading »

In this tutorial, I will explain how to install gdb (gnu debugger) in Docker container. If you are using ubuntu, you can install it using below command (don’t try, this is for sample only):

darklinux@darklinuxpc:~$ sudo docker run -it --name ubuntu-gdb ubuntu:bionic /bin/bash
root@55e461812aff:/# apt-get update
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
Get:3 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [8815 B]
Get:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:5 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [59.3 kB]
Get:6 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:7 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [930 kB]
Get:8 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages [1344 kB]
Get:9 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [852 kB]
Get:10 http://archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages [13.5 kB]
Get:11 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [11.3 MB]
Get:12 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [186 kB]
Get:13 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1385 kB]
Get:14 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [1226 kB]
Get:15 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [73.6 kB]
Get:16 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [20.1 kB]
Get:17 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [8158 B]
Get:18 http://archive.ubuntu.com/ubuntu bionic-backports/main amd64 Packages [8286 B]
Fetched 17.9 MB in 19s (933 kB/s)
Reading package lists... Done
 Continue Reading »

What is DVWA?

DVWA is web application that is designed to be hacked. It was written using PHP and use MYSQL as its database. There are few level of difficulties for you to test your hacking skill in a legal environtment. It will help web developers, teachers, students or any one who are interested in learning web security application. In Indonesia, 8 years in jail for hacking penalty. So, dvwa is a good option.

Before we start, I assume that you are already has and familiar with Docker Container and XAMPP server. If not, you can read my article about how to install xampp in docker.

Lets start. First, you have to download the dvwa application and xampp from its source:
http://www.dvwa.co.uk/

In this tutorial, I use xubuntu 18.04 64bit as host, Docker 18.09.9, i386/ubuntu:bionic for docker image and XAMPP for Linux 7.1.32 for php/mysql server.
dvwa01

Step 1. Copy dvwa files to opt/lampp/htdocs directory in docker container

First, you have to extract the file DVWA-master.zip
darklinux@darklinuxpc:~$ ls -l DVWA-master.zip
-rw-rw-r-- 1 darklinux darklinux 1350473 Mei 11 15:20 DVWA-master.zip
darklinux@darklinuxpc:~$ unzip DVWA-master.zip

dvwa02

Continue Reading »

Xampp is a free and open source croos-platform web server developed by Apache Friends. The term of Xampp are come from:
X → meaning cross platform
a → apache server
m → mariaDB database (formly MySQL)
p → PHP language
p → PERL language
MariaDB replaced MySQL starting 19 October 2015 (xampp version 5.5.30 & 5.6.14).
You can download new version of xampp from:
https://www.apachefriends.org/download.html
docker-xampp01

In this tutorial, I use xubuntu 18.04 64bit as host, Docker 18.09.9, i386/ubuntu:bionic for docker image and XAMPP for Linux 7.1.32 for php/mysql server.

You can download docker image that already has Xampp but the size is very big (1.4GB).
See below:
docker-xampp02If we use minimum ubuntu (64MB), the size will be much smaller.

Step 1. Download the docker image.
Open your Linux terminal and type the command below:

darklinux@darklinuxpc:~$ sudo docker pull ubuntu:bionic
[sudo] password for darklinux:
bionic: Pulling from library/ubuntu
23884877105a: Pull complete
bc38caa0f5b9: Pull complete
2910811b6c42: Pull complete
36505266dcc6: Pull complete
Digest: sha256:3235326357dfb65f1781dbc4df3b834546d8bf914e82cce58e6e6b676e23ce8f
Status: Downloaded newer image for ubuntu:bionic
darklinux@darklinuxpc:~$

It will download the ubuntu:bionic image from the docker repository.
docker-xampp03

Continue Reading »

Before we start, it’s better I will explain about Virtualization first. Virtualization is a technique to run any application in different environment. The idea of virtualization is to run any software in any hardware.

Is Virtualization the same with Emulation?
I will try to explain in simple english.
For example, I run Play Station game on PC. Is it Virtualization or Emulation?
Well, it’s emulation.

So, what is the different?
Although, both virtualization and emulation have similarities (create virtual hard disk, memory, and other hardwares), the different is, emulation is dedicated only to run a specific application.
For example, Play station emulator for PC. This emulator is designed to run play station game only. You can’t run SEGA game on this emulator.

And also, the other different is, there is no interaction between emulator and host (pc system). Meanwhile with virtualization, you can install any application on it and interact with the host.

Below are few well known virtualization software (virtual machine):
-Vmware
-VirtualBox
-Parallel Desktop
-QEMU
-Citrix Hypervisor
-Xen Project
-Microsoft Hyper-V

Continue Reading »

In this tutorial I will show you how to read data from Arduino Uno using pySerial library from Python and visualize it into Live Plot graph.
I assume that you have already familiar with Matplotlib. If not, you can read my article about it.

What you need?
Arduino Uno (you can use other type).
-Temperature sensor LD35
USB connector
-3 small cable

Before we start you have to make sure that you have already installed python libraries below:
Matplotlib
pySerial
drawnow

Since I have already Matplolib library, I just need to install Pyserial and Drawnow.

$ pip3 install pyserial
Collecting pyserial
Downloading 
https://files.pythonhosted.org/packages/0d/e4/2a744dd9e3be04a0c0907414e2a01a7c88bb3915cbe3c8cc06e209f59c30/pyserial-3.4-py2.py3-none-any.whl (193kB)
100% |████████████████████████████████| 194kB 30kB/s
Installing collected packages: pyserial
Successfully installed pyserial-3.4
$

Before you install ‘drawnow’ library, you have to install ‘html5lib==1.0b10’ first.

$ pip3 install html5lib==1.0b10
Collecting html5lib==1.0b10
Downloading 
https://files.pythonhosted.org/packages/2f/747793ca2d36f676b740efc04b7ba887c610119beb5841d1805cb3515616cb/html5lib-1.0b10-py2.py3-none-any.whl (112kB)
100% |████████████████████████████████| 112kB 11kB/s
Collecting webencodings (from html5lib==1.0b10)
Downloading 
https://files.pythonhosted.org/packages/f4/24/2a3e3df732393fed8b3ebf2ec078f05546de641fe1b667ee316ec1dcf3b7/webencodings-0.5.1-py2.py3-none-any.whl
Collecting six (from html5lib==1.0b10)
Using cached https://files.pythonhosted.org/packages/65/eb/1f97cb97bfc2390a276969c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl
Collecting setuptools>=18.5 (from html5lib==1.0b10)
Downloading 
https://files.pythonhosted.org/packages/a0/df/635cdb901ee4a8a42ec68e480c49f85f4c59e8816effbf57d9e6ee8b3588/setuptools-46.1.3-py3-none-any.whl (582kB) 100% |████████████████████████████████| 583kB 107kB/s Installing collected packages: webencodings, six, setuptools, html5lib Successfully installed html5lib-1.0b10 setuptools-46.1.3 six-1.14.0 webencodings-0.5.1 
$

Now, you can install drawnow library

$ pip3 install drawnow
Collecting drawnow
Using cached https://files.pythonhosted.org/packages/8b/bc/3a0238eb1e6222b4e2c74fcd171453d714e2f67c0f224fd5160d83636e10/drawnow-0.72.0-py3-none-any.whl

Collecting matplotlib>=1.5 (from drawnow)
Downloading 
https://files.pythonhosted.org/packages/93/4b/52da6b1523d5139d04e02d9e26ceda6146b48f2a4e5d2abfdf1c7bac8c40/matplotlib-3.2.1-cp36-cp36m-manylinux1_x86_64.whl (12.4MB) 100% |████████████████████████████████| 12.4MB 57kB/s Collecting python-dateutil>=2.1 (from matplotlib>=1.5->drawnow) Using cached https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl 

Collecting kiwisolver>=1.0.1 (from matplotlib>=1.5->drawnow)
Downloading 
https://files.pythonhosted.org/packages/ae/23/147de658aabbf968324551ea22c0c13a00284c4ef49a77002e91f79657b7/kiwisolver-1.2.0-cp36-cp36m-manylinux1_x86_64.whl (88kB) 100% |████████████████████████████████| 92kB 115kB/s 

Collecting numpy>=1.11 (from matplotlib>=1.5->drawnow) 
Downloading 
https://files.pythonhosted.org/packages/3d/fc/4763e5f17ac6e7e7d55f377cde859ca1c5d5ac624441ab45315bc578aa9e/numpy-1.18.3-cp36-cp36m-manylinux1_x86_64.whl (20.2MB) 100% |████████████████████████████████| 20.2MB 44kB/s Collecting cycler>=0.10 (from matplotlib>=1.5->drawnow) 
Using cached https://files.pythonhosted.org/packages/f7/d2/e07d3ebb2bd7af696440ce7e754c59dd546ffe1bbe732c8ab68b9c834e61/cycler-0.10.0-py2.py3-none-any.whl

Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 (from matplotlib>=1.5->drawnow)
Downloading 
https://files.pythonhosted.org/packages/8a/bb/488841f56197b13700afd5658fc279a2025a39e22449b7cf29864669b15d/pyparsing-2.4.7-py2.py3-none-any.whl (67kB) 100% |████████████████████████████████| 71kB 169kB/s Collecting six>=1.5 (from python-dateutil>=2.1->matplotlib>=1.5->drawnow) Using cached https://files.pythonhosted.org/packages/65/eb/1f97cb97bfc2390a276969c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl 
Installing collected packages: six, python-dateutil, kiwisolver, numpy, cycler, pyparsing, matplotlib, drawnow Successfully installed cycler-0.10.0 drawnow-0.72.0 kiwisolver-1.2.0 matplotlib-3.2.1 numpy-1.18.3 pyparsing-2.4.7 python-dateutil-2.8.1 six-1.14.0 
$

There are 2 things that we will do:
-first, program your Arduino to send the temperatur data through serial port.
-second, program python to read the data and display it.

Continue Reading »