wordpress 标签

博客被xmlrpc攻击记录

  |   0 评论   |   0 浏览

最近一段时间以来,网站访问速度时好时坏,很奇怪。有的时候干脆就打不开了。

查看了一下手机端阿里云监控发现CPU,内存占用率都暴高,如下图所示:

2 31

这事略奇怪啊,我这博客平时根本没啥人访问,每天的IP数连10个都不到,不可能有这么高的CPU和内存占用率啊。

果断远程SSH连上看一下,输入top命令显示:

4

我了个去,全是apache进程,吓尿了好么,难道正好遇到了搜索引擎爬虫?

再看一下请求地址好了:

5

 

xmlrpc.php是个什么鬼…… 度娘了一下:

6

 

我艹,居然被攻击了,尼玛!

果断删除了xmlrpc.php文件,话说这文件貌似并没有什么卵用。

再输入top命令看一下:

7
世界清净了。
 

从wordpress迁移到b3log - solo 有更新!

  |   0 评论   |   0 浏览

前提条件

  1. 首先安装好solo,创建用户保证可以访问。
  2. 确保wordpress数据库与solo数据库可以同时访问。

执行脚本

以solo数据库为访问库,wordpress数据库被我命名为wp了,如果命名不一致,将wp改为你的wordpress数据库名即可。

导入文章表数据

INSERT INTO b3_solo_article

SELECT
	posts.id AS oId
	,posts.post_title AS articleTitle
	,'' AS articleAbstract
	,'' AS articleAbstractText
	,(SELECT
			group_concat(terms.name)
		FROM
			wp.wp_terms terms,
			wp.wp_term_relationships rs
		WHERE
			terms.term_id = rs.term_taxonomy_id
		AND rs.object_id = posts.ID
		GROUP BY rs.object_id ) AS articleTags
	,(select oId from b3_solo_user LIMIT 1) AS articleAuthorId
	,0 AS articleCommentCount
	,0 AS articleViewCount
	,posts.post_content AS articleContent
	,concat('/articles/',year(posts.post_date),'/',LPAD(month(posts.post_date), 2, 0),'/',LPAD(DAY(posts.post_date),2,0),'/',posts.id,'.html') AS articlePermalink
	,0 AS articlePutTop
	,concat(unix_timestamp(posts.post_date),'000') AS articleCreated
	,concat(unix_timestamp(posts.post_date),'000') AS articleUpdated
	,RAND() AS articleRandomDouble
	,1 AS articleSignId
	,1 AS articleCommentable
	,'' AS articleViewPwd
	,'https://img.hacpai.com/bing/20180320.jpg?imageView2/1/w/1280/h/720/interlace/1/q/100' AS articleImg1URL
	,(CASE WHEN posts.post_status = 'publish' THEN 0 ELSE 1 END) AS articleStatus
FROM
	wp.wp_posts posts
WHERE posts.post_parent = 0
AND posts.post_type != 'nav_menu_item'
AND posts.post_type != 'page'

导入存档日期表数据

INSERT INTO b3_solo_archivedate
SELECT DISTINCT
	concat(
		unix_timestamp(
			str_to_date(
				concat(
					YEAR (posts.post_date),
					'-',
					LPAD(MONTH(posts.post_date), 2, 0),
					'-01'
				),
				'%Y-%m-%d'
			)
		),
		'000'
	) AS oId
	,concat(
		unix_timestamp(
			str_to_date(
				concat(
					YEAR (posts.post_date),
					'-',
					LPAD(MONTH(posts.post_date), 2, 0),
					'-01'
				),
				'%Y-%m-%d'
			)
		),
		'000'
	) AS archiveDate_oId
FROM
	wp.wp_posts posts
WHERE
	posts.post_parent = 0
AND posts.post_type != 'nav_menu_item'
AND posts.post_type != 'page'

GROUP BY concat(
		unix_timestamp(
			str_to_date(
				concat(
					YEAR (posts.post_date),
					'-',
					LPAD(MONTH(posts.post_date), 2, 0),
					'-01'
				),
				'%Y-%m-%d'
			)
		),
		'000'
	)

导入存档-文章关联表数据

INSERT INTO b3_solo_archivedate_article
SELECT
	posts.id AS oId,
	concat(
		unix_timestamp(
			str_to_date(
				concat(
					YEAR (posts.post_date),
					'-',
					LPAD(MONTH(posts.post_date), 2, 0),
					'-01'
				),
				'%Y-%m-%d'
			)
		),
		'000'
	) AS archiveDate_oId,
	posts.id AS article_oId
FROM
	wp.wp_posts posts
WHERE
	posts.post_parent = 0
AND posts.post_type != 'nav_menu_item'
AND posts.post_type != 'page'

导入标签表数据

INSERT INTO b3_solo_tag
SELECT
	term_id AS oId,
	name AS tagTitle
FROM
	wp.wp_terms

导入标签-文章关联表数据

INSERT INTO b3_solo_tag_article
SELECT
	CONCAT(object_id,term_taxonomy_id) AS oId,
	object_id AS article_oId,
	term_taxonomy_id AS tag_oId
FROM
	wp.wp_term_relationships

完成