kali安装Ghidra插件FindCrypto

kali安装Ghidra插件FindCrypto

安装地址

https://github.com/d3v1l401/FindCrypt-Ghidra

输入命令

1
2
3
cd FindCrypt

GHIDRA_INSTALL_DIR=/home/kali/ghidra_first/ghidra_10.3.1_PUBLIC gradle

报错处理

但是gradle版本过低出现报错
What went wrong:
A problem occurred evaluating script.
Requires at least Gradle 7.3, but was run with 4.4.1
不要直接sudo apt install gradle,这样永远都是下载4.4.1版本的,于是要下载高版本的gradle
https://services.gradle.org/distributions/
不能这样替换,会报错,不要这么干,这是某个csdn上的,自己尝试是不行的

1
2
3
4
sudo cp -r /usr/share/gradle /usr/share/gradle_bak
sudo cp -r ./gradle-6.9/* /usr/share/gradle
#复制完成后执行下面一条命令,确认版本是否替换:
gradle -v

我的正确做法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
解压下载好的zip文件,然后开始配置环境变量
在 /etc/profile.d下创建 gradle.sh文件
export GRADLE_HOME=/home/kali/file/gradle-7.3
export PATH=$PATH:$GRADLE_HOME/bin
export GRADLE_USER_HOME=/home/kali/file/gradle-7.3/bin/.gradle

/etc/profile也需要加入内容
#gradle
export PATH=$PATH:/soft/gradle-6.5.1/bin

修改配置后,立即生效,执行
source /etc/profile
[为什么每次进入命令都要重新source /etc/profile 才能生效?[https://blog.csdn.net/lwplvx/article/details/79192182](https://blog.csdn.net/lwplvx/article/details/79192182)]

[source /etc/profile作用](https://blog.csdn.net/llzhang_fly/article/details/104980029)
查看gradle的版本信息
gradle -version

gradle安好了,再次重复:一定不能用sudo的方法
Snipaste_2023-08-16_20-38-45

继续

但是findcrypt依然不能build
Snipaste_2023-08-16_20-58-39

仔细看了一下报错信息,把help文件夹给删掉了,然后就好了,好像也不影响后面的插件导入

1
2
3
4
5
6
7
8
9
10
$ GHIDRA_INSTALL_DIR=/home/kali/ghidra_first/ghidra_10.3.1_PUBLIC  gradle
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true

> Task :buildExtension

Created task ':buildExtension' property 'archiveBaseName'.task ':buildExtension' property 'archiveExtension' in task ':buildExtension' property 'destinationDirectory'

BUILD SUCCESSFUL in 560ms
5 actionable tasks: 3 executed, 2 up-to-date

Snipaste_2023-08-16_21-13-45

下一步,打开ghidra把他装进去
事先把这个zip文件放到/home/kali/ghidra_first/ghidra_10.3.1_PUBLIC/Ghidra/Extensions/文件夹下面
file ->install extentions ->点击加号,重启即可

结束

参考

https://blog.csdn.net/llzhang_fly/article/details/104980029 source /etc/profile 文件的作用:linux下使用source /etc/profile保存配置后,新的环境变量只能在一个终端里面有效。但是,当时想的是反正只用一次,所以我就没管了

附上固件下载地址来源:smile-e3/FirmwaresAddress: IOT设备固件下载地址 (github.com)

通用固件下载地址,不仅包含路由器和摄像头。https://drivers.softpedia.com/manufacturers/

D-Link固件地址 https://tsd.dlink.com.tw/

海康威视固件地址 https://www.hikvisioneurope.com/eu/

LILIN 摄像头固件下载地址 https://www.meritlilin.com/en/support/file/type/Firmware

TP-Link固件下载地址 https://www.tp-link.com/us/choose-your-location/

ipTIME固件下载地址 http://iptime.com/iptime/?page_id=126

下载英特尔® 驱动程序和软件 (intel.cn) https://www.intel.cn/content/www/cn/zh/download-center/home.html

目前找到的密码学库的说明文档

Mbed TLS API documentation — Mbed TLS Versioned documentation (mbed-tls.readthedocs.io)

/index.html (openssl.org)

OpenBSD

同类型的脚本

AllsafeCyberSecurity/py-findcrypt-ghidra: FindCrypt for Ghidra written in Python (github.com)

用DFS的方法求图连通分量个数

用DFS的方法求图中连通分量的个数

原本很简单的一题思考了很久,这就是写伪代码写多了的后果
很多关于道路的题目,什么顶点相连接的题目都能用到关于图的方法

先讲最最基本的没有任何优化的方法,优化后续考虑

流程

初始化一个二维数组用来存储无向图G[ ][ ]

初始化记录连通分量个数的int count=0

从任意顶点开始DFS,通过这个顶点遍历到的所有顶点都属于同一个连通分量,对于DFS的细节:这些遍历到的顶点要做好标记,表示已经被访问过

1
2
3
4
5
6
7
8
9
10
11
void dfs(int k){
visited[k]=1;
//记录所属的连通分量的编号
//id[k]=cnt2;
for(int i=1;i<=n;i++){
if(G[k][i]==1 && visited[i]==0){
cnt++;//分量内的点的个数
dfs(i);
}
}
}

从没有访问过的顶点取出一个顶点,重复DFS,遍历完成之后count++,这就需要两个函数,不仅仅DFS,还有一个计数函数

1
2
3
4
5
6
7
8
void count(int n){
for(int i=1;i<=n;i++){
if(visited[i]==0){
dfs(i);
cnt2++;
}
}
}

输出count,这个就是图中连通分量的个数(cnt2)

代码

题目链接:3719. 畅通工程 - AcWing题库

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
30
31
32
33
34
35
36
37
38
39
40
#include<iostream>
#include<cstring>
using namespace std;
int cnt=0,cnt2=0,n,m,cin1,cin2;
int visited[1000];
int G[1005][1005];
void dfs(int k){
visited[k]=1;
for(int i=1;i<=n;i++){
if(G[k][i]==1 && visited[i]==0){
cnt++;//分量内的点的个数
dfs(i);
}
}
}

void count(int n){
for(int i=1;i<=n;i++){
if(visited[i]==0){
dfs(i);
cnt2++;
}
}
}
int main(){
//memset(visited,0,sizeof(visited));
//memset(G,0,sizeof(G));
cin >> n >> m;
for(int i=0;i<m;i++){
cin >> cin1 >> cin2;
G[cin1][cin2]=1;
G[cin2][cin1]=1;
}

//dfs(1);
count(n);
//cout << cnt << endl;
cout << cnt2-1 << endl;
return 0;
}

参考

https://blog.csdn.net/qq_40438165/article/details/88540261

在kali安装docker

在kali中安装docker详细版

Docke是渗透测试中必学不可的一个容器工具,在其中,我们能够快速创建、运行、测试以及部署应用程序。如,我们对一些漏洞进行本地复现时,可以使用Docker快速搭建漏洞环境,完成复现学习。

Docker安装

首先查看版本 uname -a 安装docker要求内核版本kerner>=3.10

1
2
3
┌──(kali㉿kali)-[/]
└─$ uname -a
Linux kali 6.0.0-kali3-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.0.7-1kali1 (2022-11-07) x86_64 GNU/Linux

更新APT源满足下载要求

下面列出几个源,但我不是用的这个

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
#其他apt源
#此处,笔者仅添加中科达和阿里的,其他注释掉

#中科大
deb http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
deb-src http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib

#阿里云
deb http://mirrors.aliyun.com/kali kali-rolling main non-free contrib
deb-src http://mirrors.aliyun.com/kali kali-rolling main non-free contrib

#清华大学
#deb http://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free
#deb-src https://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free

#浙大
#deb http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free
#deb-src http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free

#东软大学
#deb http://mirrors.neusoft.edu.cn/kali kali-rolling/main non-free contribp.kali.org/kali kali-rolling main non-free contrib

#重庆大学
#deb http://http.kali.org/kali kali-rolling main non-free contrib
#deb-src http://http.kali.org/kali kali-rolling main non-free contrib

然后进行系统或者工具的更新

1
2
3
4
5
6
#进行系统或工具的更新(有丢丢就,先上把王者)
#注:当出现正在设定软件包界面时,直接按tab+enter进行确认
apt-get update && apt-get upgrade && apt-get dist-upgrade

#礼貌性清除更新缓存
apt-get clean

用apt安装docker

1
2
3
4
#为什么采用apt安装?因为之后采用apt源安装Docker的其他组件时,新组件与已安装的Docker容器最为匹配。
apt-get install docker.io
#或
apt-get install docker docker-compose

Snipaste_2023-07-29_17-14-14

检验Docker安装成功

1
2
3
4
5
6
7
8
9
#启动docker服务
service docker start

#列出docker现有镜像
docker images

#运行hello-world镜像
#但apt安装的docker没带有hello-world默认镜像呀,所以下面的命令不成功,它会帮你拉去该镜像下来
docker run hello-world

Snipaste_2023-07-29_17-16-00

出现这样就是成功的

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
┌──(root㉿kali)-[/home/kali]
└─# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest 9c7a54a9a43c 2 months ago 13.3kB

┌──(root㉿kali)-[/home/kali]
└─# docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/get-started/

设置开机自启动

1
2
#设置docker开机自启
systemctl enable docker

常用命令

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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#系统命令
systemctl start docker #启动docker
systemctl stop docker #停止docker
systemctl restart docker #重启docker
systemctl enable docker #设置docker开机自启

#基本命令
docker version #查看docker版本
docker info #查看docker详细信息
docker --help #查看docker命令

#镜像命令
docker images #查看docker镜像列表
docker images -a #列出本地所有镜像
docker images --digests #显示镜像的摘要信息
docker search redis #从Docker Hub上查找redis镜像
docker pull redis #从Docker Hub上下载redis镜像
docker rmi 373f0984b070 #删除IMAGE ID 为373f0984b070的镜像

#运行命令
#-p 6379:6379 端口映射:前表示主机部分,后表示容器部分
#-d 在后台运行容器(不进入终端)并打印容器ID/容器名
#--name myredis表示自定义容器名为myredis
docker run -d -p 6379:6379 --name myredis redis:latest #根据镜像创建并运行容器

#容器命令
docker container ls 或 docker ps #查看正在运行的容器
docker container ls -a 或 docker ps -a #列出所有容器
docker container start 容器ID 或 容器名称 #启动容器
docker start 容器ID 或 容器名称 #启动容器
docker container stop 容器ID 或 容器名称 #停止容器
docker stop 容器ID 或 容器名称 #停止容器
docker container rm 容器ID 或 容器名称 #删除容器
docker rm 容器ID 或 容器名称 #删除容器
docker container logs -f 容器ID 或 容器名称 #查看容器日志
docker exec -it name /bin/bash #进入name(容器名/id)中开启交互式的终端,exit退出


docker images #列出本地镜像
docker ps # 查看正在运行的容器
docker ps -a #查看所有容器
docker stop CONTAINER #停止一个运行的容器,其中CONTAINER为容器名
docker restart CONTAINER #重启容器
restart docker #重启docker
docker exec-it ID /bin/bash # 在运行的容器中执行命令。ID为容器id,exit退出容器命令行

docker–help中文解释

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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Usage:
docker [OPTIONS] COMMAND [arg...]
docker daemon [ --help | ... ]
docker [ --help | -v | --version ]
A
self-sufficient runtime for containers.

Options:
--config=~/.docker Location of client config files #客户端配置文件的位置
-D, --debug=false Enable debug mode #启用Debug调试模式
-H, --host=[] Daemon socket(s) to connect to #守护进程的套接字(Socket)连接
-h, --help=false Print usage #打印使用
-l, --log-level=info Set the logging level #设置日志级别
--tls=false Use TLS; implied by--tlsverify #
--tlscacert=~/.docker/ca.pem Trust certs signed only by this CA #信任证书签名CA
--tlscert=~/.docker/cert.pem Path to TLS certificate file #TLS证书文件路径
--tlskey=~/.docker/key.pem Path to TLS key file #TLS密钥文件路径
--tlsverify=false Use TLS and verify the remote #使用TLS验证远程
-v, --version=false Print version information and quit #打印版本信息并退出

Commands:
attach Attach to a running container #当前shell下attach连接指定运行镜像
build Build an image from a Dockerfile #通过Dockerfile定制镜像
commit Create a new image from a container's changes #提交当前容器为新的镜像
cp Copy files/folders from a container to a HOSTDIR or to STDOUT #从容器中拷贝指定文件或者目录到宿主机中
create Create a new container #创建一个新的容器,同run 但不启动容器
diff Inspect changes on a container's filesystem #查看docker容器变化
events Get real time events from the server#从docker服务获取容器实时事件
exec Run a command in a running container#在已存在的容器上运行命令
export Export a container's filesystem as a tar archive #导出容器的内容流作为一个tar归档文件(对应import)
history Show the history of an image #展示一个镜像形成历史
images List images #列出系统当前镜像
import Import the contents from a tarball to create a filesystem image #从tar包中的内容创建一个新的文件系统映像(对应export)
info Display system-wide information #显示系统相关信息
inspect Return low-level information on a container or image #查看容器详细信息
kill Kill a running container #kill指定docker容器
load Load an image from a tar archive or STDIN #从一个tar包中加载一个镜像(对应save)
login Register or log in to a Docker registry#注册或者登陆一个docker源服务器
logout Log out from a Docker registry #从当前Docker registry退出
logs Fetch the logs of a container #输出当前容器日志信息
pause Pause all processes within a container#暂停容器
port List port mappings or a specific mapping for the CONTAINER #查看映射端口对应的容器内部源端口
ps List containers #列出容器列表
pull Pull an image or a repository from a registry #从docker镜像源服务器拉取指定镜像或者库镜像
push Push an image or a repository to a registry #推送指定镜像或者库镜像至docker源服务器
rename Rename a container #重命名容器
restart Restart a running container #重启运行的容器
rm Remove one or more containers #移除一个或者多个容器
rmi Remove one or more images #移除一个或多个镜像(无容器使用该镜像才可以删除,否则需要删除相关容器才可以继续或者-f强制删除)
run Run a command in a new container #创建一个新的容器并运行一个命令
save Save an image(s) to a tar archive#保存一个镜像为一个tar包(对应load)
search Search the Docker Hub for images #在docker
hub中搜索镜像
start Start one or more stopped containers#启动容器
stats Display a live stream of container(s) resource usage statistics #统计容器使用资源
stop Stop a running container #停止容器
tag Tag an image into a repository #给源中镜像打标签
top Display the running processes of a container #查看容器中运行的进程信息
unpause Unpause all processes within a container #取消暂停容器
version Show the Docker version information#查看容器版本号
wait Block until a container stops, then print its exit code #截取容器停止时的退出状态值

参考

(19条消息) kali下对Docker的详细安装kali安装docker_涂寐的博客-CSDN博客

clash for linux

Clash 是一个使用 Go 语言编写,基于规则的跨平台代理软件核心程序。

下载

1
wget https://github.com/Dreamacro/clash/releases/download/v1.13.0/clash-linux-amd64-v1.13.0.gz

最新版本 https://github.com/Dreamacro/clash/releases

安装

解压后直接执行,将在 ~/.config/ 目录下生成一个 clash 目录,其中有配置文件

1
2
3
4
5
gzip -d clash-linux-amd64-v1.13.0.gz
chmod +x clash-linux-amd64-v1.13.0
./clash-linux-amd64-v1.13.0
INFO[0000] Can't find config, create a initial config file
INFO[0000] Can't find MMDB, start download

为了后期管理方便,可以之间将解压后的 clash 拷贝到 ~/.config/clash 目录下,并重命名为 clash

1
2
3
4
cp ./clash-linux-amd64-v1.13.0 ~/.config/clash/clash

$ls ~/.config/clash/
clash config.yaml

配置

下载配置文件

1
2
wget -O config.yaml "代理商提供的订阅链接"
wget -O config.yaml "https://xxxxxxxxxxxxxxxxxx06d2739906177ad22&flag=clash"

如果下载到的是一大堆字符则需要在订阅链接的后面添加 &flag=clash

执行./clash,将会下载 Country.mmdb

1
2
./clash
WARN[0000] MMDB invalid, remove and download

如果下载失败进行手动下载

1
2
3
$./clash
WARN[0000] MMDB invalid, remove and download
FATA[0030] Initial configuration directory error: can't initial MMDB: can't download MMDB: Get "https://cdn.jsdelivr.net/gh/Dreamacro/maxmind-geoip@release/Country.mmdb": dial tcp 146.75.113.229:443: i/o timeout
1
wget -O Country.mmdb https://www.sub-speeder.com/client-download/Country.mmdb

https://github.com/Dreamacro/maxmind-geoip/releases 下载也可以

以上准备配置文件弄号后就可以运行

1
2
3
4
5
6
7
8
9
10
~/.config/clash
↪ =>$ls
clash config.yaml Country.mmdb

↪ =>$./clash
INFO[0000] Start initial compatible provider 故障转移
INFO[0000] Start initial compatible provider 自动选择
INFO[0000] Start initial compatible provider 一元机场
INFO[0000] RESTful API listening at: 127.0.0.1:9090
INFO[0000] Mixed(http+socks) proxy listening at: [::]:7890

clash 启动后用浏览器访问网址 http://clash.razord.top/ ,在这里修改配置信息

命令行设置:

1
2
3
4
5
6
7
8
9
10
gsettings set org.gnome.system.proxy.http host '127.0.0.1'
gsettings set org.gnome.system.proxy.http port 7890
gsettings set org.gnome.system.proxy.https host '127.0.0.1'
gsettings set org.gnome.system.proxy.https port 7890
gsettings set org.gnome.system.proxy.ftp host ''
gsettings set org.gnome.system.proxy.ftp port 0
gsettings set org.gnome.system.proxy.socks host '127.0.0.1'
gsettings set org.gnome.system.proxy.socks port 7890

gsettings set org.gnome.system.proxy mode 'manual';

git 代理

https 传输

  • http 代理

    1
    2
    git config --global http.proxy 'http://127.0.0.1:1080'
    git config --global https.proxy 'http://127.0.0.1:1080'
  • socks5 代理

    1
    2
    git config --global http.proxy 'socks5://127.0.0.1:1081'  
    git config --global https.proxy 'socks5://127.0.0.1:1081'
  • 取消代理

    1
    2
    git config --global --unset http.proxy  
    git config --global --unset https.proxy

参考

test_my_site

Github+Hexo记录第一次配置Hexo

创建github个人仓库

首先登录个人GitHub账号,使用邮箱注册账号

点击GitHub中的New repository创建新仓库,仓库名称为:用户名.github.io(这个是固定写法)

比如我的就是: SunnyYANGyaya.github.io

安装Git

什么是Git ?简单来说Git是开源的分布式版本控制系统,用于敏捷高效地处理项目。我们网站在本地搭建好了,需要使用Git同步到GitHub上。从Git官网下载:Download for Windows 现在的机子基本都是64位的,选择64位的安装包,下载后安装,在命令行里输入git测试是否安装成功,若安装失败,参看其他详细的Git安装教程。安装成功后,将你的Git与GitHub帐号绑定,在随便哪个目录下,鼠标右击打开Git Bash

Snipaste_2023-07-18_20-47-57

如果安装成功,接下来配置ssh秘钥文件:

1
2
git config --global user.name "你的GitHub用户名"
git config --global user.email "你的GitHub注册邮箱"

生成ssh秘钥文件:

1
ssh-keygen -t rsa -C "你的GitHub注册邮箱"

然后直接三个回车,默认不需要设置密码

生成的.ssh文件在C盘用户文件夹.ssh文件夹里面,将id_rsa.pub秘钥中的内容全部复制

Snipaste_2023-07-18_20-53-13

然后打开settings_keys界面,新建new SSH Key

title随便写,把刚刚复制的sshkey粘贴到key中,key type为authentication Key(如果没有就不用选了),最后点击Add SSH key。

在Git Bash中检测GitHub公钥设置是否成功,输入 ssh git@github.com

Snipaste_2023-07-18_20-57-31

这样就是成功了

这里之所以设置GitHub密钥原因是,通过非对称加密的公钥与私钥来完成加密,公钥放置在GitHub上,私钥放置在自己的电脑里。GitHub要求每次推送代码都是合法用户,所以每次推送都需要输入账号密码验证推送用户是否是合法用户,为了省去每次输入密码的步骤,采用了ssh,当你推送的时候,git就会匹配你的私钥跟GitHub上面的公钥是否是配对的,若是匹配就认为你是合法用户,则允许推送。这样可以保证每次的推送都是正确合法的。

安装Node.js

Hexo基于Node.js,Node.js下载地址:Download | Node.js 下载安装包,注意安装Node.js会包含环境变量及npm的安装,安装后,检测Node.js是否安装成功,在命令行中输入 node -v 就可以检测node是否安装成功,这个,一般都是一直next就行

检测npm是否安装成功,在命令行中输入npm -v

到这了,安装Hexo的环境已经全部搭建完成。

安装Hexo

Hexo就是我们的个人博客网站的框架, 这里需要自己在电脑常里创建一个文件夹,可以命名为Blog或者myblog,Hexo框架与以后你自己发布的网页都在这个文件夹中。创建好后,进入文件夹中,按住shift键,右击鼠标点击命令行

使用npm命令安装Hexo,输入:

1
npm install -g hexo-cli 

安装最好翻墙,耐心等待,安装完成后就可以初始化我们的博客了,输入:(init后面要接自己创建的空文件夹的名字,不然没有反应)注意,这里的命令都是作用在刚刚创建的Blog文件夹中。

1
hexo init myblog

为了检测我们的网站雏形,分别按顺序输入以下三条命令:

1
2
3
4
5
hexo new test_my_site

hexo g

hexo s

这些命令在后面作介绍,完成后,打开浏览器输入地址:

localhost:4000

可以看出我们写出第一篇博客,只不过我下图是我修改过的配置,和你的显示不一样。

Snipaste_2023-07-18_21-04-33

现在来介绍常用的Hexo 命令

npm install hexo -g #安装Hexo
npm update hexo -g #升级
hexo init #初始化博客

命令简写
hexo n “我的博客” == hexo new “我的博客” #新建文章
hexo g == hexo generate #生成
hexo s == hexo server #启动服务预览
hexo d == hexo deploy #部署

hexo server #Hexo会监视文件变动并自动更新,无须重启服务器
hexo server -s #静态模式
hexo server -p 5000 #更改端口
hexo server -i 192.168.1.1 #自定义 IP
hexo clean #清除缓存,若是网页正常情况下可以忽略这条命令

刚刚的三个命令依次是新建一篇博客文章、生成网页、在本地预览的操作。

推送网站

上面只是在本地预览,接下来要做的就是就是推送网站,也就是发布网站,让我们的网站可以被更多的人访问。在设置之前,需要解释一个概念,在blog根目录里的_config.yml文件称为站点配置文件,进入根目录里的themes文件夹,里面也有个_config.yml文件,这个称为主题配置文件

1
2
站点配置文件: \github-blog\blog-theme
主题配置文件: \github-blog\blog-theme\themes\landscape

下一步将我们的Hexo与GitHub关联起来,打开站点的配置文件_config.yml,翻到最后修改为:

deploy:
type: git
repo: 这里填入你之前在GitHub上创建仓库的完整路径,记得加上 .git
branch:

master参考如下:

Snipaste_2023-07-18_21-08-17

保存站点配置文件。

其实就是给hexo d 这个命令做相应的配置,让hexo知道你要把blog部署在哪个位置,很显然,我们部署在我们GitHub的仓库里。最后安装Git部署插件,输入命令:

1
npm install hexo-deployer-git --save

这时,我们分别输入三条命令:

1
2
3
hexo clean 
hexo g
hexo d

其实第三条的 hexo d 就是部署网站命令,d是deploy的缩写。完成后,打开浏览器,在地址栏输入你的放置个人网站的仓库路径,即 http://xxxx.github.io

你就会发现你的博客已经上线了,可以在网络上被访问了。

更换主题

如果你不喜欢Hexo默认的主题,可以更换不同的主题,主题传送门:Themes 我自己使用的是Next主题,可以在blog目录中的themes文件夹中查看你自己主题是什么。现在把默认主题更改成Next主题,在blog目录中(就是命令行的位置处于blog目录)打开命令行输入:

1
git clone https://github.com/iissnan/hexo-theme-next themes/next

这是将Next主题下载到blog目录的themes主题下的next文件夹中。打开站点的_config.yml配置文件,修改主题为next

这个主题有中文文档,帮助小白理解

1
https://keep-docs.xpoet.cn/

在你这个博客的界面下,打开git Bash Here

1
git clone https://github.com/XPoet/hexo-theme-keep themes/keep

Keep 主题安装完成后,在 Hexo 配置文件 _config.yml 中将 theme 设置为 keep

Snipaste_2023-07-18_21-13-41

就可以了,如果想要修改更多,就参考帮助文档

发布文章

文章需要用markdown写,语法自己去网上找,用Typora或者obdsian编写

在命令行中输入:

1
hexo n "博客名字"

我们会发现在blog根目录下的source文件夹中的_post文件夹中多了一个 博客名字.md 文件,使用Markdown编辑器打开,就可以开始你的个人博客之旅了,

这是我的一篇博文内容示例:

Snipaste_2023-07-18_21-16-29

通过带有预览样式的Markdown编辑器实时预览书写的博文样式,也可以通过命令 hexo s –debug 在本地浏览器的localhost:4000 预览博文效果。写好博文并且样式无误后,通过hexo g、hexo d 生成、部署网页。随后可以在浏览器中输入域名浏览。

寻找图床

图床,当博文中有图片时,若是少量图片,可以直接把图片存放在source文件夹中,但这显然不合理的,因为图片会占据大量的存储的空间,加载的时候相对缓慢 ,这时考虑把博文里的图片上传到某一网站,然后获得外部链接,使用Markdown语法,**图片信息** 完成图片的插入,这种网站就被成为图床。

我用的这个

1
https://github.com/XPoet/picx

个性化设置

所谓的个性化设置就是根据个人需要添加不同的插件及功能

在站点配置文件_config.yml修改基本的站点信息

1
2
3
4
5
6
7
8
# Site
title: 我叫SunnyYang
subtitle: ''
description: ''
keywords:
author: SunnyYang
language: en
timezone: ''

依次是网站标题、副标题、网站描述、作者、网站头像外部链接、网站语言、时区等。

在主题配置文件_config.yml修改基本的主题信息,详细查看主题的帮助文档

参考链接:https://zhuanlan.zhihu.com/p/26625249?dark_mode=0

  • Copyrights © 2023 SunnyYang
  • Visitors: | Views:

请我喝杯咖啡吧~

支付宝
微信