2016年5月25日 星期三

CPqD/nox13oflib on Ubuntu 14.04 64bits

./boot.sh
mkdir build && cd build
../configure --with-python=no --with-boost=/usr/lib/x86_64-linux-gnu --with-boost-filesystem=boost_filesystem --with-boost-unit-test-framework=boost_unit_test_framework LDFLAGS="-lboost_system"
make

Have fun !!

2015年5月16日 星期六

Linux limiting download and upload traffic by using HTB

I use Ubuntu (14.04) 32 bit as an example

Kernel Customize Part

Get the kernel source by apt-get
apt-get source linux-image-$(uname -r)

Get the compile Dependence by
sudo apt-get build-dep linux-image-$(uname -r)

After download the source, use make menuconfig to enter the Kernel Configuration

Go to
Networking Support -> Networking options -> QoS and/or fair queueing

Enable: Incoming device classifiication(CONFIG_NET_CLS_IND)

Go to
Devices driver -> Network devices support
Enable: Intermediate Functional Block support (CONFIG_IFB)

Save and Make

QoS Part

tc (traffic control) is your best friend to config the QoS

# Handle both root and ingress traffic
tc qdisc add dev eth0 root handle 1: htb default 12
tc qdisc add dev eth0 handle ffff: ingress

# Mirred the traffic of eth0 ingress to ifb0 so that we can do traffic control
tc filter add dev eth0 parent ffff: protocol ip u32 match u32 0 0 action mirred egress redirect dev ifb0
tc qdisc add dev ifb0 root handle 1: htb default 12

# Some example of traffic controlling
tc class add dev eth0 parent 1: classid 1:10 htb rate 10mbit ceil 10mbit
tc class add dev ifb0 parent 1: classid 1:10 htb rate 10mbit ceil 10mbit

# Add filter to cature all traffic through the device
tc filter add dev eth0 parent 1: protocol ip u32 match u8 0 0 classid 1:10
tc filter add dev ifb0 parent 1: protocol ip u32 match u8 0 0 classid 1:10

2015年2月17日 星期二

Raspberry pi Access Point using rl8192cu with bridge interface

As the wifi signal in my room is some weak, I can't even watch youtube on my iPad. I decide to use Raspberry to extend the wifi from living room to my bed room.

Here is my device information
Devcie: Raspberry Pi B+
Wifi device: TL-WN823N (rl8192cu chipset)

In the very beginning, I am trying to use OpenWrt on Raspberry PI.

Target System: (Broadcom BCM2708/BCM2835)
Wireless Drivers: kmod-rt18192cu Realtek RTL8192CU/RT8188CU

The firmware can be compiled and run smoothly on the Raspberry. My HTC one can acess the wifi but my iPad mini 2 seems unavailable to use the wifi. The reason seems to be some driver compatibility which I need to take a lot of time to fix it. Therefore, I choose to flash the firmware back to Raspbian.


First, my network setting is something like that.

Internet ---- wifi router (192.168.100.0/24) ---- HomePlug ---- Raspberry pi(my room)

## Download the require package
sudo apt-get install iw bridge-utills hostapd

I want the wifi router to also take the role of DHCP and DNS. Therefore, I just want to bridge the wireless interface to my ethernet interface.

Edit the config
## In /etc/network/interfaces
auto lo

iface lo inet loopback

auto br-wan
iface br-wan inet dhcp
bridge-ports eth0 wlan0

## In /etc/init.d/hostapd

DAEMON_CONF=/etc/hostapd/hostapd.conf

Time to start the hostapd service
sudo service hostapd restart

There are some error throwing out which said 'nl80211 driver not found'

follow the guy which have modified a good hostapd version to use rtl8192cu chipset
http://blog.sip2serve.com/post/38010690418/raspberry-pi-access-point-using-rtl8192cu

Copy the binary to /usr/sbin/ to overwrite hostapd
## Edit the config /etc/hostapd/hostsapd.conf
## config
interface=wlan0
bridge=br-wan
hw_mode=g
ieee80211n=1
channel=6
ssid=your_ssid
wpa=3
wpa_passphrase=yourssidpw
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Finally:
sudo service hostapd restart

root@raspberrypi:/etc/init.d# service hostapd restart
[ ok ] Stopping advanced IEEE 802.11 management: hostapd.
[....] Starting advanced IEEE 802.11 management: hostapdioctl[RTL_IOCTL_HOSTAPD]: Invalid argument
. ok
root@raspberrypi:/etc/init.d#




2015年1月14日 星期三

My Ubuntu must install list

Install command development basic function
apt-get install vim build-essential screen terminator

Server type
sudo apt-get install openssh-server

Terminator
apt-get install terminator

Vim
apt-get install vim

build-essential
apt-get install build-essential

Ubuntu Tweak
http://ubuntu-tweak.com/

Synapse
apt-add-repository ppa:synapse-core/testing
apt-get update
apt-get install synapse

2014年9月25日 星期四

SSH injection

env x='() { :;}; echo vulnerable' bash -c "echo this is a test"

If ' vulnerable' is print. It seems that "echo" command in this function can be injected to run.

http://arstechnica.com/security/2014/09/bug-in-bash-shell-creates-big-security-hole-on-anything-with-nix-in-it/

