csiTool安装

ap模式

1 安装必要的工具

sudo apt-get install gcc make linux-headers-$(uname -r) git-core

sudo apt-get install iw

echo iface wlan0 inet manual | sudo tee -a /etc/network/interfaces

sudo restart network-manager

echo blacklist iwldvm | sudo tee -a /etc/modprobe.d/csitool.conf

echo blacklist iwlwifi | sudo tee -a /etc/modprobe.d/csitool.conf

2创建和安装新的驱动

CSITOOL_KERNEL_TAG=csitool-$(uname -r | cut -d . -f 1-2)

加速github下载速度
git config --global http.postBuffer 524288000

git clone https://github.com/dhalperi/linux-80211n-csitool.git

cd linux-80211n-csitool

git checkout ${CSITOOL_KERNEL_TAG}

我没找到对应的内核版本标签这个tip没有执行
UBUNTU_KERNEL_TAG=Ubuntu-3.13.0-32.57
注意:正确选择Ubuntu系统的内核版本标签,标签查询链接为http://people.canonical.com/~kernel/info/kernel-version-map.html

. /etc/lsb-release
git remote add ubuntu git://kernel.ubuntu.com/ubuntu/ubuntu-${DISTRIB_CODENAME}.git
git pull --no-edit ubuntu ${UBUNTU_KERNEL_TAG}

make -C /lib/modules/$(uname -r)/build M=$(pwd)/drivers/net/wireless/iwlwifi modules

sudo make -C /lib/modules/$(uname -r)/build M=$(pwd)/drivers/net/wireless/iwlwifi INSTALL_MOD_DIR=updates modules_install

sudo depmod

cd ..

3安装新的固件

git clone https://github.com/dhalperi/linux-80211n-csitool-supplementary.git

for file in /lib/firmware/iwlwifi-5000-*.ucode; do sudo mv $file $file.orig; done

sudo cp linux-80211n-csitool-supplementary/firmware/iwlwifi-5000-2.ucode.sigcomm2010 /lib/firmware/

sudo ln -s iwlwifi-5000-2.ucode.sigcomm2010 /lib/firmware/iwlwifi-5000-2.ucode

4创建Logging程序

make -C linux-80211n-csitool-supplementary/netlink

5更新无线网卡模块

sudo modprobe -r iwlwifi mac80211

sudo modprobe iwlwifi connector_log=0x1

!注意:每次reboot系统后需要重新执行

6命令行启动无线网卡

sudo ip link set wlan0 up

7探测AP、连接非加密AP、分配地址

!此时断开网线
sudo iw dev wlan0 scan
sudo iw wlan0 connect -w MERCURY_42E6

sudo dhclient wlan0

8启动捕获程序

sudo linux-80211n-csitool-supplementary/netlink/log_to_file csi.dat
另开一个终端查看网关,并ping默认网关
route

sudo ping 192.168.0.1 -i 0.05

Monitor模式

Monitor模式可以调制发送速率、发包数量、发送天线个数、HT模式、short/long guard interval等

首先,修改linux-80211n-csitool-supplementary/injection文件夹中的脚本

修改setup_monitor_csi.sh

#!/usr/bin/sudo /bin/bash
service network-manager stop
SLEEP_TIME=2
WLAN_INTERFACE=$1
if [ "$#" -ne 3 ]; then
    echo "Going to use default settings!"
    chn=64
    bw=HT20
else
    chn=$2
    bw=$3
fi
echo "Bringing $WLAN_INTERFACE down....."
ifconfig $WLAN_INTERFACE down
while [ $? -ne 0 ]
do
    ifconfig $WLAN_INTERFACE down
done
sleep $SLEEP_TIME
echo "Set $WLAN_INTERFACE into monitor mode....."
iwconfig $WLAN_INTERFACE mode monitor
while [ $? -ne 0 ]
do
    iwconfig $WLAN_INTERFACE mode monitor
done
sleep $SLEEP_TIME
echo "Bringing $WLAN_INTERFACE up....."
ifconfig $WLAN_INTERFACE up
while [ $? -ne 0 ]
do
    ifconfig $WLAN_INTERFACE up
done
sleep $SLEEP_TIME
echo "Set channel $chn $bw....."
iw $WLAN_INTERFACE set channel $chn $bw

修改setup_inject.sh

#!/usr/bin/sudo /bin/bash
service network-manager stop
WLAN_INTERFACE=$1
SLEEP_TIME=2
modprobe iwlwifi debug=0x40000
if [ "$#" -ne 3 ]; then
    echo "Going to use default settings!"
    chn=64
    bw=HT20
else
    chn=$2
    bw=$3
fi
sleep $SLEEP_TIME
ifconfig $WLAN_INTERFACE 2>/dev/null 1>/dev/null
while [ $? -ne 0 ]
do
    ifconfig $WLAN_INTERFACE 2>/dev/null 1>/dev/null
done
sleep $SLEEP_TIME
echo "Add monitor mon0....."
iw dev $WLAN_INTERFACE interface add mon0 type monitor
sleep $SLEEP_TIME
echo "Bringing $WLAN_INTERFACE down....."
ifconfig $WLAN_INTERFACE down
while [ $? -ne 0 ]
do
    ifconfig $WLAN_INTERFACE down
done
sleep $SLEEP_TIME
echo "Bringing mon0 up....."
ifconfig mon0 up
while [ $? -ne 0 ]
do
    ifconfig mon0 up
done
sleep $SLEEP_TIME
echo "Set channel $chn $bw....."
iw mon0 set channel $chn $bw

1 先安装ap模式

sudo apt-get install libpcap-dev

2 接受\发送均需

git clone https://github.com/dhalperi/lorcon-old.git

cd lorcon-old

./configure

make

sudo make install

cd ~

cd linux-80211n-csitool-supplementary/injection

make

3 接收端操作

cd linux-80211n-csitool-supplementary/injection

./setup_monitor_csi.sh wlan0 13 HT20
参数wlan0是网卡名称,可运行iwconfig命令查看;13为2.4G频段信道编号,如果只填了网卡名称,信道编号和HT模式会使用默认值64+HT20(5G频段)。

sudo /home/csi/linux-80211n-csitool-supplementary/netlink/log_to_file log.dat
等待接收数据,这里的csi是你的计算机名称

4 发送端操作

cd linux-80211n-csitool-supplementary/injection/

./setup_inject.sh wlan0 13 HT20
下载后需覆盖原脚本,wlan0为你的网卡名称,13为信道编号setup_inject.sh也是基于类似的理念修改的:添加运行说明;添加网卡名为参数;添加stop network-manager
sudo echo 0x4101 | sudo tee /sys/kernel/debug/ieee80211/phy0/iwlwifi/iwldvm/debug/monitor_tx_rate

0x4101这部分参数设置具体参见下图,该图引自CSI Tool安装使用讲解

比如0x1c101表示支持选择三根天线发送、OFDM下的HT20模式,不过Rate Selection部分对应速率尚不明。


image.png

sudo ./random_packets 100000 100 1
第一个参数:包的数量 第二个参数:包的长度 第三个参数:包与包间delay(微秒)。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 219,701评论 6 508
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 93,649评论 3 396
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 166,037评论 0 356
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,994评论 1 295
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 68,018评论 6 395
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,796评论 1 308
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,481评论 3 420
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,370评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,868评论 1 319
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 38,014评论 3 338
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 40,153评论 1 352
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,832评论 5 346
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,494评论 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 32,039评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 33,156评论 1 272
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,437评论 3 373
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 45,131评论 2 356

推荐阅读更多精彩内容