A web challenge in SwampCTF2018. This challenge was solved with brute force attack. adanalvarez is complete.

Continue Reading...

Steam Locomotive

You might be aware of command ls the list command and use it frequently to view the contents of a folder but because of miss-typing sometimes you would result in sl, how about getting a little fun in terminal and nocommand not fo.

how to install?

apt-get install sl
Continue Reading...

Cowsay and fortune

First install requirements:

apt-get install fortune cowsay
vim /etc/profiles.d/motd.sh
exec /usr/games/fortune | /usr/games/cowsay -n

login using ssh to your account and see a simple message like:

Wed Nov 30 18:32:05 IRST 2016
He that is giddy thinks the world turns round.
		-- William Shakespeare, "The Taming of the Shrew"
< Green light in A.M. for new projects.  Red light in P.M. for traffic tickets. >
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
Continue Reading...

How to deploy django apps?

Create a lxc container

lxc-create -n jessie -t debian

Configure network

lxc.include = /usr/share/lxc/config/debian.common.conf
lxc.tty = 4
lxc.arch = amd64
lxc.network.type = veth
lxc.network.link = lxcbr0
lxc.network.flags = up
lxc.network.hwaddr = 00:16:3e:59:4b:71
lxc.network.ipv4 =
lxc.network.ipv4.gateway =
lxc.rootfs = /var/lib/lxc/jessie/rootfs
lxc.rootfs.backend = dir
lxc.utsname = jessie
lxc-start -n jessie
lxc-attach -n jessie
adduser user

How to install pyenv

Read instruction from here

apt-get install curl
apt-get install git
apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils
  • login as user and continue instructions:
su user
  • download installer and run it using bash:
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash

after install pyenv you must add paths to .bash_profile

vim ~/.bash_profile
export PATH="/home/user/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
  • install python 3.5.2 using
pyenv update
pyenv doctor
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install -fkv 3.5.2

create a virtual env

pyenv virtualenv 3.5.2 webapp

Install app’s requirements

pyenv shell webapp
pip install --upgrade pip
pip freeze
pip install -r requirements.txt
pip install uwsgi
pip install django

How to deploy application?

pyenv shell webapp
python manage.py collectstatic

How to create uwsgi service?

vim /etc/systemd/system/myapp.service
Description=uWSGI Emperor service

User = user
ExecStart=/home/user/.pyenv/versions/webapp/bin/uwsgi --http --wsgi-file /home/user/webapp/webapp/wsgi.py --chdir /home/user/webapp/

systemctl start myapp
systemctl enable myapp

Install nginx and configure it

aptitude install nginx

vim /etc/nginx/site-enabled/default
server {
	listen 80 default_server;
	location /static/ {
		expires 30d;
		root /home/user/webapp/;
	server_name _;
	location /{


  • your STATIC_ROOT in setting.py is:
STATIC_ROOT = os.path.join(BASE_DIR, "static/")

Some usefull links

Digital Ocean

Continue Reading...

Headless Selenium Testing With Python and PhantomJS

PhantomJS is one of the best headless Webkits. To install on ubuntu follow these instructions:

  • install phantomjs (2.1.1)
npm install phantomjs
  • install selenium
pip install selenium
  • run a sample
import platform
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

# PhantomJS files have different extensions
# under different operating systems
if platform.system() == 'Windows':
    PHANTOMJS_PATH = './phantomjs.exe'
    PHANTOMJS_PATH = '/usr/local/bin/phantomjs'

driver =webdriver.PhantomJS(PHANTOMJS_PATH)

driver.set_window_size(1120, 550)
print (driver.current_url)

Continue Reading...

How to enable lxc network on debian jessie?

The LXC packages in Ubuntu ships enable LXC networking properly. This is basically done by a init script called lxc-net which setups the lxcbr0 bridge and a number of iptables rule to set up networking. In this post I describe how to use network in debian jessie.(Debian Jessie ships with an updated version of LXC 1.06 but does not set up the LXC networking by default)

First download the lxc-net script here and follow the instructions below.

apt-get install lxc dnsmasq-base bridge-utils
touch /etc/default/lxc
echo 'USE_LXC_BRIDGE="true"' > /etc/default/lxc
cp lxc-net /etc/init.d/
chmod +x /etc/init.d/lxc-net
systemctl enable lxc-net
systemctl start lxc-net
systemctl status lxc-net

To ensure containers created have the lxcbr0 bridge enabled by default add the config below to /etc/lxc/default.conf

lxc.network.type = veth
lxc.network.link = lxcbr0
lxc.network.flags = up
lxc.network.hwaddr = 00:16:3e:xx:xx:xx
Continue Reading...

How to install jekyll?

Jekyll is a simple, blog-aware, static site generator. It takes a template directory containing raw text files in various formats, runs it through a converter (like Markdown) and our Liquid renderer, and spits out a complete, ready-to-publish static website suitable for serving with your favorite web server. Jekyll also happens to be the engine behind GitHub Pages, which means you can use Jekyll to host your project’s page, blog, or website from GitHub’s servers for free.

Install ruby version 2

To install jekyll version 2 and later you need to install ruby version 2 or later. So you can use this way to install that on ubuntu:

sudo apt-get -y update
sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p481.tar.gz
tar -xvzf ruby-2.0.0-p481.tar.gz
cd ruby-2.0.0-p481/
./configure --prefix=/usr/local
sudo make install

after installing requirement you can install last version of jekyll.

gem install jekyll -v "3.2.1"

Head to the readme to learn more.

Continue Reading...

Start of Blogging

From today I will write some posts daily. I am using github and jekyll to blogging. In future’s posts I will explain how to install a blog in 10 minutes!

Continue Reading...