目录
UBuntu相关操作
Ubuntu连接不上网络问题的解决方
sudo nmcli networking off
sudo nmcli networking on
sudo service network-manager restart
中文输入法
在设置中,language和regin添加Chinese之后,输入源里面可能没有Intelligent Pinyin
此时需要在terminal下载,安装IBus拼音
sudo apt-get install ibus-pinyin
sudo ibus-setup #打开iBus设置
You are using pip version 8.1.1, however version 22.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
# 升级pip:
sudo wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
sudo python get-pip.py
pip -V
# 升级pip3:
sudo wget https://bootstrap.pypa.io/pip/3.5/get-pip.py
sudo python3 get-pip.py
pip -V
pip换源
pip国内的一些镜像
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
修改源方法:
临时使用:
可以在使用pip的时候在后面加上-i参数,指定pip源
eg: pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple
永久修改:
1.在home/用户名/目录下创建.pip
文件夹
2.然后cd .pip
3.创建pip.conf文件touch pip.conf
- 输入以下内容然后保存即可
[global] timeout = 6000 index-url = http://mirrors.aliyun.com/pypi/simple/ trusted-host = mirrors.aliyun.com
- 上面是更换为阿里源,其他源也是一样,比如中科大就替换相应内容如下
index-url=http://pypi.mirrors.ustc.edu.cn/simple/ trusted-host =pypi.mirrors.ustc.edu.cn
windows:
直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,在pip 目录下新建文件pip.ini,内容如下
或者按照网友的建议:win+R 打开用户目录%HOMEPATH%,在此目录下创建 pip 文件夹,在 pip 目录下创建 pip.ini 文件, 内容如下
[global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn
设置默认python为python3
系统中既有python2又有python3,python2是默认
sudo ln -s /usr/bin/python3.5 /usr/bin/python
强行解锁
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
UBuntu换源
- sudo su
- 备份相关配置 cp /etc/apt/sources.list /etc/apt/source.list.bak
- vim /etc/apt/sources.list
-
阿里云源
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
-
清华
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
中科大
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
网易
deb http://mirrors.163.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ jammy-backports main restricted universe multiverse
5.sudo apt-get update; sudo apt-get upgrade
UBuntu的软件升级命令
-
apt-get update
-
apt-get upgrade
-
apt-get dist-upgrade
-
apt -f install
UBuntu防火墙命令
安装方法
sudo apt-get install ufw
使用方法
1 启用
sudo ufw enable sudo ufw default deny
作用:开启了防火墙并随系统启动同时关闭所有外部对本机的访问(本机访问外部正常)。
2 关闭
sudo ufw disable
2 查看防火墙状态
sudo ufw status
3 开启/禁用相应端口或服务举例
sudo ufw allow 80 允许外部访问80端口
sudo ufw delete allow 80 禁止外部访问80 端口
sudo ufw allow from 192.168.1.1 允许此IP访问所有的本机端口
sudo ufw deny smtp 禁止外部访问smtp服务
sudo ufw delete allow smtp 删除上面建立的某条规则 sudo ufw deny proto tcp from 10.0.0.0/8 to 192.168.0.1 port 22 要拒绝所有的TCP流量从10.0.0.0/8 到192.168.0.1地址的22端口
可以允许所有RFC1918网络(局域网/无线局域网的)访问这个主机(/8,/16,/12是一种网络分级): sudo ufw allow from 10.0.0.0/8 sudo ufw allow from 172.16.0.0/12 sudo ufw allow from 192.168.0.0/16
推荐设置
sudo apt-get install ufw sudo ufw enable sudo ufw default deny
这样设置已经很安全,如果有特殊需要,可以使用sudo ufw allow开启相应服务。
UBuntu pwn环境搭建
1.安装UBuntu
下载Ubuntu桌面系统 | Ubuntuhttps://cn.ubuntu.com/download/desktop
2.VMware创建UBuntu虚拟机
3.ubuntu20.04 使用root用户自动登录系统
1、设置/修改root用户密码
2、修改配置文件
2.1、修改桌面显示管理器配置(LightDM是一个跨桌面显示管理器,Ubuntu中运行的LightDM负责启动X Server,用户会话和欢迎界面。)
sudo gedit /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf
[Seat:*]
user-session=ubuntu
greeter-show-manual-login=true #手工输入登录系统的用户名和密码
allow-guest=false #不允许guest登录
2.2、修改gdm-autologin和gdm-password
(1)sudo gedit /etc/pam.d/gdm-autologin
注释掉auth required pam_succeed_if.so user != root quiet_success
(2)sudo gedit /etc/pam.d/gdm-password
注释掉 auth required pam_succeed_if.so user != root quiet_success
2.3 修改/root/.profile文件
sudo gedit /root/.profile
# ~/.profile: executed by Bourne-compatible login shells.
if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi
# mesg n 2> /dev/null || true
tty -s &&mesg n || true
2.4 修改/etc/gdm3/custom.conf
sudo gedit /etc/gdm3/custom.conf
# GDM configuration storage
#
# See /usr/share/gdm/gdm.schemas for a list of available options.
[daemon]
# Uncomment the line below to force the login screen to use Xorg
#WaylandEnable=false
# Enabling automatic login
# AutomaticLoginEnable = true
# AutomaticLogin = user1
AutomaticLoginEnable=true #是否自动登录系统,设为ture时每次会自动进入系统,而不用输密码
AutomaticLogin=root #自动登录系统时的默认用户名
# Enabling timed login
# TimedLoginEnable = true
# TimedLogin = user1
# TimedLoginDelay = 10
TimedLoginEnable=true #是否开启超时自动登录
TimedLogin=root #超时自动登录的用户
TimedLoginDelay=10 #超时时间
[security]
[xdmcp]
[chooser]
[debug]
# Uncomment the line below to turn on debugging
# More verbose logs
# Additionally lets the X server dump core if it crashes
#Enable=true
3、重启
reboot
4.UBuntu换源
5.安装pwntools
pip install pwntools
6.安装pwndbg
git clone https://github.com/pwndbg/pwndbg
7.安装LibcSearcher
8.安装checksec
9.安装qemu
apt list qemu*
apt install qemu-system-x86
10.安装vmlinux-to-elf
git clone https://github.com/marin-m/vmlinux-to-elf
cd vmlinux-to-elf
sudo python3 ./setup.py install
11.ARM pwn环境搭建
sudo apt install gdb-multiarch
sudo apt install qemu-user-static
12. 配置kernel pwn环境