Libnet是一個專業的網路資料包構造和發送開發包,它是一個高層次的API函式程式庫,允許開發者構造和發送網路資料包。Libnet提供了一個對底 層網路資料包進行構造、修改和發送的高級介面。它隱藏了很多底層細節,省去了很多麻煩,如多路技術、緩衝區管理、網路資料包頭資訊、位元組流順序、作業系 統相容性,以及校驗和計算問題等。Libnet主要提供了在IP層和鏈路層構造網路資料包的功能和一些非常有用的協助工具。使用Libnet可以非常輕 鬆、快捷地構造任何形式的網路資料包,開發各種各樣的網路安全應用程式,甚至非常複雜的程式。Libnet主要用C語言寫成,提供了低層網路資料包的構 造、處理和發送功能.他的主要特點是:
.高層介面:Libnet主要用C語言寫成
.資料包構造:Libnet提供了一系列的 TCP/IP資料包文的構造函數以方便使用者使用。
.資料包的處理:Libnet提供了一系列的輔助函數,利用這些輔助函數,説明使用者簡化那些 煩瑣的事務性的程式設計工作
.資料包發送:Libnet允許用戶在兩種不同的資料包發送方法中選擇。
另外Libnet允許程式獲得對資料 包的絕對的控制,其中一些是傳統的網路程式介面所不提供的。
Libnet提供兩種將資料包發送到網路的介面:原始通訊端(raw socket)介面和鏈路層(Link Layer)介面。本文選取的是鏈路層介面進行設計的。
2010年10月5日 星期二
2010年10月4日 星期一
OPENVPN Server enable NAT routing
Here you should can connect with OpenVPN server thru VPN. However general web browsing will be accomplished with direct connections that bypass the VPN.
If you want to browse web thru VPN , please continue to follow the steps below.
1. Add the following directive to the server configuration file 'server.conf'
push "redirect-gateway def1"
push "dhcp-option DNS 168.95.1.1"
2. Setting NAT routing for VPN client on server
#vi /etc/openvpn/start-nat.sh
#!/bin/bash
ipt="/sbin/iptables"
# Clean the all rules
$ipt -F
$ipt -X
$ipt -t nat -F
$ipt -t nat -X
# Enable ip_forward
echo "1" > /proc/sys/net/ipv4/ip_forward
# For NAT routing
$ipt -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
$ipt -t nat -L
#cd /etc/openvpn
#./start-nat.sh
If you want to browse web thru VPN , please continue to follow the steps below.
1. Add the following directive to the server configuration file 'server.conf'
push "redirect-gateway def1"
push "dhcp-option DNS 168.95.1.1"
2. Setting NAT routing for VPN client on server
#vi /etc/openvpn/start-nat.sh
#!/bin/bash
ipt="/sbin/iptables"
# Clean the all rules
$ipt -F
$ipt -X
$ipt -t nat -F
$ipt -t nat -X
# Enable ip_forward
echo "1" > /proc/sys/net/ipv4/ip_forward
# For NAT routing
$ipt -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
$ipt -t nat -L
#cd /etc/openvpn
#./start-nat.sh
2010年10月1日 星期五
OPENVPN Client issue for Windows
在建立connection時,出現
NOTE: could not get adapter index for \DEVICE\TCPIP_{9A17EDDE-8CCC-474E-ABE6-8DBE7DAB42CB}, status=55 : 指定的網路資源或裝置無法再使用。
原來是因為安裝Commview的關係,只要將TAP-Win32 Adapter中的 Commview相關元件 uncheck即可.
NOTE: could not get adapter index for \DEVICE\TCPIP_{9A17EDDE-8CCC-474E-ABE6-8DBE7DAB42CB}, status=55 : 指定的網路資源或裝置無法再使用。
原來是因為安裝Commview的關係,只要將TAP-Win32 Adapter中的 Commview相關元件 uncheck即可.
2010年9月27日 星期一
Gmail IMAP, SMTP, POP3 設定值
IMAP
- imap.gmail.com
- Port: 993
- Use SSL: Yes
- smtp.gmail.com
- Port for TLS/STARTTLS: 587
- Port for SSL: 465
- pop.gmail.com
- Port: 995
- Use SSL: Yes
Meld : Diff and merge tool.
Meld is a visual diff and merge tool. You can compare two or three files and edit them in place (diffs update dynamically). You can compare two or three folders and launch file comparisons. You can browse and view a working copy from popular version control systems such such as CVS, Subversion, Bazaar-ng and Mercurial. Look at the screenshots page for more detailed features.
Token-pasting operator(##) in C
我們都知道C語言define前端處理假指令用來定義變數、字串或幾行的原始碼(統稱為巨集, Macro)。
當某一巨集被定義為參數帶入之巨集, 我們最常用的就是把該參數當作變數或指標來使用,如下所示:
然而,我們可以把巨集所帶入的參數當作為識別子(Token)的一部分,如下所示:
如上列所示,class_num可以經由GET_MEMBER巨集(帶入部份識別子, 也就是num)取得,此參數傳遞方法稱為Token-pasting operator,這是一個非常好用的方法, 提供給大家參考。
繼上次提到Token-pasting operator (##) in C文章後, 這次講一下在C語言define巨集參數使用的另一種方法, 在參數名稱前加一個#運算子, 此運算子代表所帶入的參數會被編譯器視為"字串", 所以#運算子又被稱為字串化運算子, 底下為一簡單的例子:
#define GET_RESULT(exp) printf(#exp "=%d\n", exp)
int main(void)
{
GET_RESULT(3+2);
return ;
}
當某一巨集被定義為參數帶入之巨集, 我們最常用的就是把該參數當作變數或指標來使用,如下所示:
#define INC_IDX(val, size) (++val % size) -> 以參數為變數之值帶入此巨集
#define GET_DATA(ptr) (ptr->data) -> 以參數為指標帶入此巨集
然而,我們可以把巨集所帶入的參數當作為識別子(Token)的一部分,如下所示:
#include
int class_num = 9;
int class_stds = 10;
#define GET_MEMBER(postfix) class_ ## postfix
int main(void)
{
printf("class_num: %d\n", GET_MEMBER(num));
printf("class_stds: %d\n", GET_MEMBER(stds));
return 0;
}
如上列所示,class_num可以經由GET_MEMBER巨集(帶入部份識別子, 也就是num)取得,此參數傳遞方法稱為Token-pasting operator,這是一個非常好用的方法, 提供給大家參考。
The Stringify Operator (#) in C
#define GET_RESULT(exp) printf(#exp "=%d\n", exp)
int main(void)
{
GET_RESULT(3+2);
return ;
}
訂閱:
文章 (Atom)
How to repair and clone disk with ddrescue
ddrescue is a tool that can be used to repair and clone disks on a Linux system . This includes hard drives, partitions, DVD discs, flas...
-
From: http://blog.chinaaet.com/justlxy/p/5100064818 SMI:串行管理接口(Serial Management Interface),通常直接被稱為MDIO接口(Management Data Input/Output I...
-
from: https://www.wpgdadatong.com/tw/blog/detail?BID=B0594 一. PHY包含的各個子層 : PCS:編碼和解碼 PMA:串行器和反序列化器 PMD:取決於物理介質 Firgure 1: OSI模型裡示意...
-
在 前面我們所談的那些可以說是比較基本的東西,但是對於一份文件來說,光有前面所介紹的游標移動、刪除等等功能是不足夠的。面對一份文件我們通常會因為某些 緣故而使得我們必須去修改當中固定出現的字串樣式(pattern)成我們想要的樣子。最常遇到的就像中文文件的標點符號問題,或是 un...