2014年9月13日 星期六

Ubuntu install package list

Launcher
- docky

- synapse

sudo add-apt-repository ppa:synapse-core/ppa
sudo apt-get update
sudo apt-get install synapse


- Main Menu
alacarte

- PlayOnLinux

- System Load Indicator

2014年9月4日 星期四

Setup syntax highting in bloger


Edit the Blogger template
add all css before </b:skin> tag 

.dp-highlighter
{
 font-family: "Consolas", "Monaco", "Courier New", Courier, monospace;
 font-size: 12px;
 background-color: #E7E5DC;
 width: 99%;
 overflow: auto;
 margin: 18px 0 18px 0 !important;
 padding-top: 1px; /* adds a little border on top when controls are hidden */
}

/* clear styles */
.dp-highlighter ol,
.dp-highlighter ol li,
.dp-highlighter ol li span 
{
 margin: 0;
 padding: 0;
 border: none;
}

.dp-highlighter a,
.dp-highlighter a:hover
{
 background: none;
 border: none;
 padding: 0;
 margin: 0;
}

.dp-highlighter .bar
{
 padding-left: 45px;
}

.dp-highlighter.collapsed .bar,
.dp-highlighter.nogutter .bar
{
 padding-left: 0px;
}

.dp-highlighter ol
{
 list-style: decimal; /* for ie */
 background-color: #fff;
 margin: 0px 0px 1px 45px !important; /* 1px bottom margin seems to fix occasional Firefox scrolling */
 padding: 0px;
 color: #5C5C5C;
}

.dp-highlighter.nogutter ol,
.dp-highlighter.nogutter ol li
{
 list-style: none !important;
 margin-left: 0px !important;
}

.dp-highlighter ol li,
.dp-highlighter .columns div
{
 list-style: decimal-leading-zero; /* better look for others, override cascade from OL */
 list-style-position: outside !important;
 border-left: 3px solid #6CE26C;
 background-color: #F8F8F8;
 color: #5C5C5C;
 padding: 0 3px 0 10px !important;
 margin: 0 !important;
 line-height: 14px;
}

.dp-highlighter.nogutter ol li,
.dp-highlighter.nogutter .columns div
{
 border: 0;
}

.dp-highlighter .columns
{
 background-color: #F8F8F8;
 color: gray;
 overflow: hidden;
 width: 100%;
}

.dp-highlighter .columns div
{
 padding-bottom: 5px;
}

.dp-highlighter ol li.alt
{
 background-color: #FFF;
 color: inherit;
}

.dp-highlighter ol li span
{
 color: black;
 background-color: inherit;
}

/* Adjust some properties when collapsed */

.dp-highlighter.collapsed ol
{
 margin: 0px;
}

.dp-highlighter.collapsed ol li
{
 display: none;
}

/* Additional modifications when in print-view */

.dp-highlighter.printing
{
 border: none;
}

.dp-highlighter.printing .tools
{
 display: none !important;
}

.dp-highlighter.printing li
{
 display: list-item !important;
}

/* Styles for the tools */

.dp-highlighter .tools
{
 padding: 3px 8px 3px 10px;
 font: 9px Verdana, Geneva, Arial, Helvetica, sans-serif;
 color: silver;
 background-color: #f8f8f8;
 padding-bottom: 10px;
 border-left: 3px solid #6CE26C;
}

.dp-highlighter.nogutter .tools
{
 border-left: 0;
}

.dp-highlighter.collapsed .tools
{
 border-bottom: 0;
}

.dp-highlighter .tools a
{
 font-size: 9px;
 color: #a0a0a0;
 background-color: inherit;
 text-decoration: none;
 margin-right: 10px;
}

.dp-highlighter .tools a:hover
{
 color: red;
 background-color: inherit;
 text-decoration: underline;
}

/* About dialog styles */

.dp-about { background-color: #fff; color: #333; margin: 0px; padding: 0px; }
.dp-about table { width: 100%; height: 100%; font-size: 11px; font-family: Tahoma, Verdana, Arial, sans-serif !important; }
.dp-about td { padding: 10px; vertical-align: top; }
.dp-about .copy { border-bottom: 1px solid #ACA899; height: 95%; }
.dp-about .title { color: red; background-color: inherit; font-weight: bold; }
.dp-about .para { margin: 0 0 4px 0; }
.dp-about .footer { background-color: #ECEADB; color: #333; border-top: 1px solid #fff; text-align: right; }
.dp-about .close { font-size: 11px; font-family: Tahoma, Verdana, Arial, sans-serif !important; background-color: #ECEADB; color: #333; width: 60px; height: 22px; }

/* Language specific styles */

.dp-highlighter .comment, .dp-highlighter .comments { color: #008200; background-color: inherit; }
.dp-highlighter .string { color: blue; background-color: inherit; }
.dp-highlighter .keyword { color: #069; font-weight: bold; background-color: inherit; }
.dp-highlighter .preprocessor { color: gray; background-color: inherit; }

add following code before </head> tag













Paste the following code before </body> tag.
<script language="javascript">
dp.SyntaxHighlighter.BloggerMode();
dp.SyntaxHighlighter.HighlightAll('code');
</script>
Usage :

...Your html-escaped code goes here...

    echo "I like PHP";