一些环境配置遇到的坑(持续更新)

主要是针对一些环境配置的小问题的记录

1. 启用了win10 的linux子系统后,修改默认终端为zsh

按照以往的套路,使用chsh -s /bin/zsh或者直接修改/etc/password里的配置都是可以的,但是这种方法对win10的linux子系统并不生效,重启之后还是默认的bash。
​ 解决办法: 在~/.bashrc中添加如下代码

1
2
3
if [ -t 1 ];then
exec zsh
fi

就可以啦~

2. ubuntu16.04安装docker遇到问题


解决办法: 在/etc/apt/sources.list文件中添加

1
deb http://cz.archive.ubuntu.com/ubuntu trusty main

然后

1
2
$ sudo apt-get install libsystemd-journal0
$ sudo apt-get install docker-engine

3. 使用docker来配置pwn服务

环境说明
  • ubuntu 16.04 LTS
文件目录
  • Dockerfile
  • source.list
  • start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#muhe docker study!  
FROM ubuntu:14.04
MAINTAINER muhe <o0xmuhe@gmail.com>

COPY ./sources.list /etc/apt/sources.list
RUN apt-get update
RUN apt-get -y dist-upgrade
RUN apt-get install -y socat

RUN useradd -m ctf

COPY ./bin/ /home/ctf/
COPY ./start.sh /start.sh

RUN chmod +x /start.sh
RUN chown -R root:ctf /home/ctf
RUN chmod -R 750 /home/ctf
RUN chmod 740 /home/ctf/flag
RUN cp -R /lib* /home/ctf
RUN cp -R /usr/lib* /home/ctf
RUN mkdir /home/ctf/bin
RUN cp /bin/sh /home/ctf/bin
RUN cp /bin/ls /home/ctf/bin
RUN cp /bin/cat /home/ctf/bin

WORKDIR /home/ctf

CMD ["/start.sh"]
EXPOSE 10001
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
1
2
3
#!/bin/bash

socat TCP4-LISTEN:10001,reuseaddr,fork EXEC:/home/ctf/helloworld

最后使用docker build -t ubuntu/pwn .来构建镜像就可以了。

4. 在win10子系统上使用pwntools

win10子系统+cmder配置好了之后省得开虚拟机了…用来搞pwn也很爽。
今天发现一个问题,pwntools用process启动程序的时候,遇到如下问题:

1
2
3
4
5
6
7
8
9
10
11
$ python exp.py
Traceback (most recent call last):
File "exp.py", line 9, in <module>
p = process('./jmper')
File "/usr/local/lib/python2.7/dist-packages/pwntools-3.6.0.dev0-py2.7.egg/pwnlib/tubes/process.py", line 269, in __init__
stdin, stdout, stderr, master, slave = self._handles(*handles)
File "/usr/local/lib/python2.7/dist-packages/pwntools-3.6.0.dev0-py2.7.egg/pwnlib/tubes/process.py", line 605, in _handles
tty.setraw(master)
File "/usr/lib/python2.7/tty.py", line 28, in setraw
tcsetattr(fd, when, mode)
termios.error: (22, 'Invalid argument')

解决办法:

1
2
#p = process('./jmper')
p = process('./jmper',raw=False)

4. gdb+qemu调试linux内核timeout

1
target remote localhost:1234

换成

1
target remote :1234

5. keyutils 的依赖(ubuntu)

1
2
apt-cache policy libkeyutils-dev
sudo apt-get install libkeyutils-dev