- 安装
sudo apt install python3-venv
- 使用
- 创建虚拟环境
sudo python3 -m venv 虚拟环境名称
- 启动虚拟环境
source 虚拟环境名称/bin/activate
- 退出虚拟环境
deactivate
virtualenv
- 安装
apt install python3-virtualenv
- 使用
- 创建虚拟环境
virtualenv 虚拟环境名称
如果存在python解释器,可以选择指定Python解释器,例如
virtualenv -p /usr/bin/python2.7 my_project_env
- 启动虚拟环境
source my_project_env/bin/activate
- 停用虚拟环境
deactivate
virtualenvwrapper
- 安装(确保virtualenv已经安装)
pip3 install virtualenvwrapper
export WORKON\_HOME=~/Envs #设置环境变量
mkdir -p $WORKON\_HOME #创建虚拟环境管理目录
find / -name virtualenvwrapper.sh #找到virtualenvwrapper.sh的路径
source 路径 #激活virtualenvwrapper.sh
- 基本使用
- 创建虚拟环境
mkvirtualenv project_env
这会在Envs 中创建 project_env虚拟环境
选择一个python解释器来搭建:
mkvirtualenv env --python=python2.7
- 在虚拟环境上工作
workon project_env
或者,您可以创建一个项目,它会创建虚拟环境,并在 $WORKON_HOME
中创建一个项目目录。 当您使用 workon project_env
时,会 cd -ed
到项目目录中。
mkvirtualenv project_env
virtualenvwrapper
提供环境名字的tab补全功能。当您有很多环境, 并且很难记住它们的名字时,这就显得很有用。
workon
也能停止您当前所在的环境,所以您可以在环境之间快速的切换。
- 停止虚拟环境
deactivate
- 删除
rmvirtualenv project_env
这里只是简要介绍有关工具的使用方式,更详细的信息各位读者可以自行在互联网上查阅,更专业也更具体。
下载地址
克隆OneForAll项目,和上面一下镜像的为gitee,有条件的可以选GitHub,二选一个
github:
sudo git clone https://github.com/shmilylty/OneForAll.git
gitee:
sudo git clone https://gitee.com/shmilylty/OneForAll.git
报错处理
对于高版本的python,在执行OneForall安装文件时会出现报错,下面提供一种解决方式,目前本人测试在自己的环境中可以解决,但对于读者的配置环境存在无法解决的可能。
1、克隆OneForall
┌──(hunter㉿hunter)-[/Tools/1_信息搜集/2_子域名收集]
└─$ sudo git clone https://github.com/shmilylty/OneForAll.git
正克隆到 'OneForAll'...
remote: Enumerating objects: 11794, done.
remote: Counting objects: 100% (501/501), done.
remote: Compressing objects: 100% (217/217), done.
remote: Total 11794 (delta 293), reused 420 (delta 276), pack-reused 11293
接收对象中: 100% (11794/11794), 105.47 MiB | 15.49 MiB/s, 完成.
处理 delta 中: 100% (6846/6846), 完成.
┌──(hunter㉿hunter)-[/Tools/1_信息搜集/2_子域名收集]
└─$ ls
2_subfinder OneForAll
┌──(hunter㉿hunter)-[/Tools/1_信息搜集/2_子域名收集]
└─$ sudo mv OneForAll 1_OneForAll
2、创建虚拟环境
┌──(hunter㉿hunter)-[/Tools/1_信息搜集/2_子域名收集]
└─$ ls
1_OneForAll 2_subfinder
┌──(hunter㉿hunter)-[/Tools/1_信息搜集/2_子域名收集]
└─$ cd 1_OneForAll
┌──(hunter㉿hunter)-[/Tools/1_信息搜集/2_子域名收集/1_OneForAll]
└─$ sudo python3 -m venv Env
[sudo] hunter 的密码:
┌──(hunter㉿hunter)-[/Tools/1_信息搜集/2_子域名收集/1_OneForAll]
└─$ ls
brute.py Dockerfile images Pipfile takeover.py
common docs LICENSE Pipfile.lock test.py
config Env modules README.md thirdparty
data export.py oneforall.py requirements.txt
3、启动虚拟环境&&安装OneForAll
注:请在已经下载的OneForAll目录下创建虚拟环境,避免出现调用时引用依赖错误。另外请先进入root环境。
┌──(hunter㉿hunter)-[/Tools/1_信息搜集/2_子域名收集/1_OneForAll]
└─$ sudo su
┌──(root㉿hunter)-[/Tools/1_信息搜集/2_子域名收集/1_OneForAll]
└─# source Env/bin/activate
┌──(Env)─(root㉿hunter)-[/Tools/1_信息搜集/2_子域名收集/1_OneForAll]
└─# ls
brute.py Dockerfile images Pipfile takeover.py
common docs LICENSE Pipfile.lock test.py
config Env modules README.md thirdparty
data export.py oneforall.py requirements.txt
┌──(Env)─(root㉿hunter)-[/Tools/1_信息搜集/2_子域名收集/1_OneForAll]
└─# pip3 install -r requirements.txt
Collecting beautifulsoup4==4.11.1 (from -r requirements.txt (line 1))
Using cached beautifulsoup4-4.11.1-py3-none-any.whl (128 kB)
Collecting bs4==0.0.1 (from -r requirements.txt (line 2))
Using cached bs4-0.0.1-py3-none-any.whl
Collecting certifi==2022.06.15 (from -r requirements.txt (line 3))
Using cached certifi-2022.6.15-py3-none-any.whl (160 kB)
Collecting chardet==5.0.0 (from -r requirements.txt (line 4))
Using cached chardet-5.0.0-py3-none-any.whl (193 kB)
Collecting colorama==0.4.4 (from -r requirements.txt (line 5))
Using cached colorama-0.4.4-py2.py3-none-any.whl (16 kB)
Collecting dnspython==2.2.1 (from -r requirements.txt (line 6))
Using cached dnspython-2.2.1-py3-none-any.whl (269 kB)
Collecting exrex==0.10.5 (from -r requirements.txt (line 7))
Using cached exrex-0.10.5-py3-none-any.whl
Collecting fire==0.4.0 (from -r requirements.txt (line 8))
Using cached fire-0.4.0-py2.py3-none-any.whl
Collecting future==0.18.2 (from -r requirements.txt (line 9))
Using cached future-0.18.2-py3-none-any.whl
Collecting idna==3.3 (from -r requirements.txt (line 10))
Using cached idna-3.3-py3-none-any.whl (61 kB)
Collecting loguru==0.6.0 (from -r requirements.txt (line 11))
Using cached loguru-0.6.0-py3-none-any.whl (58 kB)
Collecting PySocks==1.7.1 (from -r requirements.txt (line 12))
Using cached PySocks-1.7.1-py3-none-any.whl (16 kB)
Collecting requests==2.28.1 (from -r requirements.txt (line 13))
Using cached requests-2.28.1-py3-none-any.whl (62 kB)
Collecting six==1.16.0 (from -r requirements.txt (line 14))
Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting soupsieve==2.3.2 (from -r requirements.txt (line 15))
Using cached soupsieve-2.3.2-py3-none-any.whl (37 kB)
Collecting SQLAlchemy==1.3.22 (from -r requirements.txt (line 16))
Using cached SQLAlchemy-1.3.22-cp311-cp311-linux_x86_64.whl
Collecting tenacity==8.0.1 (from -r requirements.txt (line 17))
Using cached tenacity-8.0.1-py3-none-any.whl (24 kB)
Collecting termcolor==1.1.0 (from -r requirements.txt (line 18))
Using cached termcolor-1.1.0-py3-none-any.whl
Collecting tqdm==4.64.0 (from -r requirements.txt (line 19))
Using cached tqdm-4.64.0-py2.py3-none-any.whl (78 kB)
Collecting treelib==1.6.1 (from -r requirements.txt (line 20))
Using cached treelib-1.6.1-py3-none-any.whl
Collecting urllib3==1.26.9 (from -r requirements.txt (line 21))
Using cached urllib3-1.26.9-py2.py3-none-any.whl (138 kB)
Collecting win32-setctime==1.1.0 (from -r requirements.txt (line 22))
Using cached win32_setctime-1.1.0-py3-none-any.whl (3.6 kB)
Collecting charset-normalizer<3,>=2 (from requests==2.28.1->-r requirements.txt (line 13))
Using cached charset_normalizer-2.1.1-py3-none-any.whl (39 kB)
Installing collected packages: termcolor, exrex, win32-setctime, urllib3, tqdm, tenacity, SQLAlchemy, soupsieve, six, PySocks, loguru, idna, future, dnspython, colorama, charset-normalizer, chardet, certifi, treelib, requests, fire, beautifulsoup4, bs4
Successfully installed PySocks-1.7.1 SQLAlchemy-1.3.22 beautifulsoup4-4.11.1 bs4-0.0.1 certifi-2022.6.15 chardet-5.0.0 charset-normalizer-2.1.1 colorama-0.4.4 dnspython-2.2.1 exrex-0.10.5 fire-0.4.0 future-0.18.2 idna-3.3 loguru-0.6.0 requests-2.28.1 six-1.16.0 soupsieve-2.3.2 tenacity-8.0.1 termcolor-1.1.0 tqdm-4.64.0 treelib-1.6.1 urllib3-1.26.9 win32-setctime-1.1.0
4、测试是否异常
┌──(Env)─(root㉿hunter)-[/Tools/1_信息搜集/2_子域名收集/1_OneForAll]
└─# python3 oneforall.py --help
Traceback (most recent call last):
File "/Tools/1\_信息搜集/2\_子域名收集/1\_OneForAll/oneforall.py", line 16, in <module>
from brute import Brute
File "/Tools/1\_信息搜集/2\_子域名收集/1\_OneForAll/brute.py", line 14, in <module>
import exrex
File "/Tools/1\_信息搜集/2\_子域名收集/1\_OneForAll/Env/lib/python3.11/site-packages/exrex.py", line 25, in <module>
from re import sre_parse, U
ImportError: cannot import name 'sre\_parse' from 're' (/usr/lib/python3.11/re/__init__.py)
请先别急,这里报错是因为缺少sre_parse模块。实际上是因为高版本python中re模块没有了sre_parse模块,可以修改exrex.py 代码,直接导入sre_parse模块。
┌──(Env)─(root㉿hunter)-[/Tools/1_信息搜集/2_子域名收集/1_OneForAll]
└─# vim /Tools/1\_信息搜集/2\_子域名收集/1\_OneForAll/Env/lib/python3.11/site-packages/exrex.py
注意此处目录的路径,需要与报错路径一致。
修改exrex.py
如下:
try:
from future_builtins import map, range
except:
pass
import sre_parse
#from re import sre\_parse, U
from re import U
from itertools import tee
from random import choice, randint
from types import GeneratorType
再次运行,可以尝试以下命令
python3 oneforall.py --target baidu.com run
出现如下代表已经成功
┌──(Env)─(root㉿hunter)-[/Tools/1_信息搜集/2_子域名收集/1_OneForAll]
└─# python3 oneforall.py --target baidu.com run
OneForAll is a powerful subdomain integration tool
___ _ _
___ ___ ___| _|___ ___ ___| | | {v0.4.5 #dev}
| . | | -_| _| . | _| .'| | |
|___|_|_|___|_| |___|_| |__,|_|_| git.io/fjHT1
OneForAll is under development, please update before each use!
[*] Starting OneForAll @ 2024-01-27 21:44:00
21:44:00,894 [INFOR] utils:532 - Checking dependent environment
21:44:00,894 [INFOR] utils:544 - Checking network environment
21:44:09,437 [INFOR] utils:555 - Checking for the latest version
21:44:20,605 [INFOR] utils:579 - The current version v0.4.5 is already the latest version
21:44:20,610 [INFOR] oneforall:241 - Start running OneForAll
21:44:20,614 [INFOR] oneforall:246 - Got 1 domains
21:44:20,641 [INFOR] wildcard:108 - Detecting baidu.com use wildcard dns record or not
21:44:20,842 [ALERT] wildcard:123 - The domain baidu.com disables wildcard
21:44:20,843 [INFOR] collect:44 - Start collecting subdomains of baidu.com
21:44:20,950 [INFOR] module:63 - QueryMX module took 0.0 seconds found 0 subdomains
21:44:20,977 [INFOR] module:63 - QueryNS module took 0.0 seconds found 5 subdomains
21:44:20,983 [INFOR] module:63 - AXFRCheck module took 0.1 seconds found 0 subdomains
21:44:20,988 [INFOR] module:63 - NSECCheck module took 0.1 seconds found 0 subdomains
21:44:21,003 [INFOR] module:63 - QuerySOA module took 0.1 seconds found 2 subdomains
21:44:21,010 [INFOR] module:63 - QuerySPF module took 0.1 seconds found 0 subdomains
21:44:21,016 [INFOR] module:63 - QueryTXT module took 0.1 seconds found 4 subdomains
常用使用方式
1、您可以在OneForAll的config目录下修改有关配置
api.py
# 模块API配置
# Censys可以免费注册获取API:https://censys.io/api
censys_api_id = ''
censys_api_secret = ''
# Binaryedge可以免费注册获取API:https://app.binaryedge.io/account/api
# 免费的API有效期只有1个月,到期之后可以再次生成,每月可以查询250次。
binaryedge_api = ''
# BeVigil API: https://bevigil.com/osint-api
bevigil_api = ''
# Chinaz可以免费注册获取API:http://api.chinaz.com/ApiDetails/Alexa
chinaz_api = ''
# Bing可以免费注册获取API:https://azure.microsoft.com/zh-cn/services/
# cognitive-services/bing-web-search-api/#web-json
bing_api_id = ''
bing_api_key = ''
# SecurityTrails可以免费注册获取API:https://securitytrails.com/corp/api
securitytrails_api = ''
# https://fofa.so/api
fofa_api_email = '' # fofa用户邮箱
fofa_api_key = '' # fofa用户key
# Google可以免费注册获取API:
# 免费的API只能查询前100条结果
# https://developers.google.com/custom-search/v1/overview#search\_engine\_id
# 创建自定义搜索引擎后需要在响应的控制面板上启用Search the entire web
google_api_id = '' # Google API自定义搜索引擎id
# https://developers.google.com/custom-search/v1/overview#api\_key
google_api_key = '' # Google API自定义搜索key
# https://api.passivetotal.org/api/docs/
riskiq_api_username = ''
riskiq_api_key = ''
# Shodan可以免费注册获取API: https://account.shodan.io/register
# 免费的API限速1秒查询1次
shodan_api_key = ''
# ThreatBook API 查询子域名需要收费 https://x.threatbook.cn/nodev4/vb4/myAPI
threatbook_api_key = ''
# VirusTotal可以免费注册获取API: https://developers.virustotal.com/reference
virustotal_api_key = ''
# https://www.zoomeye.org/doc?channel=api
zoomeye_api_key = ''
# Spyse可以免费注册获取API: https://spyse.com/
spyse_api_token = ''
# https://www.circl.lu/services/passive-dns/
circl_api_username = ''
circl_api_password = ''
# https://www.dnsdb.info/
dnsdb_api_key = ''
# ipv4info可以免费注册获取API: http://ipv4info.com/tools/api/
**自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。**
**深知大多数Linux运维工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!**
**因此收集整理了一份《2024年Linux运维全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。**
![img](https://img-blog.csdnimg.cn/img_convert/83a9ca0cc17808d5b772554099e76841.png)
![img](https://img-blog.csdnimg.cn/img_convert/96e7cb8d0b53a3b2ab21d967f0c74e04.png)
![img](https://img-blog.csdnimg.cn/img_convert/c09f52b82132c183a6d1bea3252edce4.png)
![img](https://img-blog.csdnimg.cn/img_convert/c7599afb79a21f22083b1d2d22553b0b.png)
![img](https://img-blog.csdnimg.cn/img_convert/3e2dcfb9f5bbd3569eb609d8cd78306f.png)
**既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Linux运维知识点,真正体系化!**
**由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新**
**如果你觉得这些内容对你有帮助,可以添加VX:vip1024b (备注Linux运维获取)**
![img](https://img-blog.csdnimg.cn/img_convert/054c6eb230b524893dd670ca99ed0572.jpeg)
为了做好运维面试路上的助攻手,特整理了上百道 **【运维技术栈面试题集锦】** ,让你面试不慌心不跳,高薪offer怀里抱!
这次整理的面试题,**小到shell、MySQL,大到K8s等云原生技术栈,不仅适合运维新人入行面试需要,还适用于想提升进阶跳槽加薪的运维朋友。**
![](https://img-blog.csdnimg.cn/img_convert/8d4842196817a8680ce7dd60d4326c50.png)
本份面试集锦涵盖了
* **174 道运维工程师面试题**
* **128道k8s面试题**
* **108道shell脚本面试题**
* **200道Linux面试题**
* **51道docker面试题**
* **35道Jenkis面试题**
* **78道MongoDB面试题**
* **17道ansible面试题**
* **60道dubbo面试题**
* **53道kafka面试**
* **18道mysql面试题**
* **40道nginx面试题**
* **77道redis面试题**
* **28道zookeeper**
**总计 1000+ 道面试题, 内容 又全含金量又高**
* **174道运维工程师面试题**
> 1、什么是运维?
> 2、在工作中,运维人员经常需要跟运营人员打交道,请问运营人员是做什么工作的?
> 3、现在给你三百台服务器,你怎么对他们进行管理?
> 4、简述raid0 raid1raid5二种工作模式的工作原理及特点
> 5、LVS、Nginx、HAproxy有什么区别?工作中你怎么选择?
> 6、Squid、Varinsh和Nginx有什么区别,工作中你怎么选择?
> 7、Tomcat和Resin有什么区别,工作中你怎么选择?
> 8、什么是中间件?什么是jdk?
> 9、讲述一下Tomcat8005、8009、8080三个端口的含义?
> 10、什么叫CDN?
> 11、什么叫网站灰度发布?
> 12、简述DNS进行域名解析的过程?
> 13、RabbitMQ是什么东西?
> 14、讲一下Keepalived的工作原理?
> 15、讲述一下LVS三种模式的工作过程?
> 16、mysql的innodb如何定位锁问题,mysql如何减少主从复制延迟?
> 17、如何重置mysql root密码?
[**一个人可以走的很快,但一群人才能走的更远。如果你从事以下工作或对以下感兴趣,欢迎戳这里加入程序员的圈子,让我们一起学习成长!**](https://bbs.csdn.net/forums/4304bb5a486d4c3ab8389e65ecb71ac0)
**AI人工智能、Android移动开发、AIGC大模型、C C#、Go语言、Java、Linux运维、云计算、MySQL、PMP、网络安全、Python爬虫、UE5、UI设计、Unity3D、Web前端开发、产品经理、车载开发、大数据、鸿蒙、计算机网络、嵌入式物联网、软件测试、数据结构与算法、音视频开发、Flutter、IOS开发、PHP开发、.NET、安卓逆向、云计算**
、讲述一下Tomcat8005、8009、8080三个端口的含义?
> 10、什么叫CDN?
> 11、什么叫网站灰度发布?
> 12、简述DNS进行域名解析的过程?
> 13、RabbitMQ是什么东西?
> 14、讲一下Keepalived的工作原理?
> 15、讲述一下LVS三种模式的工作过程?
> 16、mysql的innodb如何定位锁问题,mysql如何减少主从复制延迟?
> 17、如何重置mysql root密码?
[**一个人可以走的很快,但一群人才能走的更远。如果你从事以下工作或对以下感兴趣,欢迎戳这里加入程序员的圈子,让我们一起学习成长!**](https://bbs.csdn.net/forums/4304bb5a486d4c3ab8389e65ecb71ac0)
**AI人工智能、Android移动开发、AIGC大模型、C C#、Go语言、Java、Linux运维、云计算、MySQL、PMP、网络安全、Python爬虫、UE5、UI设计、Unity3D、Web前端开发、产品经理、车载开发、大数据、鸿蒙、计算机网络、嵌入式物联网、软件测试、数据结构与算法、音视频开发、Flutter、IOS开发、PHP开发、.NET、安卓逆向、云计算**