# 切换zsh
chsh -s /bin/zsh
# 安装ohmyzsh
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
source ~/.zshrc
# 安装fzf
cd ~
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
cd ~/.fzf/
./install
# 下载ccat
cd ~
wget https://github.com/jingweno/ccat/releases/download/v1.1.0/linux-amd64-1.1.0.tar.gz
tar -xvf linux-amd64-1.1.0.tar.gz
sudo cp ./linux-amd64-1.1.0/ccat /usr/bin/
# 安装brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile
# 下载conda
wget https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh
# 安装conda
bash Anaconda3-5.0.0.1-Linux-x86_64.sh
# 信息处理工具包基础conda环境
conda install numpy pandas scipy xlwt zipp requests seaborn statsmodels pyopenssl scikit-learn scrapy matplotlib nltk httpx PyMySQL spacy sympy seaborn plotly Pillow pandocfilters
pip install jupyter notebook xgboost you-get selenium regex networkx newspaper3k flake8 geoip2 cryptography
# 信息预处理包
git clone https://github.com/fighting41love/cocoNLP.git
cd cocoNLP
python setup.py install
pip install wordninja networkx ngender langid langdetect zhon jieba hanlp pypinyin
conda install cupy
# 安装kite代码补全,centos无法使用
pip install jupyterlab -U
pip install "jupyterlab-kite>=2.0.2"
bash -c "$(wget -q -O - https://linux.kite.com/dls/linux/current)"
systemctl --user start kite-autostart
/root/.local/share/kite/kited
jupyter lab --allow-root
def dowload_function(host_name,ip,remote,localhost):
#下载文件
rsync_cmd = "rsync -avP "
symbol = "@"
at_remote_symobl = ":"
blank_space= " "
cmd = "{}{}{}{}{}{}{}{}".format(rsync_cmd,host_name,symbol,ip,at_remote_symobl,remote,blank_space,localhost)
return cmd
def upload_function(host_name,ip,remote,localhost):
#上传见闻
rsync_cmd = "rsync -avP "
symbol = "@"
at_remote_symobl = ":"
blank_space= " "
cmd = "{}{}{}{}{}{}{}{}".format(rsync_cmd,localhost,blank_space,host_name,symbol,ip,at_remote_symobl,remote)
return cmd
def creat_public_key_function():
#传入密钥
return "ssh-keygen"
def injection_of_public_key_function(remote_host_name,ip):
#注入公钥
id_pub_cmd = "ssh-copy-id"
blank_space= " "
symbol = "@"
cmd = id_pub_cmd+blank_space+remote_host_name+symbol+ip
return cmd
import re
import geoip2.database
reader = geoip2.database.Reader('GeoLite2-City.mmdb')
# 查询IP地址对应的物理地址
def ip_get_location(ip_address):
# 载入指定IP相关数据
response = reader.city(ip_address)
#读取国家代码
Country_IsoCode = response.country.iso_code
#读取国家名称
Country_Name = response.country.name
#读取国家名称(中文显示)
Country_NameCN = response.country.names['zh-CN']
#读取州(国外)/省(国内)名称
Country_SpecificName = response.subdivisions.most_specific.name
#读取州(国外)/省(国内)代码
Country_SpecificIsoCode = response.subdivisions.most_specific.iso_code
#读取城市名称
City_Name = response.city.name
#读取邮政编码
City_PostalCode = response.postal.code
#获取纬度
Location_Latitude = response.location.latitude
#获取经度
Location_Longitude = response.location.longitude
if(Country_IsoCode == None):
Country_IsoCode = "None"
if(Country_Name == None):
Country_Name = "None"
if(Country_NameCN == None):
Country_NameCN = "None"
if(Country_SpecificName == None):
Country_SpecificName = "None"
if(Country_SpecificIsoCode == None):
Country_SpecificIsoCode = "None"
if(City_Name == None):
City_Name = "None"
if(City_PostalCode == None):
City_PostalCode = "None"
if(Location_Latitude == None):
Location_Latitude = "None"
if(Location_Longitude == None):
Location_Longitude = "None"
print('================Start===================')
print('[*] Target: ' + ip_address + ' GeoLite2-Located ')
print(u' [+] 国家编码: ' + Country_IsoCode)
print(u' [+] 国家名称: ' + Country_Name)
print(u' [+] 国家中文名称: ' + Country_NameCN)
print(u' [+] 省份或州名称: ' + Country_SpecificName)
print(u' [+] 省份或州编码: ' + Country_SpecificIsoCode)
print(u' [+] 城市名称 : ' + City_Name)
print(u' [+] 城市邮编 : ' + City_PostalCode)
print(u' [+] 纬度: ' + str(Location_Latitude))
print(u' [+] 经度 : ' + str(Location_Longitude))
print('===============End======================')
# 检验和处理ip地址
def seperate_ip(ip_address):
ip_match = r"^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|0?[0-9]?[1-9]|0?[1-9]0)\.)(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){2}(?:25[0-4]|2[0-4][0-9]|1[0-9][0-9]|0?[0-9]?[1-9]|0?[1-9]0)$"
ip_match_list = r"^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|0?[0-9]?[1-9]|0?[1-9]0)\.)(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){2}(?:25[0-4]|2[0-4][0-9]|1[0-9][0-9]|0?[0-9]?[1-9])-(?:25[0-4]|2[0-4][0-9]|1[0-9][0-9]|0?[0-9]?[1-9]|0?[1-9]0)$"
if re.match(ip_match, ip_address):
try:
ip_get_location(ip_address)
except Exception as e:
print(e)
elif re.match(ip_match_list, ip_address):
ip_start = ip_address.split('-')[0].split('.')[3]
ip_end = ip_address.split('-')[1]
# 如果ip地址范围一样,则直接执行
if(ip_start == ip_end):
try:
seperate_ip(ip_address.split('-')[0])
except Exception as e:
print(e)
elif ip_start > ip_end:
print('the value of ip, that you input, has been wrong! try again!')
exit(0)
else:
ip_num_list = ip_address.split('-')[0].split('.')
ip_num_list.pop()
for ip_last in range(int(ip_start), int(ip_end)+1):
ip_add = '.'.join(ip_num_list)+'.'+str(ip_last)
try:
ip_get_location(ip_add)
except Exception as e:
print(e)
else:
print('Wrong type of ip address!')
print('100.8.11.58 100.8.11.58-100 alike!')
if __name__ == '__main__':
root = "root"
ip = "0.0.0.0"
remote = "~/anyfile.tgz"
localhost = "~/Downloads/anyfile.tgz"
seperate_ip('39.99.228.188')
print(dowload_function(host_name=root,ip=ip,remote=remote,localhost=localhost))
print(upload_function(host_name=root,ip=ip,remote=remote,localhost=localhost))
print(injection_of_public_key_function(remote_host_name=root,ip=ip))
vim ~/.zshrc 添加链接
#刷新DNS缓存
alias reDNS="sudo /etc/init.d/nscd restart"
#抓包
alias checkPakg="sudo tcpdump -i any"
# GPU状态
alias GPUstate="watch -n 1 nvidia-smi"
#每隔一秒高亮显示网络连接数变化
alias NetWorkState="watch -n 1 -d netstat -ant"