Skip to main content

Posts

Showing posts from 2015

How to use Docker

Docker Docker offical webiste: https://www.docker.com/ Setup Docker Prepare fresh version of CentOS, I am using CentOS 6.7. Update the yum rep. > rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm > yum update -y   Install Docker > yum -y install docker-io Pull some image of container, I am going to use CentOS container. To pull the latest (CentOs 7) >  docker pull centos Or > docker pull centos:centos6 Check which container images are installed: > docker images REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE centos              centos6             3bbbf0aca359        2 weeks ago         190.6 MB centos              latest              ce20c473cd8a        2 weeks ago Run docker from image: > docker run -i -t centos:centos6 /bin/bash Note: this creates a container from image (you can see the ContainerID as hostname) List containers: >docker ps >docker

NAT Traversal or how to make P2P on Android

Many of us used BitTorrent(or uTorrent) to download files on internet in a short time. Their download speed is high due to Peer-to-peer technology. That means, rather than downloading file from server, we are getting the file from another computer. But how two computers that have a local IP and are behind NAT, how they can connect each other? For that, NAT Traversal methodologies come for help. Note that there are mainly 2 types of NAT: Symmetrical(complex NATs:carrier-grade NAT) and Full (home network or small enterprises). let us consider Full NATs first. Methodologies of NAT traversal are: UPnP - old and hardware oriented method NAT-PMP (later succeeded by PCP)- introduced by Apple, also hardware oriented(i.e: not all routers have it, and even if it had, it is turned off by default) UDP Punching  - this is done by STUN which uses public server to discover NAT public IP & port TCP Punching -  similar to UDP punching but more complicated Symmetrical NATs are a big is

How to sniff Http port with Python

Recently, I have been interested in sniffing Http requests/responses which are passing through 80/8080 port. This is helpful when you want to trace if there are some data outgoing from your PC without your knowledge. Sniffing(or monitoring) is a popular way to observe http requests. Anyways, I decided to choose Python for programming, because it is easier, portable, and extensible. There are tons of libraries for Python. The next library that i want to introduce is called "scapy" You install it like this: >pip install scapy Then, here is the simple HTTP sniffer: #!/usr/bin/python from scapy.all import * def http_header(packet):         http_packet=str(packet)         if http_packet.find('GET'):                 return GET_print(packet) def GET_print(packet1):     ret = "***************************************GET PACKET****************************************************\n"     ret += "\n".join(packet1.sprintf("{Raw:%Ra

CDN company trends

CDNetworks holds a strong position in Japan's market as we see in the trend analysis chart. Google trends Link MaxCDN is growing quickly due to its open source modifiable Bootstrap UI for users. If we compare MaxCDN with CDNetworks, we can see it here: